本文整理汇总了C++中WVBoxLayout::setSpacing方法的典型用法代码示例。如果您正苦于以下问题:C++ WVBoxLayout::setSpacing方法的具体用法?C++ WVBoxLayout::setSpacing怎么用?C++ WVBoxLayout::setSpacing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WVBoxLayout
的用法示例。
在下文中一共展示了WVBoxLayout::setSpacing方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}