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


C++ Node::handle方法代码示例

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


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

示例1: 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

示例2:

khtml::MouseEvent::MouseEvent(const char *name, QMouseEvent *qmouseEvent, int x, int y,
                              const DOM::DOMString &url, const DOM::DOMString &target,
                              const DOM::Node &innerNode)
    : KParts::Event(name), m_qmouseEvent(qmouseEvent), m_x(x), m_y(y),
      m_url(url), m_target(target), m_innerNode(innerNode)
{
    d = 0;
    if (innerNode.handle() && innerNode.handle()->renderer()) {
        innerNode.handle()->renderer()->absolutePosition(m_nodeAbsX, m_nodeAbsY);
    }
}
开发者ID:KDE,项目名称:khtml,代码行数:11,代码来源:khtml_events.cpp

示例3: slotRefreshNode

void DOMTreeView::slotRefreshNode(const DOM::Node &pNode)
{
  DOMListViewItem *cur = static_cast<DOMListViewItem *>(m_itemdict[pNode.handle()]);
  if (!cur) return;

  addElement(pNode, cur, false);
}
开发者ID:iegor,项目名称:kdesktop,代码行数:7,代码来源:domtreeview.cpp

示例4: slotShowNode

void DOMTreeView::slotShowNode(const DOM::Node &pNode)
{

  if (QListViewItem *item = m_itemdict[pNode.handle()]) {
    m_listView->setCurrentItem(item);
    m_listView->ensureItemVisible(item);
  }
}
开发者ID:iegor,项目名称:kdesktop,代码行数:8,代码来源:domtreeview.cpp

示例5: slotShowNode

void DOMTreeView::slotShowNode(const DOM::Node &pNode)
{

  if (QTreeWidgetItem *item = m_itemdict.value(pNode.handle(), 0)) {
    m_listView->setCurrentItem(item);
    m_listView->scrollToItem(item);
  }
}
开发者ID:blue-shell,项目名称:folderview,代码行数:8,代码来源:domtreeview.cpp

示例6: innerNode

long khtml::MouseEvent::offset() const
{
    Position pos;
    if (innerNode().handle()) {
        // FIXME: Shouldn't be necessary to skip text nodes.
        DOM::Node inner = innerNode();
        if (inner.nodeType() == Node::TEXT_NODE) {
            inner = inner.parentNode();
        }
        pos = inner.handle()->positionForCoordinates(m_x, m_y).position();
    }
    return pos.offset();
}
开发者ID:KDE,项目名称:khtml,代码行数:13,代码来源:khtml_events.cpp

示例7: tryCall

Value XMLSerializerProtoFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
{
  if (!thisObj.inherits(&XMLSerializer::info)) {
    Object err = Error::create(exec,TypeError);
    exec->setException(err);
    return err;
  }

  switch (id) {
  case XMLSerializer::SerializeToString:
    {
      if (args.size() != 1) {
	return Undefined();
      }

      if (!args[0].toObject(exec).inherits(&DOMDocument::info)) {
	return Undefined();
      }

      DOM::Node docNode = static_cast<KJS::DOMDocument *>(args[0].toObject(exec).imp())->toNode();
      DOM::DocumentImpl *doc = static_cast<DOM::DocumentImpl *>(docNode.handle());

      if (!doc) {
	return Undefined();
      }
	  
      QString body;

      try {
	  body = doc->toString().string();
      } catch(DOM::DOMException& e) {
	  Object err = Error::create(exec, GeneralError, "Exception serializing document");
	  exec->setException(err);
	  return err;
      }
    
      return getStringOrNull(body);
    }
  }

  return Undefined();
}
开发者ID:BackupTheBerlios,项目名称:wxwebcore-svn,代码行数:42,代码来源:xmlserializer.cpp

示例8: addElement

void DOMTreeView::addElement ( const DOM::Node &node,  DOMListViewItem *cur_item, bool isLast)
{
  cur_item->setClosing(isLast);

  const QString nodeName(node.nodeName().string());
  QString text;
  const DOM::Element element = node;
  if (!element.isNull()) {
    if (!m_bPure) {
      if (isLast) {
	text ="</";
      } else {
	text = "<";
      }
      text += nodeName;
    } else {
      text = nodeName;
    }

    if (m_bShowAttributes && !isLast) {
      QString attributes;
      DOM::Attr attr;
      DOM::NamedNodeMap attrs = element.attributes();
      unsigned long lmap = attrs.length();
      for( unsigned int j=0; j<lmap; j++ ) {
	attr = static_cast<DOM::Attr>(attrs.item(j));
	attributes += " " + attr.name().string() + "=\"" + attr.value().string() + "\"";
      }
      if (!(attributes.isEmpty())) {
	text += " ";
      }
      text += attributes.simplifyWhiteSpace();
    }

    if (!m_bPure) {
      if(element.firstChild().isNull()) {
	text += "/>";
      } else {
	text += ">";
      }
    }
    cur_item->setText(0, text);
  } else {
    text = "`" + node.nodeValue().string() + "'";

    // Hacks to deal with PRE
    QTextStream ts( text, IO_ReadOnly );
    while (!ts.eof()) {
      const QString txt(ts.readLine());
      const QFont font(KGlobalSettings::fixedFont());
      cur_item->setFont( font );
      cur_item->setText(0, txt);

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

      DOMListViewItem *parent;
      if (cur_item->parent()) {
	parent = static_cast<DOMListViewItem *>(cur_item->parent());
      } else {
	parent = cur_item;
      }
      cur_item = new DOMListViewItem(node, parent, cur_item);
    }
    // This is one is too much
    DOMListViewItem *notLastItem = static_cast<DOMListViewItem *>(cur_item->itemAbove());
    delete cur_item;
    cur_item = notLastItem;
  }

  if (m_bHighlightHTML && node.ownerDocument().isHTMLDocument()) {
    highlightHTML(cur_item, nodeName);
  }
}
开发者ID:iegor,项目名称:kdesktop,代码行数:75,代码来源:domtreeview.cpp

示例9: if

ArtSVP *LibartCanvas::clipSingleSVP(ArtSVP *svp, SVGShapeImpl *shape)
{
	ArtSVP *clippedSvp = copy_svp(svp);
	SVGStylableImpl *style = dynamic_cast<SVGStylableImpl *>(shape);

	if(style)
	{
		QString clipPathRef = style->getClipPath();

		if(!clipPathRef.isEmpty())
		{
			CanvasClipPath *clipPath = m_clipPaths[clipPathRef];

			if(clipPath)
			{
				LibartClipPath *lclip = dynamic_cast<LibartClipPath *>(clipPath);
				reinterpret_cast<SVGClipPathElementImpl *>(clipPath->element())->setBBoxTarget(shape);

				lclip->init();

				if(lclip->clipSVP())
				{
					ArtSVP *s = art_svp_intersect(lclip->clipSVP(), clippedSvp);
					art_svp_free(clippedSvp);
					clippedSvp = s;
				}
			}
		}
	}

	SVGSVGElementImpl *svg = dynamic_cast<SVGSVGElementImpl *>(shape);

	// Clip outer svg, unless width and height not set
	if(svg && (!svg->isRootElement() || !svg->getAttribute("width").isEmpty() || !svg->getAttribute("height").isEmpty()) && !svg->getOverflow())
	{
		ArtSVP *svgClip = clippingRect(svg->clip(), svg->screenCTM());
		ArtSVP *s = art_svp_intersect(svgClip, clippedSvp);
		art_svp_free(clippedSvp);
		art_svp_free(svgClip);
		clippedSvp = s;
	}

	if(dynamic_cast<SVGPatternElementImpl *>(shape) != 0)
	{
		// TODO: inherit clipping paths into tile space
	}
	else if(dynamic_cast<SVGMarkerElementImpl *>(shape) != 0)
	{
		SVGMarkerElementImpl *marker = static_cast<SVGMarkerElementImpl *>(shape);

		if(!marker->clipShape().isEmpty())
		{
			ArtSVP *clipShape = svpFromPolygon(marker->clipShape());
			ArtSVP *s = art_svp_intersect(clipShape, clippedSvp);
			art_svp_free(clipShape);
			art_svp_free(clippedSvp);
			clippedSvp = s;
		}

		// TODO: inherit clipping paths into marker space
	}
	else
	{
		SVGElementImpl *element = dynamic_cast<SVGElementImpl *>(shape);
		DOM::Node parentNode = element->parentNode();

		if(!parentNode.isNull())
		{
			SVGElementImpl *parent = element->ownerDoc()->getElementFromHandle(parentNode.handle());

			if(parent)
			{
				SVGShapeImpl *parentShape = dynamic_cast<SVGShapeImpl *>(parent);

				if(parentShape)
				{
					// Clip against ancestor clipping paths
					ArtSVP *parentClippedSvp = clipSingleSVP(clippedSvp, parentShape);
					art_svp_free(clippedSvp);
					clippedSvp = parentClippedSvp;
				}
			}
		}
	}

	return clippedSvp;
}
开发者ID:serghei,项目名称:kde3-kdegraphics,代码行数:87,代码来源:LibartCanvas.cpp

示例10: return

// collection of nodes for which to emit the nodeChanged signal
inline static bool operator <(const DOM::Node &n1, const DOM::Node &n2)
{
  return (qptrdiff)n1.handle() - (qptrdiff)n2.handle() < 0;
}
开发者ID:vishesh,项目名称:kde-baseapps,代码行数:5,代码来源:domtreecommands.cpp


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