• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ dom::Element类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中dom::Element的典型用法代码示例。如果您正苦于以下问题:C++ Element类的具体用法?C++ Element怎么用?C++ Element使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Element类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: parseNode

void KHTMLReader::parseNode(DOM::Node node)
{

    // check if this is a text node.
    DOM::Text t = node;
    if (!t.isNull()) {
        _writer->addText(state()->paragraph, t.data().string(), 1, state()->in_pre_mode);
        return; // no children anymore...
    }

    // is this really needed ? it can't do harm anyway.
    state()->format = _writer->currentFormat(state()->paragraph, true);
    state()->layout = _writer->currentLayout(state()->paragraph);
    pushNewState();

    DOM::Element e = node;

    bool go_recursive = true;

    if (!e.isNull()) {
        // get the CSS information
        parseStyle(e);
        // get the tag information
        go_recursive = parseTag(e);
    }
    if (go_recursive) {
        for (DOM::Node q = node.firstChild(); !q.isNull(); q = q.nextSibling()) {
            parseNode(q);
        }
    }
    popState();


}
开发者ID:KDE,项目名称:koffice,代码行数:34,代码来源:khtmlreader.cpp


示例2: initializeOptionsFromNode

void DOMTreeView::initializeOptionsFromNode(const DOM::Node &node)
{
  infoNode = node;

  nodeName->clear();
  nodeType->clear();
  nodeNamespace->clear();
  nodeValue->clear();

  if (node.isNull()) {
    nodeInfoStack->raiseWidget(EmptyPanel);
    return;
  }

  nodeName->setText(node.nodeName().string());
  nodeType->setText(QString::number(node.nodeType()));
  nodeNamespace->setText(node.namespaceURI().string());
//   nodeValue->setText(node.value().string());

  DOM::Element element = node;
  if (!element.isNull()) {
    initializeOptionsFromElement(element);
    return;
  }

  DOM::CharacterData cdata = node;
  if (!cdata.isNull()) {
    initializeOptionsFromCData(cdata);
    return;
  }

  // Fallback
  nodeInfoStack->raiseWidget(EmptyPanel);
}
开发者ID:iegor,项目名称:kdesktop,代码行数:34,代码来源:domtreeview.cpp


示例3: parse_font

bool KHTMLReader::parse_font(DOM::Element e)
{
    // fixme don't hardcode 12 font size ...
    QString face = e.getAttribute("face").string();
    QColor color = parsecolor("#000000");
    if (!e.getAttribute("color").string().isEmpty())
        color = parsecolor(e.getAttribute("color").string());
    QString size = e.getAttribute("size").string();
    int isize = -1;
    if (size.startsWith('+'))
        isize = 12 + size.right(size.length() - 1).toInt();
    else if (size.startsWith('-'))
        isize = 12 - size.right(size.length() - 1).toInt();
    else
        isize = 12 + size.toInt();

    _writer->formatAttribute(state()->paragraph, "FONT", "name", face);
    if ((isize >= 0) && (isize != 12))
        _writer->formatAttribute(state()->paragraph, "SIZE", "value", QString("%1").arg(isize));

    _writer->formatAttribute(state()->paragraph, "COLOR", "red", QString("%1").arg(color.red()));
    _writer->formatAttribute(state()->paragraph, "COLOR", "green", QString("%1").arg(color.green()));
    _writer->formatAttribute(state()->paragraph, "COLOR", "blue", QString("%1").arg(color.blue()));
    return true;
}
开发者ID:KDE,项目名称:koffice,代码行数:25,代码来源:khtmlreader.cpp


示例4: slotItemRenamed

void DOMTreeView::slotItemRenamed(QListViewItem *lvi, const QString &str, int col)
{
  AttributeListItem *item = static_cast<AttributeListItem *>(lvi);

  DOM::Element element = infoNode;
  if (element.isNull()) return; // Should never happen

  switch (col) {
    case 0: {
      ManipulationCommand *cmd;
//       kdDebug(90180) << k_funcinfo << "col 0: " << element.nodeName() << " isNew: " << item->isNew() << endl;
      if (item->isNew()) {
        cmd = new AddAttributeCommand(element, str, item->text(1));
	item->setNew(false);
      } else
        cmd = new RenameAttributeCommand(element, item->text(0), str);

      mainWindow()->executeAndAddCommand(cmd);
      break;
    }
    case 1: {
      if (item->isNew()) { lvi->setText(1, QString()); break; }

      ChangeAttributeValueCommand *cmd = new ChangeAttributeValueCommand(
      			  element, item->text(0), str);
      mainWindow()->executeAndAddCommand(cmd);
      break;
    }
  }
}
开发者ID:iegor,项目名称:kdesktop,代码行数:30,代码来源:domtreeview.cpp


示例5: parse_ul

bool KHTMLReader::parse_ul(DOM::Element e)
{
    _list_depth++;
    bool popstateneeded = false;
    for (DOM::Node items = e.firstChild();!items.isNull();items = items.nextSibling()) {
        if (items.nodeName().string().toLower() == "li") {
            if (popstateneeded) {
                popState();
                //popstateneeded = false;
            }
            pushNewState();
            startNewLayout();
            popstateneeded = true;
            _writer->layoutAttribute(state()->paragraph, "COUNTER", "numberingtype", "1");
            _writer->layoutAttribute(state()->paragraph, "COUNTER", "righttext", ".");
            if (e.tagName().string().toLower() == "ol") {
                _writer->layoutAttribute(state()->paragraph, "COUNTER", "type", "1");
                _writer->layoutAttribute(state()->paragraph, "COUNTER", "numberingtype", "1");
                _writer->layoutAttribute(state()->paragraph, "COUNTER", "righttext", ".");
            } else {
                _writer->layoutAttribute(state()->paragraph, "COUNTER", "type", "10");
                _writer->layoutAttribute(state()->paragraph, "COUNTER", "numberingtype", "");
                _writer->layoutAttribute(state()->paragraph, "COUNTER", "righttext", "");
            }
            _writer->layoutAttribute(state()->paragraph, "COUNTER", "depth", QString("%1").arg(_list_depth - 1));
        }
        parseNode(items);
    }
    if (popstateneeded)
        popState();
    _list_depth--;
    return false;
}
开发者ID:KDE,项目名称:koffice,代码行数:33,代码来源:khtmlreader.cpp


示例6: showRecursive

void DOMTreeView::showRecursive(const DOM::Node &pNode, const DOM::Node &node, uint depth)
{
  DOMListViewItem *cur_item;
  DOMListViewItem *parent_item = m_itemdict.value(pNode.handle(), 0);

  if (depth > m_maxDepth) {
    m_maxDepth = depth;
  }

  if (depth == 0) {
    cur_item = new DOMListViewItem(node, m_listView);
    m_document = pNode.ownerDocument();
  } else {
    cur_item = new DOMListViewItem(node, parent_item);
  }

  //kDebug(90180) << node.nodeName().string() << " [" << depth << "]";
  cur_item = addElement (node, cur_item, false);
  m_listView->setItemExpanded(cur_item, depth < m_expansionDepth);

  if(node.handle()) {
    m_itemdict.insert(node.handle(), cur_item);
  }

  DOM::Node child = node.firstChild();
  if (child.isNull()) {
    DOM::HTMLFrameElement frame = node;
    if (!frame.isNull()) {
      child = frame.contentDocument().documentElement();
    } else {
      DOM::HTMLIFrameElement iframe = node;
      if (!iframe.isNull())
        child = iframe.contentDocument().documentElement();
    }
  }
  while(!child.isNull()) {
    showRecursive(node, child, depth + 1);
    child = child.nextSibling();
  }

  const DOM::Element element = node;
  if (!m_bPure) {
    if (!element.isNull() && !element.firstChild().isNull()) {
      if(depth == 0) {
	cur_item = new DOMListViewItem(node, m_listView, cur_item);
	m_document = pNode.ownerDocument();
      } else {
	cur_item = new DOMListViewItem(node, parent_item, cur_item);
      }
      //kDebug(90180) << "</" << node.nodeName().string() << ">";
      cur_item = addElement(element, cur_item, true);
//       m_listView->setItemExpanded(cur_item, depth < m_expansionDepth);
    }
  }
}
开发者ID:blue-shell,项目名称:folderview,代码行数:55,代码来源:domtreeview.cpp


示例7: do_start_element

  void do_start_element(const std::string& qName,
                        const std::string& namespaceURI,
                        const SAX::Attributes<std::string>& atts)
  {
    indent();
    DOM::Element<std::string> elem = document().createElementNS(namespaceURI, qName);
    current().appendChild(elem);

    // attributes here
    for(int i = 0; i < atts.getLength(); ++i)
      elem.setAttributeNS(atts.getURI(i), atts.getQName(i), atts.getValue(i));

    current_ = elem;
  } // do_start_element
开发者ID:KITSVictorGubin,项目名称:jornal,代码行数:14,代码来源:xslt_sink.hpp


示例8: remove

void Textual::remove(const Index& index) {
  DOM::HTMLDocument document = htmlDocument();
  if(index.atVariationStart()) {
    DOM::Element vc = document.getElementById("vc_"+index);
    if(!vc.isNull()) {
      /* remove a number? */
      DOM::Element comm(vc.previousSibling());
      DOM::Element mvnum(vc.nextSibling());
      if(!mvnum.isNull() && mvnum.getAttribute("id").string().startsWith("nm_") &&
            !comm.isNull() && comm.getAttribute("id").string().startsWith("cm_"))
      {
        DOM::Element move(mvnum.nextSibling());
        int mv_num = move.getAttribute("mvnum").string().toInt();
        int sub_mv_num = move.getAttribute("submvnum").string().toInt();
        if(!(mv_num>0 && (sub_mv_num==0 && (mv_num%2 || m_layout_style))))
          mvnum.parentNode().removeChild(mvnum);
      }
      vc.parentNode().removeChild(vc);
    }
  }
  else {
    DOM::Element rm = document.getElementById("nm_"+index);
    if(rm.isNull())
      rm = document.getElementById("mv_"+index);
    if(!rm.isNull())
      clear_from(rm);
  }
  if(m_curr_selected >= index)
    m_curr_selected = Index(-1);
}
开发者ID:Axure,项目名称:tagua,代码行数:30,代码来源:movelist_textual.cpp


示例9: parse_a

bool KHTMLReader::parse_a(DOM::Element e)
{
    QString url = e.getAttribute("href").string();
    if (!url.isEmpty()) {
        QString linkName;
        DOM::Text t = e.firstChild();
        if (t.isNull()) {
            /* Link without text -> just drop it*/
            return false; /* stop parsing recursively */
        }
        linkName = t.data().string().simplified();
        t.setData(DOM::DOMString("#")); // replace with '#'
        _writer->createLink(state()->paragraph, linkName, url);
    }
    return true; /* stop parsing recursively */
}
开发者ID:KDE,项目名称:koffice,代码行数:16,代码来源:khtmlreader.cpp


示例10: parse_CommonAttributes

bool KHTMLReader::parse_CommonAttributes(DOM::Element e)
{
    kDebug(30503) << "entering KHTMLReader::parse_CommonAttributes";
    kDebug(30503) << "tagName is" << e.tagName().string();
    QString s = e.getAttribute("align").string();
    if (!s.isEmpty()) {
        _writer->formatAttribute(state()->paragraph, "FLOW", "align", s);
    }
    QRegExp rx("h[0-9]+");
    if (0 == rx.search(e.getAttribute("class").string()))
        // example: <p class="h1" style="text-align:left; ">
    {
        _writer->layoutAttribute(state()->paragraph, "NAME", "value", e.getAttribute("class").string());
    }
    return true;
}
开发者ID:KDE,项目名称:koffice,代码行数:16,代码来源:khtmlreader.cpp


示例11: parseStyle

void KHTMLReader::parseStyle(DOM::Element e)
{
    // styles are broken broken broken broken broken broken.
    // FIXME: use getComputedStyle - note: it only returns 0, but works nevertheless
    kDebug(30503) << "entering parseStyle";
    DOM::CSSStyleDeclaration s1 = e.style();
    DOM::Document doc = _html->document();
    DOM::CSSStyleDeclaration s2 = doc.defaultView().getComputedStyle(e, "");

    kDebug(30503) << "font-weight=" << s1.getPropertyValue("font-weight").string();
    if (s1.getPropertyValue("font-weight").string() == "bolder") {
        _writer->formatAttribute(state()->paragraph, "WEIGHT", "value", "75");
    }
    if (s1.getPropertyValue("font-weight").string() == "bold") {
        _writer->formatAttribute(state()->paragraph, "WEIGHT", "value", "75");
    }

    // process e.g. <style="color: #ffffff">
    if (! s1.getPropertyValue("color").string().isEmpty()) {
        QColor c = parsecolor(s1.getPropertyValue("color").string());
        _writer->formatAttribute(state()->paragraph, "COLOR", "red", QString::number(c.red()));
        _writer->formatAttribute(state()->paragraph, "COLOR", "green", QString::number(c.green()));
        _writer->formatAttribute(state()->paragraph, "COLOR", "blue", QString::number(c.blue()));
    } // done
    // process e.g. <style="font-size: 42">
    if (! s1.getPropertyValue("font-size").string().isEmpty()) {
        QString size = s1.getPropertyValue("font-size").string();
        if (size.endsWith("pt")) {
            size = size.left(size.length() - 2);
        }
        _writer->formatAttribute(state()->paragraph, "SIZE", "value", size);
    }
    // done
    // process e.g. <style="text-align: center">this is in the center</style>
    if (! s1.getPropertyValue("text-align").string().isEmpty()) {
        state()->layout = _writer->setLayout(state()->paragraph, state()->layout);
        _writer->layoutAttribute(state()->paragraph, "FLOW", "align", s1.getPropertyValue("text-align").string());
    }
    // done

    /*if (DOM::PROPV("font-weight") == "bolder")
    _writer->formatAttribute(state()->paragraph,"WEIGHT","value","75");
    */
    /*
         // debugging code.
         kDebug(30503) <<"e.style()";
         for (unsigned int i=0;i<s1.length();i++) {
            kDebug(30503) << QString("%1: %2").arg(s1.item(i).string()).arg(s1.getPropertyValue(s1.item(i)).string());
         }
         kDebug(30503) <<"override style";
         for (unsigned int i=0;i<s2.length();i++) {
            kDebug(30503) << QString("%1: %2").arg(s2.item(i).string()).arg(s2.getPropertyValue(s2.item(i)).string());
         }
    */
}
开发者ID:KDE,项目名称:koffice,代码行数:55,代码来源:khtmlreader.cpp


示例12: KUrl

LinkItem::LinkItem( DOM::Element link )
    : m_valid( false )
{
    DOM::NamedNodeMap attrs = link.attributes();
    DOM::Node href = attrs.getNamedItem( "href" );

    // Load source address of images too
    DOM::Node src = attrs.getNamedItem( "src" );
    if ( href.nodeValue().string().isEmpty() && !src.nodeValue().string().isEmpty() )
      href = src;

    // qDebug("*** href: %s", href.nodeValue().string().latin1() );

    QString urlString = link.ownerDocument().completeURL( href.nodeValue() ).string();
    if ( urlString.isEmpty() )
        return;

    url = KUrl( urlString );
    if ( !KProtocolManager::supportsReading( url ) )
        return;

    // somehow getElementsByTagName("#text") doesn't work :(
    DOM::NodeList children = link.childNodes();
    for ( uint i = 0; i < children.length(); i++ )
    {
        DOM::Node node = children.item( i );
        if ( node.nodeType() == DOM::Node::TEXT_NODE )
            text.append( node.nodeValue().string() );
    }

    // force "local file" mimetype determination
    KMimeType::Ptr mt = KMimeType::findByUrl( url, 0, true, true);
    icon = mt->iconName();
    mimeType = mt->comment();

    m_valid = true;
}
开发者ID:mfuchs,项目名称:kget-gsoc,代码行数:37,代码来源:links.cpp


示例13: parseTag

bool KHTMLReader::parseTag(DOM::Element e)
{
    _PP(a);
    _PP(p);
    _PP(br);
    _PP(table);
    _PP(pre);
    _PP(ul);
    _PP(ol);
    _PP(font);
    _PP(hr);

    // FIXME we can get rid of these, make things tons more simple
    // when khtml finally implements getComputedStyle
    _PF(b, WEIGHT, value, 75);
    _PF(strong, WEIGHT, value, 75);
    _PF(u, UNDERLINE, value, 1);
    _PF(i, ITALIC, value, 1);

    _PL(center, FLOW, align, center);
    _PL(right, FLOW, align, right);
    _PL(left, FLOW, align, left);

    _PL(h1, NAME, value, h1);
    _PL(h2, NAME, value, h2);
    _PL(h3, NAME, value, h3);
    _PL(h4, NAME, value, h4);
    _PL(h5, NAME, value, h5);
    _PL(h6, NAME, value, h6);

    // Don't handle the content of comment- or script-nodes.
    if (e.nodeType() == DOM::Node::COMMENT_NODE || e.tagName().lower() == "script") {
        return false;
    }

    return true;
}
开发者ID:KDE,项目名称:koffice,代码行数:37,代码来源:khtmlreader.cpp


示例14: parse_head

void KHTMLReader::parse_head(DOM::Element e)
{
    for (DOM::Element items = e.firstChild();!items.isNull();items = items.nextSibling()) {
        if (items.tagName().string().lower() == "title") {
            DOM::Text t = items.firstChild();
            if (!t.isNull()) {
                _writer->createDocInfo("HTML import filter", t.data().string());
            }
        }
    }
}
开发者ID:KDE,项目名称:koffice,代码行数:11,代码来源:khtmlreader.cpp


示例15: select

void Textual::select(const Index& index) {
  if(index == m_curr_selected)
    return;
  DOM::HTMLDocument document = htmlDocument();
  DOM::Element currs = document.getElementById("mv_"+m_curr_selected);
  DOM::Element news = document.getElementById("mv_"+index);
  if(!currs.isNull())
    currs.style().removeProperty("background-color");
  if(!news.isNull())
    news.style().setProperty("background-color", "#C0E0FF", "important");
  m_curr_selected = index;
}
开发者ID:Axure,项目名称:tagua,代码行数:12,代码来源:movelist_textual.cpp


示例16: initializeOptionsFromElement

void DOMTreeView::initializeOptionsFromElement(const DOM::Element &element)
{
  QListViewItem *last = 0;
  nodeAttributes->clear();

  DOM::NamedNodeMap attrs = element.attributes();
  unsigned long lmap = attrs.length();
  for (unsigned int j = 0; j < lmap; j++) {
    DOM::Attr attr = attrs.item(j);
//     kdDebug(90180) << attr.name().string() << "=" << attr.value().string() << endl;
    QListViewItem *item = new AttributeListItem(attr.name().string(),
    			attr.value().string(), nodeAttributes, last);
    last = item;
  }

  // append new item
  last = new AttributeListItem(nodeAttributes, last);

  nodeInfoStack->raiseWidget(ElementPanel);
}
开发者ID:iegor,项目名称:kdesktop,代码行数:20,代码来源:domtreeview.cpp


示例17: parse_pre

bool KHTMLReader::parse_pre(DOM::Element e)
{
#if 0 // see Bug #74601 (normal): kword doesn't recognize PRE-tags in HTML
    //pushNewState();
    /// \todo set fixed width font
    DOM::HTMLElement htmlelement(e);
    if (! htmlelement.isNull())
        _writer->addText(state()->paragraph, htmlelement.innerHTML().string(), 1);
    startNewParagraph();
    //popState();
    return false; // children are already handled.
#else
    pushNewState();
    state()->in_pre_mode = true;
    for (DOM::Node q = e.firstChild(); !q.isNull(); q = q.nextSibling()) {
        parseNode(q); // parse everything...
    }
    popState();
    return false; // children are already handled.
#endif
}
开发者ID:KDE,项目名称:koffice,代码行数:21,代码来源:khtmlreader.cpp


示例18: initializeDOMInfoFromElement

void DOMTreeView::initializeDOMInfoFromElement(const DOM::Element &element)
{
  QTreeWidgetItem *last = 0;
  nodeAttributes->clear();

  DOM::NamedNodeMap attrs = element.attributes();
  unsigned long lmap = attrs.length();
  for (unsigned int j = 0; j < lmap; j++) {
    DOM::Attr attr = attrs.item(j);
//     kDebug(90180) << attr.name().string() << "=" << attr.value().string();
    QTreeWidgetItem *item = new AttributeListItem(attr.name().string(),
                                                  attr.value().string(),
                                                  nodeAttributes, last);
    last = item;
  }

  // append new item
  last = new AttributeListItem(nodeAttributes, last);

  nodeAttributes->sortByColumn(0, Qt::AscendingOrder);

  nodeInfoStack->setCurrentIndex(ElementPanel);
}
开发者ID:blue-shell,项目名称:folderview,代码行数:23,代码来源:domtreeview.cpp


示例19: initializeCSSInfoFromElement

void DOMTreeView::initializeCSSInfoFromElement(const DOM::Element &element)
{
  DOM::Document doc = element.ownerDocument();
  DOM::AbstractView view = doc.defaultView();
  DOM::CSSStyleDeclaration styleDecl = view.getComputedStyle(element,
                                                             DOM::DOMString());

  unsigned long l = styleDecl.length();
  cssProperties->clear();
  cssProperties->setEnabled(true);
  QList<QTreeWidgetItem *> items;
  for (unsigned long i = 0; i < l; ++i) {
    DOM::DOMString name = styleDecl.item(i);
    DOM::DOMString value = styleDecl.getPropertyValue(name);

    QStringList values;
    values.append(name.string());
    values.append(value.string());
    items.append(new QTreeWidgetItem(static_cast<QTreeWidget*>(0), values));
  }

  cssProperties->insertTopLevelItems(0, items);
  cssProperties->resizeColumnToContents(0);
}
开发者ID:blue-shell,项目名称:folderview,代码行数:24,代码来源:domtreeview.cpp


示例20: align

void ofxDOMFlexBoxLayout::align(FlexDirection direction){

	bool horizontal = direction == FlexDirection::ROW;

	float paddingHorizontal = DOMLH::getPaddingHorizontal(_parent);
	float paddingVertical = DOMLH::getPaddingVertical(_parent);

	float wParent = ofGetWidth();
	float hParent = ofGetHeight();
	if(_parent->parent()){
		wParent = _parent->getSizeByParent().x;
		hParent = _parent->getSizeByParent().y;
	}

	float totalWidth = DOMLH::getDesiredWidthStretched(_parent, wParent) - paddingHorizontal;
	float totalHeight = DOMLH::getDesiredHeightStretched(_parent, hParent) - paddingVertical;

//	if(ofxGuiElement* el = dynamic_cast<ofxGuiElement*>(_parent)){
//		cout << el->getName() << " total size: " << totalWidth << " " << totalHeight << endl;
//	}

	vector<vector<DOM::Element*>> lines;
	vector<vector<DOM::Element*>> noFlexItems;
	vector<vector<DOM::Element*>> flexItems;
	vector<vector<float>> flexItemsBasis;
	vector<float> totalSpaceMainAxis;

	float mainAxisSize =  horizontal ? totalWidth : totalHeight;
	float crossAxisSize = horizontal ? totalHeight : totalWidth;

	int linecount = 0;

	if(children().size() > 0){
		//newline
		lines.push_back(vector<DOM::Element*>());
		noFlexItems.push_back(vector<DOM::Element*>());
		flexItems.push_back(vector<DOM::Element*>());
		flexItemsBasis.push_back(vector<float>());
		totalSpaceMainAxis.push_back(mainAxisSize);
	}

	//sort children according to flex attribute and main size of children

	for(unsigned int i = 0; i < children().size(); i++){

		DOM::Element* element = children().at(i);
		float w, h;
		if(horizontal){
			w = DOMLH::getDesiredWidth(element, totalWidth);
			h = DOMLH::getDesiredHeight(element, totalHeight);
		}else{
			w = DOMLH::getDesiredWidth(element, totalWidth);
			h = DOMLH::getDesiredHeight(element, totalHeight);
		}

		float elementMainSize = horizontal ? w : h;
		float elementCrossSize = horizontal ? h : w;

		if(element){
			if(elementFlexing(element)){

//				element->setSizeByParent(totalWidth, totalHeight);

				// set to minimal size on main axis
				if(horizontal){
					element->setSizeByParent(elementMainSize + DOMLH::getMarginHorizontal(element), elementCrossSize + DOMLH::getMarginVertical(element));
					element->setLayoutSize(elementMainSize, elementCrossSize, true);
					elementMainSize = element->getWidth() + DOMLH::getMarginHorizontal(element);
				}else {
					element->setSizeByParent(elementCrossSize + DOMLH::getMarginHorizontal(element), elementMainSize + DOMLH::getMarginVertical(element));
					element->setLayoutSize(elementCrossSize, elementMainSize, true);
					elementMainSize = element->getHeight() + DOMLH::getMarginVertical(element);
				}

				//if element is flexible, add it to the current line and save the items flex basis
				if(element->hasAttribute("_flex")){
					std::string flexval = element->getAttribute<std::string>("_flex");
					if(flexval == "auto"){
						lines.at(linecount).push_back(element);
						flexItems.at(linecount).push_back(element);
						flexItemsBasis.at(linecount).push_back(1);
						continue;
					}
					if(isFloat(ofTrim(flexval))){
						float intflexval = ofToFloat(flexval);
						if(intflexval > 0){
							lines.at(linecount).push_back(element);
							flexItems.at(linecount).push_back(element);
							flexItemsBasis.at(linecount).push_back(intflexval);
							continue;
						}
					}
				}

				// not flexible or no valid flex attribute, not flexing on main axis

				// add to new line if it does not fit and flex-wrap is on
				if((int)totalSpaceMainAxis.at(linecount) - (int)elementMainSize < 0){
					FlexWrap _wrap = getFlexWrap(_parent);
					if(_wrap == FlexWrap::NOWRAP || i == 0){
//.........这里部分代码省略.........
开发者ID:huang018,项目名称:ofxGuiExtended,代码行数:101,代码来源:ofxDOMFlexBoxLayout.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ dom::Node类代码示例发布时间:2022-05-31
下一篇:
C++ dom::DocumentImpl类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap