|
#include <Wt/WServer>
|
|
#include <Wt/WEnvironment>
|
|
#include <Wt/WPushButton>
|
|
#include <Wt/WContainerWidget>
|
|
#include <Wt/WHBoxLayout>
|
|
#include <Wt/WText>
|
|
#include <Wt/WVBoxLayout>
|
|
#include <Wt/WBreak>
|
|
|
|
using namespace Wt;
|
|
|
|
class TestApplication : public WApplication
|
|
{
|
|
public:
|
|
TestApplication(const WEnvironment& env);
|
|
~TestApplication();
|
|
void addText();
|
|
|
|
private:
|
|
WPushButton *pb1_;
|
|
WText *item3_;
|
|
};
|
|
|
|
TestApplication::TestApplication(const WEnvironment& env)
|
|
: WApplication(env), pb1_(0)
|
|
{
|
|
setTitle("layout issue");
|
|
setCssTheme("polished");
|
|
|
|
styleSheet().addRule(".yellow-box",
|
|
"background-color: #ffffb4; border: 1px solid black; margin-top: 1ex; margin-bottom: 1ex;");
|
|
styleSheet().addRule(".green-box",
|
|
"background-color: #c4ffb4; min-height: 30px; text-align: center; padding: 3px;");
|
|
styleSheet().addRule(".blue-box",
|
|
"background-color: #65dae8; min-height: 30px; text-align: center; padding: 3px;");
|
|
|
|
WContainerWidget *w = new WContainerWidget(root());
|
|
new WText("If 'left' box is taller than the 'right' box at start-up, "
|
|
"then adding text to the right box does not push down the footer correctly with Firefox. "
|
|
"It seems to work OK with other browsers. "
|
|
"It also works as expected if the left box is not taller at start-up. "
|
|
"Test with '?OK' as a URL parameter.", w);
|
|
|
|
new WBreak(w);
|
|
|
|
pb1_ = new WPushButton("Push to add text to right box", w);
|
|
|
|
WContainerWidget *container = new WContainerWidget(w);
|
|
container->resize(200, WLength::Auto);
|
|
container->setStyleClass("yellow-box");
|
|
|
|
WVBoxLayout *vbox = new WVBoxLayout();
|
|
container->setLayout(vbox);
|
|
|
|
WText *item = new WText("header");
|
|
item->setStyleClass("green-box");
|
|
item->resize(WLength::Auto, 10);
|
|
vbox->addWidget(item);
|
|
|
|
WHBoxLayout *hbox = new WHBoxLayout();
|
|
vbox->addLayout(hbox);
|
|
|
|
item = new WText("footer");
|
|
item->setStyleClass("green-box");
|
|
vbox->addWidget(item);
|
|
|
|
if (env.getParameter("OK")) {
|
|
item = new WText("Left");
|
|
}
|
|
else {
|
|
item = new WText("Left is longer at start");
|
|
}
|
|
|
|
item->setStyleClass("green-box");
|
|
hbox->addWidget(item);
|
|
|
|
item3_ = new WText("right");
|
|
item3_->setStyleClass("blue-box");
|
|
hbox->addWidget(item3_);
|
|
|
|
hbox->setResizable(0, true, 100);
|
|
|
|
pb1_->clicked().connect(this, &TestApplication::addText);
|
|
}
|
|
|
|
void TestApplication::addText() {
|
|
item3_->setText(item3_->text() + " more text");
|
|
}
|
|
|
|
TestApplication::~TestApplication()
|
|
{
|
|
}
|
|
|
|
WApplication *createApplication(const WEnvironment& env)
|
|
{
|
|
return new TestApplication(env);
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
int status = WRun(argc, argv, &createApplication);
|
|
return status;
|
|
}
|