WApplication *createApplication(const WEnvironment& env) { WApplication *app = new WApplication(env); app->setTitle(L"Drag & drop"); new WText("<h1>Wt Drag & drop example.</h1>", app->root()); new WText("<p>Help these people with their decision by dragging one of " "the pills.</p>", app->root()); if (!env.javaScript()) { new WText("<i>This examples requires that javascript support is " "enabled.</i>", app->root()); } WContainerWidget *pills = new WContainerWidget(app->root()); pills->setContentAlignment(WWidget::AlignCenter); createDragImage("blue-pill.jpg", "blue-pill-small.png", "blue-pill", pills); createDragImage("red-pill.jpg", "red-pill-small.png", "red-pill", pills); WContainerWidget *dropSites = new WContainerWidget(app->root()); new Character(L"Neo", dropSites); new Character(L"Morpheus", dropSites); new Character(L"Trinity", dropSites); app->useStyleSheet("dragdrop.css"); return app; }
WApplication *createApplication(const WEnvironment& env) { WApplication *app = new WApplication(env); new WText("Name: ", app->root()); WInPlaceEdit *edit = new WInPlaceEdit(L"Bob Smith", app->root()); edit->setStyleClass(L"inplace"); app->styleSheet().addRule("*.inplace span:hover", L"background-color: gray"); return app; }
void WPopupMenu::popupImpl() { renderOutAll(); result_ = 0; WApplication *app = WApplication::instance(); // XXX // We rely here on the fact that no other widget is listening for // escape on the root() if (app->globalEscapePressed().isConnected()) app->globalEscapePressed().emit(); globalClickConnection_ = app->root()->clicked().connect(this, &WPopupMenu::done); globalEscapeConnection_ = app->globalEscapePressed().connect(this, &WPopupMenu::done); app->pushExposedConstraint(this); prepareRender(app); show(); }
WApplication *createApplication(const WEnvironment& env) { WApplication *app = new WApplication(env); app->setTitle(L"Hangman"); new HangmanGame(app->root()); /* * The application style sheet (only for the highscore widget) */ WCssDecorationStyle cellStyle; WBorder cellBorder; cellBorder.setStyle(WBorder::Solid); cellBorder.setWidth(WBorder::Explicit, WLength(1)); cellBorder.setColor(WColor(Wt::lightGray)); cellStyle.setBorder(cellBorder); app->styleSheet().addRule(".highscores * TD", cellStyle); cellStyle.font().setVariant(WFont::SmallCaps); app->styleSheet().addRule(".highscoresheader", cellStyle); cellStyle.font().setVariant(WFont::NormalVariant); cellStyle.font().setStyle(WFont::Italic); cellStyle.font().setWeight(WFont::Bold); app->styleSheet().addRule(".highscoresself", cellStyle); return app; }
WApplication *createApplication(const WEnvironment& env) { WApplication *app = new WApplication(env); app->setTitle(L"Style example"); app->root()->addWidget(new StyleExample()); return app; }
Cms::Cms() : Page(), m_pimpl(make_unique<Cms::Impl>()) { WApplication *app = WApplication::instance(); app->setTitle(tr("cms-page-title")); this->clear(); this->setId("CmsPage"); this->setStyleClass("cms-page container-fluid"); this->addWidget(this->Layout()); app->root()->clear(); app->root()->addWidget(this); WTimer *timer = new WTimer(this); timer->setInterval(60000); // every one minute timer->timeout().connect(m_pimpl.get(), &Cms::Impl::ValidateSession); timer->start(); }
FlexLayoutImpl::~FlexLayoutImpl() { WApplication *app = WApplication::instance(); if (parentLayoutImpl() == nullptr) { if (container() == app->root()) { app->setBodyClass(""); app->setHtmlClass(""); } } }
StdGridLayoutImpl2::~StdGridLayoutImpl2() { WApplication *app = WApplication::instance(); /* * If it is a top-level layout (as opposed to a nested layout), * configure overflow of the container. */ if (parentLayoutImpl() == 0) { if (container() == app->root()) { app->setBodyClass(""); app->setHtmlClass(""); } if (app->environment().agentIsIElt(9) && container()) container()->setOverflow(WContainerWidget::OverflowVisible); } }
void WPopupMenu::done(WPopupMenuItem *result) { location_ = 0; result_ = result; hide(); WApplication *app = WApplication::instance(); app->root()->clicked().disconnect(globalClickConnection_); app->globalEscapePressed().disconnect(globalEscapeConnection_); app->popExposedConstraint(this); recursiveEventLoop_ = false; triggered_.emit(result_); aboutToHide_.emit(); }
void StdGridLayoutImpl2::containerAddWidgets(WContainerWidget *container) { StdLayoutImpl::containerAddWidgets(container); if (!container) return; WApplication *app = WApplication::instance(); /* * If it is a top-level layout (as opposed to a nested layout), * configure overflow of the container. */ if (parentLayoutImpl() == 0) { if (container == app->root()) { /* * Reset body,html default paddings and so on if we are doing layout * in the entire document. */ app->setBodyClass(app->bodyClass() + " Wt-layout"); app->setHtmlClass(app->htmlClass() + " Wt-layout"); } } }
WApplication *createApplication(const WEnvironment& env) { WApplication *appl = new WApplication(env); new WText("<h1>Your mission</h1>", appl->root()); WText *secret = new WText("Your mission, Jim, should you accept, is to create solid " "web applications.", appl->root()); new WBreak(appl->root()); new WBreak(appl->root()); new WText("This program will quit in ", appl->root()); CountDownWidget *countdown = new CountDownWidget(10, 0, 1000, appl->root()); new WText(" seconds.", appl->root()); new WBreak(appl->root()); new WBreak(appl->root()); WPushButton *cancelButton = new WPushButton("Cancel!", appl->root()); WPushButton *quitButton = new WPushButton("Quit", appl->root()); quitButton->clicked().connect(appl, &WApplication::quit); countdown->done().connect(appl, &WApplication::quit); cancelButton->clicked().connect(countdown, &CountDownWidget::cancel); cancelButton->clicked().connect(cancelButton, &WFormWidget::disable); cancelButton->clicked().connect(secret, &WWidget::hide); return appl; }