LibreOffice Module cui (master) 1
widgettestdlg.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3* This file is part of the LibreOffice project.
4*
5* This Source Code Form is subject to the terms of the Mozilla Public
6* License, v. 2.0. If a copy of the MPL was not distributed with this
7* file, You can obtain one at http://mozilla.org/MPL/2.0/.
8*/
9
10#include <widgettestdlg.hxx>
11#include <bitmaps.hlst>
12
14 : GenericDialogController(pParent, "cui/ui/widgettestdialog.ui", "WidgetTestDialog")
15{
16 m_xOKButton = m_xBuilder->weld_button("ok_btn");
17 m_xCancelButton = m_xBuilder->weld_button("cancel_btn");
18 m_xTreeView = m_xBuilder->weld_tree_view("contenttree");
19 m_xTreeView2 = m_xBuilder->weld_tree_view("contenttree2");
20
21 m_xOKButton->connect_clicked(LINK(this, WidgetTestDialog, OkHdl));
22 m_xCancelButton->connect_clicked(LINK(this, WidgetTestDialog, CancelHdl));
23
25}
26
28
30
32{
33 m_xDialog->response(RET_CANCEL);
34}
35
37{
38 OUString aImage1(RID_SVXBMP_CELL_LR);
39 OUString aImage2(RID_SVXBMP_SHADOW_BOT_LEFT);
40
41 for (size_t nCount = 0; nCount < 4; nCount++)
42 {
43 OUString sText = OUString::Concat("Test ") + OUString::Concat(OUString::number(nCount));
44 std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->make_iterator();
45 m_xTreeView->insert(nullptr, -1, &sText, &sText, nullptr, nullptr, false, xEntry.get());
46 m_xTreeView->set_image(*xEntry, (nCount % 2 == 0) ? aImage1 : aImage2);
47
48 m_xTreeView2->append();
49 m_xTreeView2->set_image(nCount, (nCount % 2 == 0) ? aImage1 : aImage2);
50 m_xTreeView2->set_text(nCount, "First Column", 0);
51 m_xTreeView2->set_text(
52 nCount, OUString::Concat("Row ") + OUString::Concat(OUString::number(nCount)), 1);
53 m_xTreeView2->set_id(nCount, OUString::number(nCount));
54 }
55}
56
57/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XExecutableDialog > m_xDialog
std::unique_ptr< weld::TreeView > m_xTreeView2
std::unique_ptr< weld::Button > m_xOKButton
std::unique_ptr< weld::TreeView > m_xTreeView
std::unique_ptr< weld::Button > m_xCancelButton
WidgetTestDialog(weld::Window *pParent)
std::unique_ptr< weld::Builder > m_xBuilder
int nCount
RET_OK
RET_CANCEL
IMPL_LINK_NOARG(WidgetTestDialog, OkHdl, weld::Button &, void)