本文整理汇总了C++中DomElement::id方法的典型用法代码示例。如果您正苦于以下问题:C++ DomElement::id方法的具体用法?C++ DomElement::id怎么用?C++ DomElement::id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DomElement
的用法示例。
在下文中一共展示了DomElement::id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: item
DomElement *FlexLayoutImpl::createElement(Orientation orientation,
unsigned index,
int totalStretch,
WApplication *app)
{
Impl::Grid::Item& it = item(orientation, index);
Impl::Grid::Section& s = section(orientation, index);
DomElement *el
= getImpl(it.item_.get())->createDomElement(nullptr, true, true, app);
if (dynamic_cast<StdGridLayoutImpl2*>(getImpl(it.item_.get()))) {
DomElement *wrapEl = DomElement::createNew(DomElementType::DIV);
wrapEl->addChild(el);
el = wrapEl;
}
int m[] = { 0, 0, 0, 0 };
if (FlexLayoutImpl *flexImpl = dynamic_cast<FlexLayoutImpl*>(getImpl(it.item_.get()))) {
Orientation elOrientation = flexImpl->getOrientation();
if (elOrientation == Orientation::Horizontal) {
m[3] -= (flexImpl->grid_.horizontalSpacing_) / 2;
m[1] -= (flexImpl->grid_.horizontalSpacing_ + 1) / 2;
} else {
m[0] -= (flexImpl->grid_.verticalSpacing_) / 2;
m[2] -= (flexImpl->grid_.horizontalSpacing_ + 1) / 2;
}
}
AlignmentFlag hAlign = it.alignment_ & AlignHorizontalMask;
AlignmentFlag vAlign = it.alignment_ & AlignVerticalMask;
/*
* If not justifying along main axis, then we need to wrap inside
* an additional (flex) element
*/
if (orientation == Orientation::Horizontal) {
if (hAlign != static_cast<AlignmentFlag>(0)) {
el->setProperty(Property::StyleFlex, "0 0 auto");
DomElement *wrap = DomElement::createNew(DomElementType::DIV);
wrap->setId("w" + el->id());
wrap->setProperty(Property::StyleDisplay, styleDisplay());
wrap->setProperty(Property::StyleFlexFlow, styleFlex());
wrap->addChild(el);
el = wrap;
switch (hAlign) {
case AlignmentFlag::Left:
el->setProperty(Property::StyleJustifyContent, "flex-start");
break;
case AlignmentFlag::Center:
el->setProperty(Property::StyleJustifyContent, "center");
break;
case AlignmentFlag::Right:
el->setProperty(Property::StyleJustifyContent, "flex-end");
default:
break;
}
}
if (vAlign != static_cast<AlignmentFlag>(0))
switch (vAlign) {
case AlignmentFlag::Top:
el->setProperty(Property::StyleAlignSelf, "flex-start");
break;
case AlignmentFlag::Middle:
el->setProperty(Property::StyleAlignSelf, "center");
break;
case AlignmentFlag::Bottom:
el->setProperty(Property::StyleAlignSelf, "flex-end");
break;
case AlignmentFlag::Baseline:
el->setProperty(Property::StyleAlignSelf, "baseline");
default:
break;
}
} else {
if (vAlign != static_cast<AlignmentFlag>(0)) {
el->setProperty(Property::StyleFlex, "0 0 auto");
DomElement *wrap = DomElement::createNew(DomElementType::DIV);
wrap->setId("w" + el->id());
wrap->setProperty(Property::StyleDisplay, styleDisplay());
wrap->setProperty(Property::StyleFlexFlow, styleFlex());
wrap->addChild(el);
el = wrap;
switch (vAlign) {
case AlignmentFlag::Top:
el->setProperty(Property::StyleJustifyContent, "flex-start");
break;
case AlignmentFlag::Middle:
el->setProperty(Property::StyleJustifyContent, "center");
break;
case AlignmentFlag::Bottom:
el->setProperty(Property::StyleJustifyContent, "flex-end");
default:
break;
}
}
//.........这里部分代码省略.........