Project

General

Profile

Bug #1323 ยป main.cpp

Rob Van Dyck, 06/14/2012 11:41 AM

 
#include <Wt/WApplication>
#include <Wt/WContainerWidget>
#include <Wt/WInPlaceEdit>
#include <Wt/WLength>
#include <Wt/WSuggestionPopup>
#include <Wt/WStandardItemModel>
#include <Wt/WLineEdit>
#include <Wt/WText>
#include <Wt/WString>
#include <Wt/WTableView>
#include <Wt/WTreeView>
#include <Wt/WStandardItem>
#include <Wt/WItemDelegate>
#include <Wt/WDialog>
#include <Wt/WPushButton>
#include <Wt/WAbstractProxyModel>
#include <Wt/WEvent>
#include <Wt/WSignal>
#include <Wt/WModelIndex>
#include <Wt/WHBoxLayout>
#include <Wt/WVBoxLayout>
#include <Wt/WGroupBox>
#include <Wt/WTemplate>
#include <Wt/WStackedWidget>
#include <Wt/WMenu>
#include <Wt/WServer>
#include <Wt/WSubMenuItem>
#include <Wt/WMenuItem>
#include <Wt/WTabWidget>
#include <Wt/WSpinBox>
#include <Wt/WRadioButton>
#include <Wt/WStreamResource>

#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include <Wt/WPainter>
#include <Wt/WPaintDevice>
#include <Wt/WPaintedWidget>

#include <fstream>

using namespace Wt;
using namespace boost;

using std::string;

class MyApplication: public WApplication {
public:
MyApplication(const Wt::WEnvironment& env);
void remove_add();
void add();


WVBoxLayout *layout_;
WContainerWidget *container_;
};


void MyApplication::add()
{
container_ = new WContainerWidget();
container_->addWidget(new WText("test 123"));
layout_->addWidget(container_);
}

void MyApplication::remove_add()
{
layout_->removeWidget(container_);
add();
}

MyApplication::MyApplication(const Wt::WEnvironment& env)
: Wt::WApplication(env)
{
// enable updates
this->enableUpdates(true);

layout_ = new WVBoxLayout();
root()->setLayout(layout_);
layout_->addWidget(new WSpinBox());
WPushButton *button__ = new WPushButton();
button__->setText("pushme");
button__->clicked().connect(boost::bind(&MyApplication::remove_add, this));
layout_->addWidget(button__);
add();
}


WApplication* createApplication(const Wt::WEnvironment& env)
{
WApplication* app = new MyApplication(env);
return app;
}

int main(int argc, char *argv[])
{
return Wt::WRun(argc, argv, &createApplication);
}
    (1-1/1)