1 #include <Wt/WContainerWidget.h>
2 #include <Wt/WHBoxLayout.h>
3 #include <Wt/WText.h>
4 #include <Wt/WVBoxLayout.h>
5 
6 SAMPLE_BEGIN(NestedLayout)
7 auto container = std::make_unique<Wt::WContainerWidget>();
8 container->resize(200, 200);
9 container->setStyleClass("yellow-box centered");
10 
11 auto vbox = container->setLayout(std::make_unique<Wt::WVBoxLayout>());
12 
13 auto item = std::make_unique<Wt::WText>("Item 1");
14 item->setStyleClass("green-box");
15 vbox->addWidget(std::move(item), 1);
16 
17 #ifndef WT_TARGET_JAVA
18 auto hbox = vbox->addLayout(std::make_unique<Wt::WHBoxLayout>());
19 #else // WT_TARGET_JAVA
20 auto hbox = std::make_unique<Wt::WHBoxLayout>();
21 vbox->addLayout(hbox);
22 #endif // WT_TARGET_JAVA
23 
24 item = std::make_unique<Wt::WText>("Item 2");
25 item->setStyleClass("green-box");
26 hbox->addWidget(std::move(item));
27 
28 item = std::make_unique<Wt::WText>("Item 3");
29 item->setStyleClass("blue-box");
30 hbox->addWidget(std::move(item));
31 
32 SAMPLE_END(return std::move(container))
33