1 #include <cppconsui/Button.h>
2 #include <cppconsui/Label.h>
3 #include <cppconsui/TreeView.h>
4 #include <cppconsui/Window.h>
7 class TestWindow
: public CppConsUI::Window
{
10 virtual ~TestWindow() override
{}
13 CONSUI_DISABLE_COPY(TestWindow
);
16 TestWindow::TestWindow() : Window(0, 0, AUTOSIZE
, AUTOSIZE
)
20 addWidget(*(new CppConsUI::Label(20, 1, "Press F10 to quit.")), 1, 1);
22 auto tree
= new CppConsUI::TreeView(30, 12);
23 addWidget(*tree
, 1, 3);
26 CppConsUI::TreeView::NodeReference node
, node2
;
28 node
= tree
->appendNode(
29 tree
->getRootNode(), *(new CppConsUI::Button("Button node A")));
30 node2
= tree
->appendNode(node
, *(new CppConsUI::Button("Button node A-1")));
31 tree
->appendNode(node2
, *(new CppConsUI::Button("Button node A-1-a")));
32 tree
->appendNode(node2
, *(new CppConsUI::Button("Button node A-1-b")));
33 tree
->appendNode(node2
, *(new CppConsUI::Button("Button node A-1-c")));
34 tree
->appendNode(node
, *(new CppConsUI::Button("Button node A-2")));
35 tree
->appendNode(node
, *(new CppConsUI::Button("Button node A-3")));
37 node
= tree
->appendNode(
38 tree
->getRootNode(), *(new CppConsUI::Label("Label node B")));
39 tree
->appendNode(node
, *(new CppConsUI::Label("Label node B-1")));
40 tree
->appendNode(node
, *(new CppConsUI::Label("Label node B-2")));
41 tree
->appendNode(node
, *(new CppConsUI::Label("Label node B-3")));
43 node
= tree
->appendNode(
44 tree
->getRootNode(), *(new CppConsUI::Button("Button node C")));
45 tree
->appendNode(node
, *(new CppConsUI::Button("Button node C-1")));
46 tree
->appendNode(node
, *(new CppConsUI::Button("Button node C-2")));
47 tree
->appendNode(node
, *(new CppConsUI::Button("Button node C-3")));
52 // Create the main window.
53 auto win
= new TestWindow
;
57 // vim: set tabstop=2 shiftwidth=2 textwidth=80 expandtab