当前位置: 首页>>代码示例>>C++>>正文


C++ DomElement::id方法代码示例

本文整理汇总了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;
      }
    }
//.........这里部分代码省略.........
开发者ID:AlexanderKotliar,项目名称:wt,代码行数:101,代码来源:FlexLayoutImpl.C


注:本文中的DomElement::id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。