本文整理汇总了C++中WApplication::bodyClass方法的典型用法代码示例。如果您正苦于以下问题:C++ WApplication::bodyClass方法的具体用法?C++ WApplication::bodyClass怎么用?C++ WApplication::bodyClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WApplication
的用法示例。
在下文中一共展示了WApplication::bodyClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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");
}
}
}
示例2: initExt
void Widget::initExt()
{
std::string extBaseURL = "ext";
WApplication::readConfigurationProperty("extBaseURL", extBaseURL);
if (!extBaseURL.empty() && extBaseURL[extBaseURL.length()-1] != '/')
extBaseURL += '/';
WApplication *app = WApplication::instance();
if (app->require(extBaseURL + "ext-base.js", "window['Ext']")) {
app->require(extBaseURL + "ext-all.js", "window.Ext['DomHelper']");
app->useStyleSheet(extBaseURL + "resources/css/ext-all.css");
// fixes for Firefox 3:
app->styleSheet().addRule(".x-date-middle", "width:130px;");
// rendering glitches on all browsers:
app->styleSheet().addRule(".ext-gecko .x-form-text", "margin-top: -1px;");
app->styleSheet().addRule(".ext-safari .x-form-text", "margin-top: -1px;");
app->styleSheet().addRule(".ext-ie .x-form-text",
"margin-top: 0px !important;"
"margin-bottom: 0px !important;");
app->doJavaScript(/*app->javaScriptClass() + '.' + */ "ExtW = new Array();"
"Ext.QuickTips.init();"
"Ext.BLANK_IMAGE_URL='" + extBaseURL
+ "resources/images/default/s.gif';", false);
app->declareJavaScriptFunction("deleteExtW",
"" "function(id){"
"" "var w=ExtW[id];"
"" "if(w){"
"" "if (w.el && w.destroy) w.destroy();"
"" "delete ExtW[id];"
"" "}"
"" "}");
if (app->environment().agentIsIE())
app->doJavaScript
("if ((typeof Range !== 'undefined')"
"" "&& !Range.prototype.createContextualFragment) {"
"""Range.prototype.createContextualFragment = function(html) {"
"" "var startNode = this.startContainer;"
"" "var doc = startNode.nodeType == 9 ? startNode :"
"" "startNode.ownerDocument;"
"" "var container = doc.createElement('div');"
"" "container.innerHTML = html;"
"" "var frag = doc.createDocumentFragment(), n;"
"" "while ( (n = container.firstChild) ) {"
"" "frag.appendChild(n);"
"" "}"
"" "return frag;"
"""};"
"}", false);
/*
* Normally, Ext does this in its onReady function, but this is not
* fired when loading ExtJS on demand.
*/
std::string bodyClass;
if (app->environment().agentIsIE()) {
bodyClass = " ext-ie ";
bodyClass += app->environment().agent() == WEnvironment::IE6
? "ext-ie6" : "ext-ie7 ";
} else if (app->environment().agentIsSafari())
bodyClass = " ext-safari";
else if (app->environment().agentIsOpera())
bodyClass = " ext-opera";
else if (app->environment().agentIsGecko())
bodyClass = " ext-gecko";
const std::string& ua = app->environment().userAgent();
if (ua.find("Linux") != std::string::npos)
bodyClass += " ext-linux";
if (ua.find("Macintosh") != std::string::npos
|| ua.find("Mac OS X") != std::string::npos)
bodyClass += " ext-mac";
app->setBodyClass(app->bodyClass() + bodyClass);
app->setHtmlClass(app->htmlClass() + " ext-strict");
}
}