[CI] Stop the container at the end
[centerim5.git] / tests / window.cpp
blobf95665fbad1d5226e6f35dc6d7c2dee2cf448cd7
1 #include <cppconsui/Label.h>
2 #include <cppconsui/Window.h>
3 #include <sstream>
5 // TestWindow class
6 class TestWindow : public CppConsUI::Window {
7 public:
8 TestWindow(int number, int x, int y, int w, int h);
9 virtual ~TestWindow() override {}
11 private:
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))
22 ->str();
23 label = new CppConsUI::Label(w - 4, 1, text.c_str());
24 addWidget(*label, 2, 1);
26 if (number == 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);
35 void setupTest()
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);
40 win->show();
44 // vim: set tabstop=2 shiftwidth=2 textwidth=80 expandtab