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


C++ DomElement类代码示例

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


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

示例1: named_item_ns

	void DomElement::set_child_string_ns(const DomString &namespace_uri, const DomString &qualified_name, const DomString &value)
	{
		DomString local_name;
		DomString::size_type pos = qualified_name.find(L':');
		if (pos != DomString::npos)
			local_name = qualified_name.substr(pos + 1);
		else
			local_name = qualified_name;

		DomElement element = named_item_ns(namespace_uri, local_name).to_element();
		if (element.is_null())
		{
			element = get_owner_document().create_element_ns(namespace_uri, qualified_name);
			append_child(element);
		}

		DomText dom_text = get_owner_document().create_text_node(value);
		if (element.get_first_child().is_text())
		{
			DomNode temp_domnode = element.get_first_child();
			replace_child(dom_text, temp_domnode);
		}
		else
		{
			element.append_child(dom_text);
		}
	}
开发者ID:keigen-shu,项目名称:ClanLib,代码行数:27,代码来源:dom_element.cpp

示例2: 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);
}
开发者ID:913862627,项目名称:wt,代码行数:27,代码来源:WWidgetItemImpl.C

示例3: updateDom

void WLineEdit::updateDom(DomElement& element, bool all)
{
  if (all || flags_.test(BIT_CONTENT_CHANGED)) {
    element.setProperty(Wt::PropertyValue, content_.toUTF8());
    flags_.reset(BIT_CONTENT_CHANGED);
  }

  if (all || flags_.test(BIT_ECHO_MODE_CHANGED)) {
    element.setAttribute("type", echoMode_ == Normal ? "text" : "password");
    flags_.reset(BIT_ECHO_MODE_CHANGED);
  }

  if (all || flags_.test(BIT_TEXT_SIZE_CHANGED)) {
    element.setAttribute("size",
			 boost::lexical_cast<std::string>(textSize_));
    flags_.reset(BIT_TEXT_SIZE_CHANGED);
  }

  if (all || flags_.test(BIT_MAX_LENGTH_CHANGED)) {
    if (!all || maxLength_ > 0)
      element.setAttribute("maxLength",
			   boost::lexical_cast<std::string>(maxLength_));

    flags_.reset(BIT_MAX_LENGTH_CHANGED);
  }

  WFormWidget::updateDom(element, all);
}
开发者ID:ChowZenki,项目名称:wt,代码行数:28,代码来源:WLineEdit.C

示例4: rootAsJavaScript

void WContainerWidget::rootAsJavaScript(WApplication *app, std::ostream& out,
					bool all)
{
  std::vector<WWidget *> *toAdd
    = all ? children_ : (transientImpl_ ? &transientImpl_->addedChildren_ : 0);

  if (toAdd)
    for (unsigned i = 0; i < toAdd->size(); ++i) {
      DomElement *c = (*toAdd)[i]->createSDomElement(app);

      app->streamBeforeLoadJavaScript(out, false);

      c->callMethod("omousemove=function(e) {"
		    "if (!e) e = window.event;"
		    "return " + app->javaScriptClass()
		    + "._p_.dragDrag(event); }");
      c->callMethod("mouseup=function(e) {"
		    "if (!e) e = window.event;"
		    "return " + app->javaScriptClass()
		  + "._p_.dragEnd(event);}");
      c->callMethod("dragstart=function(){return false;}");
      c->asJavaScript(out);
      delete c;
    }

  if (transientImpl_)
    transientImpl_->addedChildren_.clear();

  if (!all) {
    /* Note: we ignore rendering of deletion of a bound widget... */
  }

  // FIXME
  propagateRenderOk(false);
}
开发者ID:StevenFarley,项目名称:wt,代码行数:35,代码来源:WContainerWidget.C

示例5: save_item

void Project::save_item(DomElement dom_parent, ProjectItem *item)
{
	DomElement dom_item;
	if (dynamic_cast<ProjectFolderItem*>(item))
	{
		ProjectFolderItem *folder_item = dynamic_cast<ProjectFolderItem*>(item);
		dom_item = dom_parent.get_owner_document().create_element("folder");
		dom_item.set_child_string("path", folder_item->path);
	}
	else if (dynamic_cast<ProjectFilterItem*>(item))
	{
		ProjectFilterItem *filter_item = dynamic_cast<ProjectFilterItem*>(item);
		dom_item = dom_parent.get_owner_document().create_element("filter");
		dom_item.set_child_string("name", filter_item->name);
	}
	else if (dynamic_cast<ProjectFileItem*>(item))
	{
		ProjectFileItem *file_item = dynamic_cast<ProjectFileItem*>(item);
		dom_item = dom_parent.get_owner_document().create_element("file");
		dom_item.set_child_string("filename", file_item->filename);
	}
	else
	{
		throw Exception("Unknown item type");
	}

	save_item_children(dom_item, item);
	dom_parent.append_child(dom_item);
}
开发者ID:Cassie90,项目名称:ClanLib,代码行数:29,代码来源:project.cpp

示例6: updateDom

void WPaintedWidget::getDomChanges(std::vector<DomElement *>& result,
				   WApplication *app)
{
  DomElement *e = DomElement::getForUpdate(this, DomElement_DIV);
  updateDom(*e, false);
  result.push_back(e);

  bool createdNew = createPainter();

  if (needRepaint_) {
    WPaintDevice *device = painter_->getPaintDevice
      ((repaintFlags_ & PaintUpdate) && !createdNew);

    if (renderWidth_ != 0 && renderHeight_ != 0) {
      paintEvent(device);

#ifdef WT_TARGET_JAVA
      if (device->painter())
	device->painter()->end();
#endif // WT_TARGET_JAVA
    }

    if (createdNew) {
      DomElement *canvas = DomElement::getForUpdate('p' + id(), DomElement_DIV);
      canvas->removeAllChildren();
      painter_->createContents(canvas, device);
      result.push_back(canvas);
    } else {
      painter_->updateContents(result, device);
    }

    needRepaint_ = false;
    repaintFlags_ = 0;
  }
}
开发者ID:gokulavasan,项目名称:wt,代码行数:35,代码来源:WPaintedWidget.C

示例7: updateDom

void WText::updateDom(DomElement& element, bool all)
{
  if (flags_.test(BIT_TEXT_CHANGED) || all) {
    std::string text = formattedText();
    if (flags_.test(BIT_TEXT_CHANGED) || !text.empty())
      element.setProperty(Wt::PropertyInnerHTML, text);
    flags_.reset(BIT_TEXT_CHANGED);
  }

  if (flags_.test(BIT_WORD_WRAP_CHANGED) || all) {
    if (!all || !flags_.test(BIT_WORD_WRAP))
      element.setProperty(Wt::PropertyStyleWhiteSpace,
			  flags_.test(BIT_WORD_WRAP) ? "normal" : "nowrap");
    flags_.reset(BIT_WORD_WRAP_CHANGED);
  }

  if (flags_.test(BIT_PADDINGS_CHANGED)
      || (all && padding_ &&
	  !(padding_[0].isAuto() && padding_[1].isAuto()))) {
    
    element.setProperty(PropertyStylePaddingRight, padding_[0].cssText());
    element.setProperty(PropertyStylePaddingLeft, padding_[1].cssText());

    flags_.reset(BIT_PADDINGS_CHANGED);
  }

  WInteractWidget::updateDom(element, all);
}
开发者ID:Dinesh-Ramakrishnan,项目名称:wt,代码行数:28,代码来源:WText.C

示例8: updateContents

void WWidgetVectorPainter::updateContents(std::vector<DomElement *>& result,
					  WPaintDevice *device)
{
  WVectorImage *vectorDevice = dynamic_cast<WVectorImage *>(device);

  if (widget_->repaintFlags_ & PaintUpdate) {
    DomElement *painter = DomElement::updateGiven
      (WT_CLASS ".getElement('p" + widget_->id()+ "').firstChild",
       DomElement_DIV);

    painter->setProperty(PropertyAddedInnerHTML, vectorDevice->rendered());

    WApplication *app = WApplication::instance();
    if (app->environment().agentIsOpera())
      painter->callMethod("forceRedraw();");

    result.push_back(painter);
  } else {
    DomElement *canvas = DomElement::getForUpdate
      ('p' + widget_->id(), DomElement_DIV);

    /*
     * In fact, we should use another property, since we could be using
     * document.importNode() instead of myImportNode() since the xml does not
     * need to be interpreted as HTML...
     */
    canvas->setProperty(PropertyInnerHTML, vectorDevice->rendered());
    result.push_back(canvas);
  }

  widget_->sizeChanged_ = false;

  delete device;
}
开发者ID:gokulavasan,项目名称:wt,代码行数:34,代码来源:WPaintedWidget.C

示例9: updateDom

void WSelectionBox::updateDom(DomElement& element, bool all)
{
  if (configChanged_ || all) {
    element.setAttribute("size", std::to_string(verticalSize_));

    if (!all || (selectionMode_ == SelectionMode::Extended)) {
      element.setProperty(Property::Multiple,
			  selectionMode_ == SelectionMode::Extended
			  ? "true" : "false");
      if (!all)
	selectionChanged_ = true;
    }

    configChanged_ = false;
  }

  if (selectionMode_ == SelectionMode::Extended) {
    if (selectionChanged_ && !all) {
      for (int i = 0; i < count(); ++i) {
	element.callMethod("options[" + std::to_string(i) + "].selected="
			   + (isSelected(i) ? "true" : "false"));
      }
    }
    selectionChanged_ = false;
  }

  WComboBox::updateDom(element, all);
}
开发者ID:kdeforche,项目名称:wt,代码行数:28,代码来源:WSelectionBox.C

示例10: updateDom

void WSlider::updateDom(DomElement& element, bool all)
{
  if (paintedSlider_)
    paintedSlider_->doUpdateDom(element, all);
  else {
    if (all || changed_) {
      element.setAttribute("type", "range");
      element.setProperty(Wt::PropertyValue,
			  boost::lexical_cast<std::string>(value_));
      element.setAttribute("min",
			   boost::lexical_cast<std::string>(minimum_));
      element.setAttribute("max",
			   boost::lexical_cast<std::string>(maximum_));

      if (!changedConnected_
	  && (valueChanged_.isConnected() || sliderMoved_.isConnected())) {
	changedConnected_ = true;
	changed().connect(this, &WSlider::onChange);
      }

      changed_ = false;
    }
  }

  WFormWidget::updateDom(element, all);
}
开发者ID:StevenFarley,项目名称:wt,代码行数:26,代码来源:WSlider.C

示例11:

int LuaDomText2::removeThis(lua_State *L)
{
	DomText* obj = DomTextValue::check2( L, 1 );
	DomElement* p = obj->getParent(); 
	if( p == 0 || !p->remove( obj ) )
		luaL_error( L, "Error removing this node" );
	return 0;
}
开发者ID:Wushaowei001,项目名称:NAF,代码行数:8,代码来源:LuaXml2.cpp

示例12: webWidget

std::string WWidget::inlineCssStyle()
{
    WWebWidget *ww = webWidget();
    DomElement *e = DomElement::getForUpdate(ww, ww->domElementType());
    ww->updateDom(*e, true);
    std::string result = e->cssStyle();
    delete e;
    return result;
}
开发者ID:bytemaster,项目名称:wt-1,代码行数:9,代码来源:WWidget.C

示例13: load_item_children

void Project::load_item_children(ProjectItem *item, DomElement dom_items)
{
	DomElement cur = dom_items.get_first_child_element();
	while (!cur.is_null())
	{
		item->add(load_item(cur));
		cur = cur.get_next_sibling_element();
	}
}
开发者ID:Cassie90,项目名称:ClanLib,代码行数:9,代码来源:project.cpp

示例14: getImpl

DomElement *StdGridLayoutImpl2::createElement(WLayoutItem *item,
					      WApplication *app)
{
  DomElement *c = getImpl(item)->createDomElement(true, true, app); 

  c->setProperty(PropertyStyleVisibility, "hidden");

  return c;
}
开发者ID:Unss,项目名称:wt,代码行数:9,代码来源:StdGridLayoutImpl2.C

示例15: updateDom

void WFormWidget::updateDom(DomElement& element, bool all)
{
  const WEnvironment& env = WApplication::instance()->environment();

  bool onChangeHandledElsewhere = dynamic_cast<WAbstractToggleButton *>(this);

  if (!onChangeHandledElsewhere) {
    EventSignal<> *s = voidEventSignal(CHANGE_SIGNAL, false);
    if (s)
      updateSignalConnection(element, *s, "change", all);
  }

  if (flags_.test(BIT_ENABLED_CHANGED) || all) {
    if (!all || !isEnabled())
      element.setProperty(Wt::PropertyDisabled,
			  isEnabled() ? "false" : "true");

    if (!all && isEnabled() && env.agentIsIE()) {
      /*
       * FIXME: implement a workaround for IE, reenabling a checkbox makes
       * the input box loose interactivity.
       */
    }
    flags_.reset(BIT_ENABLED_CHANGED);
  }

  if (flags_.test(BIT_READONLY_CHANGED) || all) {
    if (!all || isReadOnly())
      element.setProperty(Wt::PropertyReadOnly,
			  isReadOnly() ? "true" : "false");
    flags_.reset(BIT_READONLY_CHANGED);
  }

  if (flags_.test(BIT_TABINDEX_CHANGED) || all) {
    if (!all || tabIndex_)
      element.setProperty(PropertyTabIndex,
			  boost::lexical_cast<std::string>(tabIndex_));
    flags_.reset(BIT_TABINDEX_CHANGED);
  }

  if (isEnabled()) {
    if (all && flags_.test(BIT_GOT_FOCUS))
      flags_.set(BIT_INITIAL_FOCUS);

    if (flags_.test(BIT_GOT_FOCUS)
	|| (all && flags_.test(BIT_INITIAL_FOCUS))) {
      element.callJavaScript("setTimeout(function() {"
			     """var f = " + jsRef() + ";"
			     """if (f) try { f.focus(); } catch (e) { } }, "
			     + (env.agentIsIElt(9) ? "500" : "10") + ");");

      flags_.reset(BIT_GOT_FOCUS);
    }
  }

  WInteractWidget::updateDom(element, all);
}
开发者ID:bvanhauwaert,项目名称:wt,代码行数:57,代码来源:WFormWidget.C


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