Update list of wide characters
[centerim5.git] / tests / textentry.cpp
blobd9ada83ce4a9c30b709b79d0e4ec504a4cfe1d58
1 #include <cppconsui/Label.h>
2 #include <cppconsui/Panel.h>
3 #include <cppconsui/TextEntry.h>
4 #include <cppconsui/Window.h>
6 // TestWindow class
7 class TestWindow : public CppConsUI::Window {
8 public:
9 TestWindow();
10 virtual ~TestWindow() override {}
12 private:
13 CONSUI_DISABLE_COPY(TestWindow);
16 TestWindow::TestWindow() : CppConsUI::Window(0, 0, AUTOSIZE, AUTOSIZE)
18 setClosable(false);
20 addWidget(*(new CppConsUI::Label("Press F10 to quit.")), 1, 1);
21 addWidget(*(new CppConsUI::Label("Press TAB to move focus.")), 1, 2);
22 addWidget(*(new CppConsUI::Label(
23 "All TextEntry widgets are surrouned by "
24 "Panel widget in this test (except the autosize example).")),
25 1, 3);
27 addWidget(*(new CppConsUI::Panel(22, 3)), 1, 5);
28 addWidget(*(new CppConsUI::TextEntry(20, 1, "Edit me.")), 2, 6);
30 addWidget(*(new CppConsUI::Panel(22, 3)), 1, 9);
31 addWidget(*(new CppConsUI::TextEntry(
32 20, 1, "Too wide string, too wide string, too wide string")),
33 2, 10);
35 addWidget(*(new CppConsUI::Panel(22, 5)), 1, 13);
36 addWidget(*(new CppConsUI::TextEntry(
37 20, 3, "Multiline textentry, multiline textentry")),
38 2, 14);
40 // Unicode test.
41 addWidget(*(new CppConsUI::Panel(32, 5)), 1, 19);
42 addWidget(*(new CppConsUI::TextEntry(30, 3,
43 "\x56\xc5\x99\x65\xc5\xa1\x74\xc3\xad\x63\xc3\xad\x20\x70\xc5\x99"
44 "\xc3\xad\xc5\xa1\x65\x72\x79\x20\x73\x65\x20\x64\x6f\xc5\xbe\x61"
45 "\x64\x6f\x76\x61\x6c\x79\x20\xc3\xba\x70\x6c\x6e\xc4\x9b\x20\xc4"
46 "\x8d\x65\x72\x73\x74\x76\xc3\xbd\x63\x68\x20\xc5\x99\xc3\xad\x7a"
47 "\x65\xc4\x8d\x6b\xc5\xaf\x2e\x0a")),
48 2, 20);
50 addWidget(*(new CppConsUI::TextEntry("Autosize")), 2, 25);
53 void setupTest()
55 // Create the main window.
56 auto win = new TestWindow;
57 win->show();
60 // vim: set tabstop=2 shiftwidth=2 textwidth=80 expandtab