1
|
#include <Wt/WApplication>
|
2
|
#include <Wt/WContainerWidget>
|
3
|
|
4
|
#include <Wt/WLineEdit>
|
5
|
#include <Wt/WMenu>
|
6
|
#include <Wt/WMessageBox>
|
7
|
#include <Wt/WNavigationBar>
|
8
|
#include <Wt/WPopupMenu>
|
9
|
#include <Wt/WPopupMenuItem>
|
10
|
#include <Wt/WStackedWidget>
|
11
|
#include <Wt/WText>
|
12
|
#include <Wt/WBootstrapTheme>
|
13
|
|
14
|
using namespace Wt;
|
15
|
using namespace std;
|
16
|
|
17
|
class RTLApplication : public WApplication {
|
18
|
public:
|
19
|
RTLApplication(WEnvironment const & env);
|
20
|
};
|
21
|
|
22
|
RTLApplication::RTLApplication(WEnvironment const & env)
|
23
|
: WApplication(env) {
|
24
|
|
25
|
setLayoutDirection(RightToLeft);
|
26
|
|
27
|
messageResourceBundle().use("bootstrap_theme");
|
28
|
setTheme(new WBootstrapTheme());
|
29
|
useStyleSheet("css/style.css");
|
30
|
|
31
|
setTitle("RTL Application");
|
32
|
|
33
|
|
34
|
WContainerWidget * container = new WContainerWidget(root());
|
35
|
container->setWidth(800);
|
36
|
|
37
|
WNavigationBar * navigation = new WNavigationBar(container);
|
38
|
navigation->setTitle("TITLE", "/");
|
39
|
|
40
|
WStackedWidget * contentsStack = new WStackedWidget(container);
|
41
|
contentsStack->addStyleClass("contents");
|
42
|
|
43
|
WMenu * leftMenu = new WMenu(contentsStack, container);
|
44
|
navigation->addMenu(leftMenu);
|
45
|
|
46
|
leftMenu->addItem("Column 1", new WText("Column 1 content"));
|
47
|
leftMenu->addItem("Column 2", new WText("Column 2 content"));
|
48
|
leftMenu->addItem("Column 3", new WText("Column 3 content"));
|
49
|
|
50
|
WMenu * rightMenu = new WMenu();
|
51
|
navigation->addMenu(rightMenu, AlignRight);
|
52
|
|
53
|
WPopupMenu * popup = new Wt::WPopupMenu();
|
54
|
popup->addItem("Row 1");
|
55
|
popup->addItem("Row 2");
|
56
|
popup->addItem("Row 3");
|
57
|
|
58
|
WMenuItem * item = new WMenuItem("rightMenu");
|
59
|
item->setMenu(popup);
|
60
|
rightMenu->addItem(item);
|
61
|
|
62
|
WLineEdit *edit = new WLineEdit();
|
63
|
edit->setEmptyText("Enter a search item");
|
64
|
|
65
|
navigation->addSearch(edit, AlignRight);
|
66
|
|
67
|
container->addWidget(contentsStack);
|
68
|
|
69
|
root()->addWidget(container);
|
70
|
}
|
71
|
|
72
|
WApplication * createApplication(WEnvironment const & env) {
|
73
|
return new RTLApplication(env);
|
74
|
}
|
75
|
|
76
|
int main(int argc, char ** argv) {
|
77
|
return WRun(argc, argv, &createApplication);
|
78
|
}
|