本文整理汇总了C++中DomElement::getProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ DomElement::getProperty方法的具体用法?C++ DomElement::getProperty怎么用?C++ DomElement::getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DomElement
的用法示例。
在下文中一共展示了DomElement::getProperty方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createComponent
void WWidgetItemImpl::createComponent(DomElement *parentContainer)
{
DomElement *e = item_->widget()->createSDomElement(WApplication::instance());
e->setProperty(PropertyStyle, e->getProperty(PropertyStyle)
+ "position:absolute;left:-10000px;top:-10000px;"
"visibility:hidden;");
Container *c = dynamic_cast<Container *>(item_->widget());
if (!c) {
std::stringstream js;
js << "var " << var_ << "=new Ext.BoxComponent({id:'"
<< id_ << "',applyTo:'" << item_->widget()->id() << "'";
addConfig(js);
Container::setSizeConfig(js, item_->widget());
js << "});{var s="
<< item_->widget()->jsRef() << ";s.style.position='';"
"s.style.left='';"
"s.style.top='';"
"s.style.visibility='';}";
e->callJavaScript(js.str());
}
parentContainer->addChild(e);
}
示例2: updateDom
void WAbstractToggleButton::updateDom(DomElement& element, bool all)
{
WApplication *app = WApplication::instance();
const WEnvironment& env = app->environment();
DomElement *input = 0;
DomElement *span = 0;
DomElement *label = 0;
// Already apply theme here because it may determine its organization
if (all)
app->theme()->apply(this, element, 1);
if (element.type() == DomElement_INPUT)
input = &element;
else {
if (all) {
input = DomElement::createNew(DomElement_INPUT);
input->setName("in" + id());
span = DomElement::createNew(DomElement_SPAN);
span->setName("t" + id());
if (element.type() != DomElement_LABEL) {
label = DomElement::createNew(DomElement_LABEL);
label->setName("l" + id());
}
} else {
input = DomElement::getForUpdate("in" + id(), DomElement_INPUT);
span = DomElement::getForUpdate("t" + id(), DomElement_SPAN);
}
}
if (all)
updateInput(*input, all);
EventSignal<> *check = voidEventSignal(CHECKED_SIGNAL, false);
EventSignal<> *uncheck = voidEventSignal(UNCHECKED_SIGNAL, false);
EventSignal<> *change = voidEventSignal(CHANGE_SIGNAL, false);
EventSignal<WMouseEvent> *click = mouseEventSignal(M_CLICK_SIGNAL, false);
/*
* We piggy-back the checked and uncheck signals on the change signal.
*
* If agent is IE, then we piggy-back the change on the clicked signal.
*/
bool piggyBackChangeOnClick = env.agentIsIE();
bool needUpdateChangeSignal =
(change && change->needsUpdate(all))
|| (check && check->needsUpdate(all))
|| (uncheck && uncheck->needsUpdate(all));
bool needUpdateClickedSignal =
(click && click->needsUpdate(all))
|| (piggyBackChangeOnClick && needUpdateChangeSignal);
WFormWidget::updateDom(*input, all);
/*
* Copy all properties to the exterior element, as they relate to style,
* etc... We ignore here attributes (except for tooltip),
* see WWebWidget: other attributes need not be moved.
*
* But -- bug #423, disabled and readonly are properties that should be
* kept on the interior element.
*/
if (&element != input) {
if (element.properties().find(PropertyClass) != element.properties().end())
input->addPropertyWord(PropertyClass, element.getProperty(PropertyClass));
element.setProperties(input->properties());
input->clearProperties();
std::string v = element.getProperty(Wt::PropertyDisabled);
if (!v.empty()) {
input->setProperty(Wt::PropertyDisabled, v);
element.removeProperty(Wt::PropertyDisabled);
}
v = element.getProperty(Wt::PropertyReadOnly);
if (!v.empty()) {
input->setProperty(Wt::PropertyReadOnly, v);
element.removeProperty(Wt::PropertyReadOnly);
}
v = input->getAttribute("title");
if (!v.empty())
element.setAttribute("title", v);
}
if (flags_.test(BIT_STATE_CHANGED) || all) {
input->setProperty(Wt::PropertyChecked,
state_ == Unchecked ? "false" : "true");
if (supportsIndeterminate(env))
input->setProperty(Wt::PropertyIndeterminate,
state_ == PartiallyChecked ? "true" : "false");
else
input->setProperty(Wt::PropertyStyleOpacity,
state_ == PartiallyChecked ? "0.5" : "");
//.........这里部分代码省略.........
示例3: updateDom
void WAbstractToggleButton::updateDom(DomElement& element, bool all)
{
WApplication *app = WApplication::instance();
const WEnvironment& env = app->environment();
DomElement *input = 0;
DomElement *span = 0;
if (element.type() == DomElement_LABEL) {
if (all) {
input = DomElement::createNew(DomElement_INPUT);
input->setName("in" + id());
span = DomElement::createNew(DomElement_SPAN);
span->setName("l" + id());
} else {
input = DomElement::getForUpdate("in" + id(), DomElement_INPUT);
span = DomElement::getForUpdate("l" + id(), DomElement_SPAN);
}
} else
input = &element;
if (all)
updateInput(*input, all);
EventSignal<> *check = voidEventSignal(CHECKED_SIGNAL, false);
EventSignal<> *uncheck = voidEventSignal(UNCHECKED_SIGNAL, false);
EventSignal<> *change = voidEventSignal(CHANGE_SIGNAL, false);
EventSignal<WMouseEvent> *click = mouseEventSignal(M_CLICK_SIGNAL, false);
/*
* We piggy-back the checked and uncheck signals on the change signal.
*
* If agent is IE, then we piggy-back the change on the clicked signal.
*/
bool piggyBackChangeOnClick = env.agentIsIE();
bool needUpdateChangeSignal =
(change && change->needsUpdate(all))
|| (check && check->needsUpdate(all))
|| (uncheck && uncheck->needsUpdate(all));
bool needUpdateClickedSignal =
(click && click->needsUpdate(all))
|| (piggyBackChangeOnClick && needUpdateChangeSignal);
WFormWidget::updateDom(*input, all);
/*
* Copy all properties to the exterior element, as they relate to style,
* etc... We ignore here attributes, see WWebWidget: there seems not to
* be attributes that sensibly need to be moved.
*
* But -- bug #423, disabled and readonly are properties that should be
* kept on the interior element.
*/
if (&element != input) {
element.setProperties(input->properties());
input->clearProperties();
std::string v = element.getProperty(Wt::PropertyDisabled);
if (!v.empty()) {
input->setProperty(Wt::PropertyDisabled, v);
element.removeProperty(Wt::PropertyDisabled);
}
v = element.getProperty(Wt::PropertyReadOnly);
if (!v.empty()) {
input->setProperty(Wt::PropertyReadOnly, v);
element.removeProperty(Wt::PropertyReadOnly);
}
}
if (stateChanged_ || all) {
input->setProperty(Wt::PropertyChecked,
state_ == Unchecked ? "false" : "true");
if (supportsIndeterminate(env))
input->setProperty(Wt::PropertyIndeterminate,
state_ == PartiallyChecked ? "true" : "false");
else
input->setProperty(Wt::PropertyStyleOpacity,
state_ == PartiallyChecked ? "0.5" : "");
stateChanged_ = false;
}
std::vector<DomElement::EventAction> changeActions;
if (needUpdateChangeSignal
|| (piggyBackChangeOnClick && needUpdateClickedSignal)
|| all) {
std::string dom = "o";
if (check) {
if (check->isConnected())
changeActions.push_back
(DomElement::EventAction(dom + ".checked",
check->javaScript(),
check->encodeCmd(),
//.........这里部分代码省略.........
示例4: layout
//.........这里部分代码省略.........
}
DomElement *c = 0;
if (!table) {
if (item.item_) {
c = createElement(item.item_, app);
div->addChild(c);
}
} else
if (item.item_)
c = getImpl(item.item_)->createDomElement(true, true, app);
if (table) {
if (c) {
if (!app->environment().agentIsIElt(9))
c->setProperty(PropertyStyleBoxSizing, "border-box");
if (hAlign == 0)
hAlign = AlignJustify;
switch (hAlign) {
case AlignCenter: {
DomElement *itable = DomElement::createNew(DomElement_TABLE);
itable->setProperty(PropertyClass, "Wt-hcenter");
if (vAlign == 0)
itable->setProperty(PropertyStyle, "height:100%;");
DomElement *irow = DomElement::createNew(DomElement_TR);
DomElement *itd = DomElement::createNew(DomElement_TD);
if (vAlign == 0)
itd->setProperty(PropertyStyle, "height:100%;");
bool haveMinWidth
= !c->getProperty(PropertyStyleMinWidth).empty();
itd->addChild(c);
if (app->environment().agentIsIElt(9)) {
// IE7 and IE8 do support min-width but do not enforce it
// properly when in a table.
// see http://stackoverflow.com/questions/2356525
// /css-min-width-in-ie6-7-and-8
if (haveMinWidth) {
DomElement *spacer = DomElement::createNew(DomElement_DIV);
spacer->setProperty(PropertyStyleWidth,
c->getProperty(PropertyStyleMinWidth));
spacer->setProperty(PropertyStyleHeight, "1px");
itd->addChild(spacer);
}
}
irow->addChild(itd);
itable->addChild(irow);
c = itable;
break;
}
case AlignRight:
if (!c->isDefaultInline())
c->setProperty(PropertyStyleFloat, "right");
else
td->setProperty(PropertyStyleTextAlign, "right");
break;
case AlignLeft:
if (!c->isDefaultInline())
c->setProperty(PropertyStyleFloat, "left");
else
示例5: apply
void WBootstrapTheme::apply(WWidget *widget, DomElement& element,
int elementRole) const
{
bool creating = element.mode() == DomElement::Mode::Create;
if (!widget->isThemeStyleEnabled())
return;
{
WPopupWidget *popup = dynamic_cast<WPopupWidget *>(widget);
if (popup) {
WDialog *dialog = dynamic_cast<WDialog *>(widget);
if (!dialog)
element.addPropertyWord(Property::Class, "dropdown-menu");
}
}
switch (element.type()) {
case DomElementType::A: {
if (creating && dynamic_cast<WPushButton *>(widget))
element.addPropertyWord(Property::Class, classBtn(widget));
WPushButton *btn = dynamic_cast<WPushButton *>(widget);
if (creating && btn && btn->isDefault())
element.addPropertyWord(Property::Class, "btn-primary");
if (element.getProperty(Property::Class).find("dropdown-toggle")
!= std::string::npos) {
WMenuItem *item = dynamic_cast<WMenuItem *>(widget->parent());
if (!dynamic_cast<WPopupMenu *>(item->parentMenu())) {
DomElement *b = DomElement::createNew(DomElementType::B);
b->setProperty(Property::Class, "caret");
element.addChild(b);
}
}
break;
}
case DomElementType::BUTTON: {
if (creating && !widget->hasStyleClass("list-group-item"))
element.addPropertyWord(Property::Class, classBtn(widget));
WPushButton *button = dynamic_cast<WPushButton *>(widget);
if (button) {
if (creating && button->isDefault())
element.addPropertyWord(Property::Class, "btn-primary");
if (button->menu() &&
element.properties().find(Property::InnerHTML) !=
element.properties().end()) {
element.addPropertyWord(Property::InnerHTML,
"<span class=\"caret\"></span>");
}
if (creating && !button->text().empty())
element.addPropertyWord(Property::Class, "with-label");
if (!button->link().isNull())
LOG_ERROR("Cannot use WPushButton::setLink() after the button has "
"been rendered with WBootstrapTheme");
}
break;
}
case DomElementType::DIV:
{
WDialog *dialog = dynamic_cast<WDialog *>(widget);
if (dialog) {
if (version_ == BootstrapVersion::v2)
element.addPropertyWord(Property::Class, "modal");
else
element.addPropertyWord(Property::Class, "modal-dialog Wt-dialog");
return;
}
WPanel *panel = dynamic_cast<WPanel *>(widget);
if (panel) {
element.addPropertyWord(Property::Class, classAccordionGroup());
return;
}
WProgressBar *bar = dynamic_cast<WProgressBar *>(widget);
if (bar) {
switch (elementRole) {
case MainElement:
element.addPropertyWord(Property::Class, "progress");
break;
case ProgressBarBar:
element.addPropertyWord(Property::Class, classBar());
break;
case ProgressBarLabel:
element.addPropertyWord(Property::Class, "bar-label");
}
return;
}
WGoogleMap *map = dynamic_cast<WGoogleMap *>(widget);
//.........这里部分代码省略.........
示例6: updateDomElement
void WCssDecorationStyle::updateDomElement(DomElement& element, bool all)
{
/*
* set cursor
*/
if (cursorChanged_ || all) {
switch (cursor_) {
case AutoCursor:
if (cursorChanged_)
element.setProperty(PropertyStyleCursor, "auto");
break;
case ArrowCursor:
element.setProperty(PropertyStyleCursor, "default"); break;
case CrossCursor:
element.setProperty(PropertyStyleCursor, "crosshair"); break;
case PointingHandCursor:
element.setProperty(PropertyStyleCursor, "pointer"); break;
case OpenHandCursor:
element.setProperty(PropertyStyleCursor, "move"); break;
case WaitCursor:
element.setProperty(PropertyStyleCursor, "wait"); break;
case IBeamCursor:
element.setProperty(PropertyStyleCursor, "text"); break;
case WhatsThisCursor:
element.setProperty(PropertyStyleCursor, "help"); break;
}
if (!cursorImage_.empty()) {
element.setProperty(PropertyStyleCursor,
"url(" + cursorImage_ + "),"
+ element.getProperty(PropertyStyleCursor));
}
cursorChanged_ = false;
}
/*
* set font
*/
font_.updateDomElement(element, fontChanged_, all);
fontChanged_ = false;
/*
* set border
*/
Property properties[4]
= { PropertyStyleBorderTop,
PropertyStyleBorderRight,
PropertyStyleBorderBottom,
PropertyStyleBorderLeft };
if (borderChanged_ || all) {
for (unsigned i = 0; i < 4; ++i) {
if (border_[i])
element.setProperty(properties[i], border_[i]->cssText());
else if (borderChanged_)
element.setProperty(properties[i], "");
}
borderChanged_ = false;
}
/*
* set colors
*/
if (foregroundColorChanged_ || all) {
if ((all && !foregroundColor_.isDefault())
|| foregroundColorChanged_)
element.setProperty(PropertyStyleColor, foregroundColor_.cssText());
foregroundColorChanged_ = false;
}
if (backgroundColorChanged_ || all) {
if ((all && !backgroundColor_.isDefault()) ||
backgroundColorChanged_)
element.setProperty(PropertyStyleBackgroundColor,
backgroundColor_.cssText());
backgroundColorChanged_ = false;
}
if (backgroundImageChanged_ || all) {
if (!backgroundImage_.isNull() || backgroundImageChanged_) {
if (backgroundImage_.isNull())
element.setProperty(PropertyStyleBackgroundImage, "none");
else {
Wt::WApplication *app = Wt::WApplication::instance();
std::string url = app->encodeUntrustedUrl
(app->resolveRelativeUrl(backgroundImage_.url()));
element.setProperty(PropertyStyleBackgroundImage,
"url(" + WWebWidget::jsStringLiteral(url, '"')
+ ")");
}
if (backgroundImageRepeat_ != RepeatXY ||
backgroundImageLocation_ != 0) {
switch (backgroundImageRepeat_) {
case RepeatXY:
element.setProperty(PropertyStyleBackgroundRepeat, "repeat");
//.........这里部分代码省略.........
示例7: apply
void WBootstrapTheme::apply(WWidget *widget, DomElement& element,
int elementRole) const
{
bool creating = element.mode() == DomElement::ModeCreate;
{
WPopupWidget *popup = dynamic_cast<WPopupWidget *>(widget);
if (popup) {
WDialog *dialog = dynamic_cast<WDialog *>(widget);
if (!dialog)
element.addPropertyWord(PropertyClass, "dropdown-menu");
}
}
switch (element.type()) {
case DomElement_A:
if (creating && dynamic_cast<WPushButton *>(widget))
element.addPropertyWord(PropertyClass, "btn");
if (element.getProperty(PropertyClass).find("dropdown-toggle")
!= std::string::npos) {
WMenuItem *item = dynamic_cast<WMenuItem *>(widget->parent());
if (!dynamic_cast<WPopupMenu *>(item->parentMenu())) {
DomElement *b = DomElement::createNew(DomElement_B);
b->setProperty(PropertyClass, "caret");
element.addChild(b);
}
}
break;
case DomElement_BUTTON: {
if (creating)
element.addPropertyWord(PropertyClass, "btn");
WPushButton *button = dynamic_cast<WPushButton *>(widget);
if (button) {
if (creating && button->isDefault())
element.addPropertyWord(PropertyClass, "btn-primary");
if (button->menu() &&
element.properties().find(PropertyInnerHTML) !=
element.properties().end()) {
element.addPropertyWord(PropertyInnerHTML,
"<span class=\"caret\"></span>");
}
}
break;
}
case DomElement_DIV:
{
WDialog *dialog = dynamic_cast<WDialog *>(widget);
if (dialog) {
element.addPropertyWord(PropertyClass, "modal");
return;
}
WPanel *panel = dynamic_cast<WPanel *>(widget);
if (panel) {
element.addPropertyWord(PropertyClass, "accordion-group");
return;
}
WProgressBar *bar = dynamic_cast<WProgressBar *>(widget);
if (bar) {
switch (elementRole) {
case MainElementThemeRole:
element.addPropertyWord(PropertyClass, "progress");
break;
case ProgressBarBarRole:
element.addPropertyWord(PropertyClass, "bar");
break;
case ProgressBarLabelRole:
element.addPropertyWord(PropertyClass, "bar-label");
}
return;
}
WGoogleMap *map = dynamic_cast<WGoogleMap *>(widget);
if (map) {
element.addPropertyWord(PropertyClass, "Wt-googlemap");
return;
}
WAbstractItemView *itemView = dynamic_cast<WAbstractItemView *>(widget);
if (itemView) {
element.addPropertyWord(PropertyClass, "form-horizontal");
return;
}
}
break;
case DomElement_LABEL:
{
WCheckBox *cb = dynamic_cast<WCheckBox *>(widget);
if (cb) {
element.addPropertyWord(PropertyClass, "checkbox");
//.........这里部分代码省略.........