HelloApp(const Wt::WEnvironment& env) : Wt::WApplication(env) { setTitle("Hello world"); mainWindow = new MainWindow(root()); setCssTheme("default"); declareJavaScriptFunction("updateStyles", "function () {" "var es = $('link[href$=\"request=style\"]');" "for (i=0;i<es.length;++i){" "var e = es[0];" "e.setAttribute('href', e.getAttribute('href'));" "}" "}" ); }
Application::Application(const Wt::WEnvironment& env, Server& server): Wt::WApplication(env), session_(server), fact_path_format_("/fact/%i/"), comment_path_format_("/fact/%i/comment/%i/"), ip_path_format_("/admin/ip/%s/"), admin_(false) { init_counters_(); messageResourceBundle().use(Wt::WApplication::appRoot() + "locales/facts"); setCssTheme("polished"); useStyleSheet("css/facts.css"); facts_ = new FactsWidget(root()); internalPathChanged().connect(this, &Application::path_changed_handler_); facts_->set_random_fact(); WApplication::setInternalPath(environment().internalPath(), true); }
TableView::TableView(const Wt::WEnvironment& env, Table *t) : Wt::WApplication(env), table(t) { setTitle("Push Test"); setCssTheme(""); useStyleSheet("data/style.css"); enableUpdates(true); messageResourceBundle().use(appRoot() + "i18n"); table->connect(this); Wt::WPushButton* button = new Wt::WPushButton("Increment", root()); sound = new Wt::WSound("data/click.mp3"); button->clicked().connect(this, &TableView::increment); text = new Wt::WText("Number will appear here", root()); }