|
/*
|
|
* resizableBoxLayout.cpp
|
|
*
|
|
* Created on: 10.06.2013
|
|
* Author: Stoycho Stefanov
|
|
*/
|
|
|
|
|
|
|
|
#include <Wt/WApplication>
|
|
#include <Wt/WEnvironment>
|
|
#include <Wt/WContainerWidget>
|
|
#include <Wt/WCssDecorationStyle>
|
|
#include <Wt/WBoxLayout>
|
|
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
using namespace Wt;
|
|
using namespace std;
|
|
|
|
class MyApp : public WApplication {
|
|
public:
|
|
MyApp(const WEnvironment& env)
|
|
:
|
|
WApplication(env)
|
|
{
|
|
WContainerWidget *w = this->root();
|
|
w->setLayout(new WBoxLayout(WBoxLayout::TopToBottom));
|
|
w->layout()->setContentsMargins(0,0,0,0);
|
|
|
|
WContainerWidget *inner = new WContainerWidget();
|
|
inner->decorationStyle().setBackgroundColor(yellow);
|
|
WBoxLayout *layout = new WBoxLayout(WBoxLayout::TopToBottom,inner);
|
|
WContainerWidget *item = new WContainerWidget();
|
|
item->decorationStyle().setBackgroundColor(green);
|
|
layout->addWidget(item);
|
|
item = new WContainerWidget();
|
|
item->decorationStyle().setBackgroundColor(blue);
|
|
layout->addWidget(item);
|
|
layout->setResizable(0);
|
|
w->layout()->addWidget(inner);
|
|
|
|
inner = new WContainerWidget();
|
|
inner->decorationStyle().setBackgroundColor(yellow);
|
|
layout = new WBoxLayout(WBoxLayout::BottomToTop,inner);
|
|
item = new WContainerWidget();
|
|
item->decorationStyle().setBackgroundColor(green);
|
|
layout->addWidget(item);
|
|
item = new WContainerWidget();
|
|
item->decorationStyle().setBackgroundColor(blue);
|
|
layout->addWidget(item);
|
|
layout->setResizable(0); // works with index 1 !?!?!
|
|
w->layout()->addWidget(inner);
|
|
|
|
inner = new WContainerWidget();
|
|
inner->decorationStyle().setBackgroundColor(yellow);
|
|
layout = new WBoxLayout(WBoxLayout::LeftToRight,inner);
|
|
item = new WContainerWidget();
|
|
item->decorationStyle().setBackgroundColor(green);
|
|
layout->addWidget(item);
|
|
item = new WContainerWidget();
|
|
item->decorationStyle().setBackgroundColor(blue);
|
|
layout->addWidget(item);
|
|
layout->setResizable(0);
|
|
w->layout()->addWidget(inner);
|
|
|
|
inner = new WContainerWidget();
|
|
inner->decorationStyle().setBackgroundColor(yellow);
|
|
layout = new WBoxLayout(WBoxLayout::RightToLeft,inner);
|
|
item = new WContainerWidget();
|
|
item->decorationStyle().setBackgroundColor(green);
|
|
layout->addWidget(item);
|
|
item = new WContainerWidget();
|
|
item->decorationStyle().setBackgroundColor(blue);
|
|
layout->addWidget(item);
|
|
layout->setResizable(0); // works with index 1 !?!?!
|
|
w->layout()->addWidget(inner);
|
|
}
|
|
};
|
|
|
|
WApplication *createApplication(const WEnvironment& env) {
|
|
WApplication *app = new MyApp(env);
|
|
app->setTitle("resizable box layout ");
|
|
app->refresh();
|
|
app->setCssTheme("polished");
|
|
return app;
|
|
};
|
|
|
|
int main(int argc, char **argv) {
|
|
cout << "Wt = " << WT_VERSION_STR <<endl;
|
|
return WRun(argc, argv, &createApplication);
|
|
}
|
|
|
|
|