本文整理汇总了C++中WContainerWidget::addStyleClass方法的典型用法代码示例。如果您正苦于以下问题:C++ WContainerWidget::addStyleClass方法的具体用法?C++ WContainerWidget::addStyleClass怎么用?C++ WContainerWidget::addStyleClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WContainerWidget
的用法示例。
在下文中一共展示了WContainerWidget::addStyleClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WCompositeWidget
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: update
void RegistrationWidget::update()
{
if (model_->passwordAuth())
bindString("password-description",
tr("Wt.Auth.password-registration"));
else
bindEmpty("password-description");
updateView(model_);
if (!created_) {
WLineEdit *password = resolve<WLineEdit *>
(RegistrationModel::ChoosePasswordField);
WLineEdit *password2 = resolve<WLineEdit *>
(RegistrationModel::RepeatPasswordField);
WText *password2Info = resolve<WText *>
(RegistrationModel::RepeatPasswordField + std::string("-info"));
if (password && password2 && password2Info)
model_->validatePasswordsMatchJS(password, password2, password2Info);
}
WAnchor *isYou = resolve<WAnchor *>("confirm-is-you");
if (!isYou) {
isYou = new WAnchor(std::string("#"), tr("Wt.Auth.confirm-is-you"));
isYou->hide();
bindWidget("confirm-is-you", isYou);
}
if (model_->isConfirmUserButtonVisible()) {
if (!isYou->clicked().isConnected())
isYou->clicked().connect(this, &RegistrationWidget::confirmIsYou);
isYou->show();
} else
isYou->hide();
if (model_->isFederatedLoginVisible()) {
if (!conditionValue("if:oauth")) {
setCondition("if:oauth", true);
if (model_->passwordAuth())
bindString("oauth-description", tr("Wt.Auth.or-oauth-registration"));
else
bindString("oauth-description", tr("Wt.Auth.oauth-registration"));
WContainerWidget *icons = new WContainerWidget();
icons->addStyleClass("Wt-field");
for (unsigned i = 0; i < model_->oAuth().size(); ++i) {
const OAuthService *service = model_->oAuth()[i];
WImage *w = new WImage("css/oauth-" + service->name() + ".png", icons);
w->setToolTip(service->description());
w->setStyleClass("Wt-auth-icon");
w->setVerticalAlignment(AlignMiddle);
OAuthProcess *const process
= service->createProcess(service->authenticationScope());
w->clicked().connect(process, &OAuthProcess::startAuthenticate);
process->authenticated().connect
(boost::bind(&RegistrationWidget::oAuthDone, this, process, _1));
WObject::addChild(process);
}
bindWidget("icons", icons);
}
} else {
setCondition("if:oauth", false);
bindEmpty("icons");
}
if (!created_) {
WPushButton *okButton = new WPushButton(tr("Wt.Auth.register"));
WPushButton *cancelButton = new WPushButton(tr("Wt.WMessageBox.Cancel"));
bindWidget("ok-button", okButton);
bindWidget("cancel-button", cancelButton);
okButton->clicked().connect(this, &RegistrationWidget::doRegister);
cancelButton->clicked().connect(this, &RegistrationWidget::close);
created_ = true;
}
}