1 #include <cppconsui/Label.h>
2 #include <cppconsui/Window.h>
6 class TestWindow
: public CppConsUI::Window
{
8 TestWindow(int number
, int x
, int y
, int w
, int h
);
9 virtual ~TestWindow() override
{}
12 CONSUI_DISABLE_COPY(TestWindow
);
15 TestWindow::TestWindow(int number
, int x
, int y
, int w
, int h
)
16 : CppConsUI::Window(x
, y
, w
, h
)
18 CppConsUI::Label
*label
;
20 std::string text
= std::string("Win ") +
21 dynamic_cast<std::ostringstream
*>(&(std::ostringstream() << number
))
23 label
= new CppConsUI::Label(w
- 4, 1, text
.c_str());
24 addWidget(*label
, 2, 1);
27 label
= new CppConsUI::Label("Press F10 to quit.");
28 addWidget(*label
, 2, 2);
30 label
= new CppConsUI::Label("Press ESC to close a focused window.");
31 addWidget(*label
, 2, 3);
37 // Create test windows.
38 for (int i
= 1; i
<= 4; ++i
) {
39 auto win
= new TestWindow(i
, (i
- 1) % 2 * 40, (i
- 1) / 2 * 10, 40, 10);
44 // vim: set tabstop=2 shiftwidth=2 textwidth=80 expandtab