Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wt/WApplication>
- #include <Wt/WContainerWidget>
- #include <Wt/WText>
- #include <Wt/WTableView>
- #include <Wt/WTimer>
- #include <Wt/WTabWidget>
- #include <Wt/WStringListModel>
- #include <boost/bind.hpp>
- using namespace Wt;
- namespace {
- void timerFired(WStringListModel * model)
- {
- model->addString("A");
- model->addString("B");
- model->addString("C");
- model->addString("D");
- model->addString("E");
- model->addString("F");
- model->addString("G");
- model->addString("H");
- model->addString("I");
- model->addString("J");
- model->addString("K");
- model->addString("L");
- model->addString("M");
- model->addString("N");
- model->addString("O");
- model->addString("P");
- }
- }
- class MyApp : public WApplication {
- public:
- MyApp(const WEnvironment& env)
- : WApplication(env)
- {
- //Just for looks
- WCssTextRule *styleRule = new WCssTextRule(".test", "background:#FEE;");
- styleSheet().addRule(styleRule);
- WContainerWidget * cont = new WContainerWidget(root());
- cont->setStyleClass("test");
- //Make the tableview
- WTableView * table = new WTableView(root());
- WStringListModel * model = new WStringListModel( table );
- table->setModel( model );
- //Setup a timer to update the model
- WTimer::singleShot( 2000, boost::bind(&timerFired, model) );
- cont->addWidget(table);
- }
- static Wt::WApplication* CreateApplication (const Wt::WEnvironment& env)
- {
- return new MyApp(env);
- }
- };
- int main (int argc, char** argv)
- {
- return WRun(argc, argv, &MyApp::CreateApplication);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement