/* * Copyright (C) 2008 Emweb bvba, Heverlee, Belgium. * * See the LICENSE file for terms of use. */ #include #include #include #include #include #include #include #include using namespace Wt; class TestRedmine720 : public WApplication { public: TestRedmine720(const WEnvironment& env); private: bool expanded_; WContainerWidget* subcontainer_; WPushButton* expandButton_; void Expand(); }; TestRedmine720::TestRedmine720(const WEnvironment& env) : WApplication(env) { expanded_ = true; subcontainer_ = new WContainerWidget(); subcontainer_->addWidget(new WText("subcontainer")); expandButton_ = new WPushButton("-"); WSlider* slider = new WSlider(); slider->resize(200, 15); root()->setLayout(new WVBoxLayout()); root()->layout()->addWidget(expandButton_); root()->layout()->addWidget(slider); root()->layout()->addWidget(subcontainer_); expandButton_->clicked().connect(this, &TestRedmine720::Expand); } void TestRedmine720::Expand() { if (!expanded_) { root()->layout()->addWidget(subcontainer_); expandButton_->setText("-"); } else { root()->layout()->removeWidget(subcontainer_); expandButton_->setText("+"); } expanded_ = !expanded_; } WApplication *createApplication(const WEnvironment& env) { return new TestRedmine720(env); } int main(int argc, char **argv) { return WRun(argc, argv, &createApplication); }