|
#include <iostream>
|
|
#include <Wt/WApplication.h>
|
|
#include <Wt/WBreak.h>
|
|
#include <Wt/WContainerWidget.h>
|
|
#include <Wt/WLineEdit.h>
|
|
#include <Wt/WPushButton.h>
|
|
#include <Wt/WText.h>
|
|
#include <Wt/WGridLayout.h>
|
|
#include <Wt/WVBoxLayout.h>
|
|
#include <Wt/WStackedWidget.h>
|
|
#include <Wt/WCssDecorationStyle.h>
|
|
|
|
using namespace std;
|
|
|
|
class HelloApplication : public Wt::WApplication
|
|
{
|
|
public:
|
|
HelloApplication(const Wt::WEnvironment& env) : Wt::WApplication(env)
|
|
{
|
|
setTitle("Hello world");
|
|
Wt::WCssDecorationStyle style;
|
|
|
|
auto vbox = Wt::cpp14::make_unique<Wt::WVBoxLayout>();
|
|
auto contentsStack = Wt::cpp14::make_unique<Wt::WStackedWidget>();
|
|
style.setBackgroundColor(Wt::WColor(230, 230, 230));
|
|
contentsStack->setDecorationStyle(style);
|
|
|
|
auto view = Wt::cpp14::make_unique<Wt::WContainerWidget>();
|
|
style.setBackgroundColor(Wt::WColor(130, 130, 130));
|
|
view->setDecorationStyle(style);
|
|
|
|
auto grid = Wt::cpp14::make_unique<Wt::WGridLayout>();
|
|
grid->addWidget(Wt::cpp14::make_unique<Wt::WText>("Item 1"), 0, 0);
|
|
grid->addWidget(Wt::cpp14::make_unique<Wt::WText>("Item 2"), 1, 0);
|
|
view->setLayout(std::move(grid));
|
|
|
|
contentsStack->addWidget(std::move(view));
|
|
|
|
vbox->addWidget(std::move(contentsStack));
|
|
root()->setLayout(std::move(vbox));
|
|
}
|
|
};
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
return Wt::WRun(argc, argv, [](const Wt::WEnvironment& env) {
|
|
return Wt::cpp14::make_unique<HelloApplication>(env);
|
|
});
|
|
}
|
|
|
|
|