CookiesLawDisclaimer::CookiesLawDisclaimer(WContainerWidget* parent, const std::function<void()> &runOnAccepted)
    : WCompositeWidget(parent)
{
  WContainerWidget *content = new WContainerWidget;
  content->addStyleClass("alert alert-danger");
  content->addWidget(new WText("cookies_law_disclaimer"_wtr));
  auto readMoreButton = new WPushButton("cookies_law_readmore"_wtr, content);
  readMoreButton->setStyleClass("btn-link");
  readMoreButton->clicked().connect([=](const WMouseEvent &){
    WMessageBox *messageBox = new WMessageBox("cookies_law_readmore_caption"_wtr, "cookies_law_readmore_text"_wtr, Information, Ok, this);
    messageBox->contents()->setOverflow(WContainerWidget::OverflowAuto);
    messageBox->setHeight(500);
    messageBox->buttonClicked().connect([=](StandardButton, _n5){
      delete messageBox;
    });
    messageBox->show();
  });
  auto agreeButton = new WPushButton("cookies_law_agree"_wtr, content);
  agreeButton->setStyleClass("btn-link");
  agreeButton->clicked().connect([=](const WMouseEvent&){
    wApp->setCookie(COOKIES_LAW_COOKIE_NAME, COOKIES_LAW_COOKIE_VALUE, 60 * 60 * 24 * 365);
    runOnAccepted();
    delete this;
  });
  content->addStyleClass("cookies_law_agreement");
  setImplementation(content);
}
示例#2
0
文件: AuthWidget.C 项目: 913862627/wt
void AuthWidget::displayInfo(const WString& m)
{
  delete messageBox_;

  WMessageBox *box = new WMessageBox(tr("Wt.Auth.notice"), m, NoIcon, Ok);
  box->buttonClicked().connect(this, &AuthWidget::closeDialog);
  box->show();

  messageBox_ = box;
}
示例#3
0
void MapWidget::EnemyTownMessageBox()
{
	WMessageBox *messageBox = new WMessageBox
	("This is the enemy's town.",
	 "Here you will be able to check on how they are doing and declare attacks.",
	 Wt::Information, Wt::Cancel);

	messageBox->setModal(true);

	messageBox->show();

    messageBox->buttonClicked().connect(std::bind([=] () {

	delete messageBox;    }));
}
示例#4
0
  /** \brief Process the result of the popup menu
   */
  void popupAction() {
    if (popup_->result()) {
      /*
       * You could also bind extra data to an item using setData() and
       * check here for the action asked. For now, we just use the text.
       */
      WString text = popup_->result()->text();
      popup_->hide();

      popupActionBox_ = new WMessageBox("Sorry.","Action '" + text
					+ "' is not implemented.", NoIcon, Ok);
      popupActionBox_->buttonClicked()
	.connect(this, &TreeViewDragDrop::dialogDone);
      popupActionBox_->show();
    } else {
      popup_->hide();
    }
  }