本文整理汇总了C++中WApplication::dialogCover方法的典型用法代码示例。如果您正苦于以下问题:C++ WApplication::dialogCover方法的具体用法?C++ WApplication::dialogCover怎么用?C++ WApplication::dialogCover使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WApplication
的用法示例。
在下文中一共展示了WApplication::dialogCover方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setHidden
void WDialog::setHidden(bool hidden, const WAnimation& animation)
{
if (isHidden() != hidden) {
if (modal_) {
WApplication *app = WApplication::instance();
WContainerWidget *cover = app->dialogCover();
if (!cover)
return; // when application is being destroyed
if (!hidden) {
saveCoverState(app, cover);
if (cover->isHidden()) {
if (!animation.empty()) {
cover->animateShow(WAnimation(WAnimation::Fade, WAnimation::Linear,
animation.duration() * 4));
} else
cover->show();
}
cover->setZIndex(impl_->zIndex() - 1);
app->pushExposedConstraint(this);
// FIXME: this should only blur if the active element is outside
// of the dialog
doJavaScript
("try {"
"""var ae=document.activeElement;"
// On IE when a dialog is shown on startup, activeElement is the
// body. Bluring the body sends the window to the background if
// it is the only tab.
// http://redmine.emweb.be/boards/2/topics/6415
"""if (ae && ae.blur && ae.nodeName != 'BODY') {"
"" "document.activeElement.blur();"
"}"
"} catch (e) { }");
} else
restoreCoverState(app, cover);
}
}
WPopupWidget::setHidden(hidden, animation);
}
示例2: setHidden
void WDialog::setHidden(bool hidden, const WAnimation& animation)
{
if (isHidden() != hidden) {
if (modal_) {
WApplication *app = WApplication::instance();
WContainerWidget *cover = app->dialogCover();
if (!cover)
return; // when application is being destroyed
if (!hidden) {
saveCoverState(app, cover);
if (cover->isHidden()) {
if (!animation.empty()) {
cover->animateShow(WAnimation(WAnimation::Fade, WAnimation::Linear,
animation.duration() * 4));
} else
cover->show();
}
cover->setZIndex(impl_->zIndex() - 1);
app->pushExposedConstraint(this);
// FIXME: this should only blur if the active element is outside
// of the dialog
doJavaScript
("try {"
"""if (document.activeElement && document.activeElement.blur)"
"" "document.activeElement.blur();"
"} catch (e) { }");
} else
restoreCoverState(app, cover);
}
}
WCompositeWidget::setHidden(hidden, animation);
}
示例3: create
void WDialog::create()
{
closeIcon_ = 0;
footer_ = 0;
modal_ = true;
resizable_ = false;
recursiveEventLoop_ = false;
impl_ = dynamic_cast<WTemplate *>(implementation());
const char *CSS_RULES_NAME = "Wt::WDialog";
WApplication *app = WApplication::instance();
if (!app->styleSheet().isDefined(CSS_RULES_NAME)) {
/* Needed for the dialog cover */
if (app->environment().agentIsIElt(9))
app->styleSheet().addRule("body", "height: 100%;");
std::string position
= app->environment().agent() == WEnvironment::IE6 ? "absolute" : "fixed";
// we use left: 50%, top: 50%, margin hack when JavaScript is not available
// see below for an IE workaround
app->styleSheet().addRule("div.Wt-dialog", std::string() +
(app->environment().ajax() ?
"visibility: hidden;" : "")
//"position: " + position + ';'
+ (!app->environment().ajax() ?
"left: 50%; top: 50%;"
"margin-left: -100px; margin-top: -50px;" :
"left: 0px; top: 0px;"),
CSS_RULES_NAME);
if (app->environment().agent() == WEnvironment::IE6) {
app->styleSheet().addRule
("div.Wt-dialogcover",
"position: absolute;"
"left: expression("
"(ignoreMe2 = document.documentElement.scrollLeft) + 'px' );"
"top: expression("
"(ignoreMe = document.documentElement.scrollTop) + 'px' );");
// simulate position: fixed left: 50%; top 50%
if (!app->environment().ajax())
app->styleSheet().addRule
("div.Wt-dialog",
"position: absolute;"
"left: expression("
"(ignoreMe2 = document.documentElement.scrollLeft + "
"document.documentElement.clientWidth/2) + 'px' );"
"top: expression("
"(ignoreMe = document.documentElement.scrollTop + "
"document.documentElement.clientHeight/2) + 'px' );");
}
}
LOAD_JAVASCRIPT(app, "js/WDialog.js", "WDialog", wtjs1);
WContainerWidget *layoutContainer = new WContainerWidget();
layoutContainer->setStyleClass("dialog-layout");
WVBoxLayout *layout = new WVBoxLayout(layoutContainer);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
impl_->bindWidget("layout", layoutContainer);
titleBar_ = new WContainerWidget();
app->theme()->apply(this, titleBar_, DialogTitleBarRole);
caption_ = new WText(titleBar_);
caption_->setInline(false);
contents_ = new WContainerWidget();
app->theme()->apply(this, contents_, DialogBodyRole);
layout->addWidget(titleBar_);
layout->addWidget(contents_, 1);
saveCoverState(app, app->dialogCover());
/*
* Cannot be done using the CSS stylesheet in case there are
* contained elements with setHideWithOffsets() set
*
* For IE, we cannot set it yet since it will confuse width measurements
* to become minimum size instead of (unconstrained) preferred size
*/
if (app->environment().ajax()) {
setAttributeValue("style", "visibility: hidden");
/*
* This is needed for animations only, but setting absolute or
* fixed positioning confuses layout measurement in IE browsers
*/
if (!app->environment().agentIsIElt(9))
setPositionScheme(Fixed);
} else
setPositionScheme(app->environment().agent() == WEnvironment::IE6
? Absolute : Fixed);
}