本文整理汇总了C++中DomElement::asJavaScript方法的典型用法代码示例。如果您正苦于以下问题:C++ DomElement::asJavaScript方法的具体用法?C++ DomElement::asJavaScript怎么用?C++ DomElement::asJavaScript使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DomElement
的用法示例。
在下文中一共展示了DomElement::asJavaScript方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rootAsJavaScript
void WContainerWidget::rootAsJavaScript(WApplication *app, std::ostream& out,
bool all)
{
std::vector<WWidget *> *toAdd
= all ? children_ : (transientImpl_ ? &transientImpl_->addedChildren_ : 0);
if (toAdd)
for (unsigned i = 0; i < toAdd->size(); ++i) {
DomElement *c = (*toAdd)[i]->createSDomElement(app);
app->streamBeforeLoadJavaScript(out, false);
c->callMethod("omousemove=function(e) {"
"if (!e) e = window.event;"
"return " + app->javaScriptClass()
+ "._p_.dragDrag(event); }");
c->callMethod("mouseup=function(e) {"
"if (!e) e = window.event;"
"return " + app->javaScriptClass()
+ "._p_.dragEnd(event);}");
c->callMethod("dragstart=function(){return false;}");
c->asJavaScript(out);
delete c;
}
if (transientImpl_)
transientImpl_->addedChildren_.clear();
if (!all) {
/* Note: we ignore rendering of deletion of a bound widget... */
}
// FIXME
propagateRenderOk(false);
}
示例2: javaScriptUpdate
void WCssStyleSheet::javaScriptUpdate(WApplication *app,
std::ostream& js, bool all)
{
if (!all) {
for (unsigned i = 0; i < rulesRemoved_.size(); ++i) {
js << WT_CLASS ".removeCssRule(";
DomElement::jsStringLiteral(js, rulesRemoved_[i], '\'');
js << ");";
}
rulesRemoved_.clear();
for (RuleSet::const_iterator i = rulesModified_.begin();
i != rulesModified_.end(); ++i) {
js << "{ var d= " WT_CLASS ".getCssRule(";
DomElement::jsStringLiteral(js, (*i)->selector(), '\'');
js << ");if(d){";
DomElement *d = DomElement::updateGiven("d", DomElement_SPAN);
if ((*i)->updateDomElement(*d, false)) {
EscapeOStream sout(js);
d->asJavaScript(sout, DomElement::Update);
}
delete d;
js << "}}";
}
rulesModified_.clear();
}
if (!app->environment().agentIsIElt(9)
&& app->environment().agent() != WEnvironment::Konqueror) {
RuleList& toProcess = all ? rules_ : rulesAdded_;
for (unsigned i = 0; i < toProcess.size(); ++i) {
WCssRule *rule = toProcess[i];
js << WT_CLASS ".addCss('"
<< rule->selector() << "',";
DomElement::jsStringLiteral(js, rule->declarations(), '\'');
js << ");" << std::endl;
}
rulesAdded_.clear();
if (all)
rulesModified_.clear();
} else {
std::string text = cssText(all);
if (!text.empty()) {
js << WT_CLASS ".addCssText(";
DomElement::jsStringLiteral(js, text, '\'');
js << ");" << std::endl;
}
}
}
示例3: createExtElement
std::string Widget::createExtElement(std::stringstream& alljs,
DomElement *inContainer)
{
if (inContainer) {
updateDom(*inContainer, true);
inContainer->removeProperty(PropertyStyleDisplay);
}
setRendered(false);
alljs << "var " << elVar() << ";"
<< createJS(inContainer)
<< elRef() << "=" << elVar() << ";";
if (isHidden())
alljs << elVar() << ".hide();";
jsUpdates_.clear();
if (!inContainer) {
DomElement *e
= DomElement::updateGiven(elVar() + ".getEl().dom", domElementType());
updateDom(*e, true);
{
EscapeOStream out(alljs);
e->asJavaScript(out, DomElement::Update);
}
delete e;
}
setRendered(true);
return elVar();
}