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


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

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


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

示例1: ProcessEvent

void ElementLabel::ProcessEvent(Core::Event& event)
{
	// Detect click events
	if (event.GetTargetElement() == this &&	(event == "click"))
	{
		if (this->HasAttribute("for"))
		{
			Core::Element* forElement = this->GetOwnerDocument()->GetElementById(this->GetAttribute<Core::String>("for", ""));
			if (forElement != NULL)
			{
				forElement->ProcessEvent(event);
			}
		}
		else
		{
			//Note that we have to loop since the ElementFormControlInput class does not pass its OnChildAdded to the superclass.
			//We don't want to modify things too much, so we will just loop when clicked searching for the child input, not really
			//a big deal.
			int childCount = this->GetNumChildren();
			Core::Element* child;
			for (int i = 0; i < childCount; ++i)
			{
				child = this->GetChild(i);
				if (child->GetTagName() == "input")
				{
					child->ProcessEvent(event);
					i = childCount; //break loop
				}
			}
		}
	}

	Element::ProcessEvent(event);
}
开发者ID:Anomalous-Software,项目名称:libRocket,代码行数:34,代码来源:ElementLabel.cpp

示例2: SetPanel

// Sets the specifed tab index's tab panel RML.
void ElementTabSet::SetPanel(int tab_index, const Rocket::Core::String& rml)
{
	Core::Element* element = Core::Factory::InstanceElement(NULL, "*", "panel", Rocket::Core::XMLAttributes());
	Core::Factory::InstanceElementText(element, rml);
	SetPanel(tab_index, element);
	element->RemoveReference();
}
开发者ID:BlueMustache,项目名称:Unvanquished,代码行数:8,代码来源:ElementTabSet.cpp

示例3: ProcessEvent

void ElementDataGrid::ProcessEvent(Core::Event& event)
{
	Core::Element::ProcessEvent(event);

	if (event == "columnadd")
	{
		if (event.GetTargetElement() == this)
		{
			root->RefreshRows();
			DirtyLayout();
		}
	}
	else if (event == "resize")
	{
		if (event.GetTargetElement() == this)
		{
			SetScrollTop(GetScrollHeight() - GetClientHeight());

			for (int i = 0; i < header->GetNumChildren(); i++)
			{
				Core::Element* child = header->GetChild(i);
				columns[i].current_width = child->GetBox().GetSize(Core::Box::MARGIN).x;
			}
		}
	}
}
开发者ID:CarverLab,项目名称:libRocket-1,代码行数:26,代码来源:ElementDataGrid.cpp

示例4: ProcessEvent

void ElementDataGridExpandButton::ProcessEvent(Core::Event& event)
{
	Core::Element::ProcessEvent(event);

	if (event == "click" && event.GetCurrentElement() == this)
	{
		// Look for the first data grid row above us, and toggle their on/off
		// state.
		Core::Element* parent = GetParentNode();
		ElementDataGridRow* parent_row;
		do
		{
			parent_row = dynamic_cast< ElementDataGridRow* >(parent);
			parent = parent->GetParentNode();
		}
		while (parent && !parent_row);

		if (parent_row)
		{
			parent_row->ToggleRow();

			if (parent_row->IsRowExpanded())
			{
				SetClass("collapsed", false);
				SetClass("expanded", true);
			}
			else
			{
				SetClass("collapsed", true);
				SetClass("expanded", false);
			}
		}
	}
}
开发者ID:Aggroo,项目名称:nebula-trifid,代码行数:34,代码来源:ElementDataGridExpandButton.cpp

示例5: ProcessEvent

void ElementDataGrid::ProcessEvent(Core::Event& event)
{
	Core::Element::ProcessEvent(event);

	if (event == "columnadd")
	{
		if (event.GetTargetElement() == this)
		{
			root->RefreshRows();
			DirtyLayout();
		}
	}
	else if (event == "resize")
	{
		if (event.GetTargetElement() == this)
		{
			// commented this out because this bugs selection on overflowed 
			// datagrids contained within another overflowed element
			//SetScrollTop(GetScrollHeight() - GetClientHeight());

			for (int i = 0; i < header->GetNumChildren(); i++)
			{
				Core::Element* child = header->GetChild(i);
				columns[i].current_width = child->GetBox().GetSize(Core::Box::MARGIN).x;
			}
		}
	}
}
开发者ID:Foe-of-Eternity,项目名称:Unvanquished,代码行数:28,代码来源:ElementDataGrid.cpp

示例6: PopRadioSet

// Pops all other radio buttons in our form that share our name.
void InputTypeRadio::PopRadioSet()
{
	// Uncheck all other radio buttons with our name in the form.
	ElementForm* form = NULL;
	Core::Element* parent = element->GetParentNode();
	while (parent != NULL &&
		   (form = dynamic_cast< ElementForm* >(parent)) == NULL)
	   parent = parent->GetParentNode();

	if (form != NULL)
	{
		Core::ElementList form_controls;
		Core::ElementUtilities::GetElementsByTagName(form_controls, form, "input");

		for (size_t i = 0; i < form_controls.size(); ++i)
		{
			ElementFormControlInput* radio_control = dynamic_cast< ElementFormControlInput* >(form_controls[i]);
			if (radio_control != NULL &&
				element != radio_control &&
				radio_control->GetAttribute< Rocket::Core::String >("type", "text") == "radio" &&
				radio_control->GetName() == element->GetName())
			{
				radio_control->RemoveAttribute("checked");
			}
		}
	}
}
开发者ID:1vanK,项目名称:libRocket-Urho3D,代码行数:28,代码来源:InputTypeRadio.cpp

示例7: SetTab

// Set the specifed tab index's title element.
void ElementTabSet::SetTab(int tab_index, Core::Element* element)
{
	Core::Element* tabs = GetChildByTag("tabs");
	if (tab_index >= 0 &&
		tab_index < tabs->GetNumChildren())
		tabs->ReplaceChild(GetChild(tab_index), element);
	else
		tabs->AppendChild(element);
}
开发者ID:BlueMustache,项目名称:Unvanquished,代码行数:10,代码来源:ElementTabSet.cpp

示例8: ElementStart

Core::Element* XMLNodeHandlerDataGrid::ElementStart(Core::XMLParser* parser, const Rocket::Core::String& name, const Rocket::Core::XMLAttributes& attributes)
{
	Core::Element* element = NULL;
	Core::Element* parent = parser->GetParseFrame()->element;

	ROCKET_ASSERT(name == "datagrid" ||
			   name == "col");

	if (name == "datagrid")
	{
		// Attempt to instance the grid.
		element = Core::Factory::InstanceElement(parent, name, name, attributes);
		ElementDataGrid* grid = dynamic_cast< ElementDataGrid* >(element);
		if (grid == NULL)
		{
			if (element != NULL)
				element->RemoveReference();

			Core::Log::Message(Rocket::Core::Log::LT_ERROR, "Instancer failed to create data grid for tag %s.", name.CString());
			return NULL;
		}

		// Set the data source and table on the data grid.
		Rocket::Core::String data_source = attributes.Get< Rocket::Core::String >("source", "");
		grid->SetDataSource(data_source);

		parent->AppendChild(grid);
		grid->RemoveReference();

		// Switch to this handler for all columns.
		parser->PushHandler("datagrid");
	}
	else if (name == "col")
	{
		// Make a new node handler to handle the header elements.		
		element = Core::Factory::InstanceElement(parent, "datagridcolumn", "datagridcolumn", attributes);
		if (element == NULL)
			return NULL;

		ElementDataGrid* grid = dynamic_cast< ElementDataGrid* >(parent);
		if (grid != NULL)
		{
			grid->AddColumn(attributes.Get< Rocket::Core::String >("fields", ""), attributes.Get< Rocket::Core::String >("formatter", ""), attributes.Get< float >("width", 0), element);
			element->RemoveReference();
		}

		// Switch to element handler for all children.
		parser->PushDefaultHandler();
	}
	else
	{
		ROCKET_ERROR;
	}

	return element;
}
开发者ID:ABuus,项目名称:RuntimeCompiledCPlusPlus,代码行数:56,代码来源:XMLNodeHandlerDataGrid.cpp

示例9: getRocket

v8::Handle<v8::Value> HTMLDocument::documentElement() {
  Core::Element* result = getRocket();

  while ( result->GetParentNode() )
    result = result->GetParentNode();
  
  v8::HandleScope handle_scope;
  
  return handle_scope.Close(JS::juice::getV8HandleFromRocketWrapper(result, v8::Null()));

}
开发者ID:GunioRobot,项目名称:v8.rocket,代码行数:11,代码来源:HTMLDocument.cpp

示例10: DoAppendText

void LoadingScreen::DoAppendText(const std::string& str)
{
  Wait();
  {
    Core::Element* input = root->GetElementById("content");
    Core::String   content;

    input->GetInnerRML(content);
    content = Core::String(content + "<br />" + str.c_str());
    input->SetInnerRML(content);
  }
  Post();
  Refresh();
}
开发者ID:655473,项目名称:fallout-equestria,代码行数:14,代码来源:loading_screen.cpp

示例11: GetChildByTag

Core::Element* ElementTabSet::GetChildByTag(const Rocket::Core::String& tag)
{
	// Look for the existing child
	for (int i = 0; i < GetNumChildren(); i++)
	{
		if (GetChild(i)->GetTagName() == tag)
			return GetChild(i);
	}

	// If it doesn't exist, create it
	Core::Element* element = Core::Factory::InstanceElement(this, "*", tag, Rocket::Core::XMLAttributes());
	AppendChild(element);
	element->RemoveReference();
	return element;
}
开发者ID:BlueMustache,项目名称:Unvanquished,代码行数:15,代码来源:ElementTabSet.cpp

示例12: ProcessEvent

void WidgetDropDown::ProcessEvent(Core::Event& event)
{
	// Process the button onclick
	if (event == "click" &&
		!parent_element->IsDisabled())
	{

		if (event.GetCurrentElement()->GetParentNode() == selection_element)
		{
			// Find the element in the options and fire the selection event
			for (size_t i = 0; i < options.size(); i++)
			{
				if (options[i].GetElement() == event.GetCurrentElement())
				{
					if (options[i].IsSelectable())
					{
						SetSelection(i);
						event.StopPropagation();

						ShowSelectBox(false);
						parent_element->Focus();
					}
				}
			}
		}
		else
		{
			// We have to check that this event isn't targeted to an element
			// inside the selection box as we'll get all events coming from our
			// root level select element as well as the ones coming from options (which
			// get caught in the above if)
			Core::Element* element = event.GetTargetElement();
			while (element && element != parent_element)
			{
				if (element == selection_element)
					return;
				element = element->GetParentNode();
			}

			if (selection_element->GetProperty< int >("visibility") == Core::VISIBILITY_HIDDEN)
				ShowSelectBox(true);
			else
				ShowSelectBox(false);
		}		
	}
	else if (event == "blur" && event.GetTargetElement() == parent_element)
		ShowSelectBox(false);
}
开发者ID:Josiastech,项目名称:vuforia-gamekit-integration,代码行数:48,代码来源:WidgetDropDown.cpp

示例13: SetBackground

void LoadingScreen::SetBackground(const string& str)
{
  if (Current)
  {
    Core::Element* element            = Current->root->GetElementById("loading_screen");
    Core::Element* background_defined = Current->root->GetElementById(Core::String("defined-") + str.c_str());

    if (element)
    {
      if (background_defined)
      {
        element->SetClass("default-loading-screen", false);
        element->SetClass(str.c_str(), true);
      }
      else
        element->SetClass("default-loading-screen", true);
    }
  }
}
开发者ID:655473,项目名称:fallout-equestria,代码行数:19,代码来源:loading_screen.cpp

示例14: OnUpdate

// Moves all children to be under control of the widget.
void ElementFormControlSelect::OnUpdate()
{
	ElementFormControl::OnUpdate();

	// Move any child elements into the widget (except for the three functional elements).
	for(int child_index = 0;child_index<GetNumChildren();++child_index)
	{
		Core::Element* child = GetChild(child_index);

		// Check for a value attribute.
		Rocket::Core::String attribute_value = child->GetAttribute<Rocket::Core::String>("value", "");

		// Pull the inner RML and add the option.
		Rocket::Core::String rml;
		child->GetInnerRML(rml);
		widget->AddOption(rml, attribute_value, -1, child->GetAttribute("selected") != NULL, child->GetAttribute("unselectable") == NULL);
	}
	
	RemoveAllChildren();
}
开发者ID:CarverLab,项目名称:libRocket-1,代码行数:21,代码来源:ElementFormControlSelect.cpp

示例15: RecursiveTranslate

void UiBase::RecursiveTranslate(Core::Element* root)
{
  unsigned short it;
  Core::Element* child;

  if (!root)
    return ;
  for (it = 0 ; (child = root->GetChild(it)) ; ++it)
  {
    Core::Variant* attr = child->GetAttribute("i18n");

    if (attr)
    {
      string key = attr->Get<Core::String>().CString();

      child->SetInnerRML(i18n::T(key).c_str());
    }
    else
      RecursiveTranslate(child);
  }
}
开发者ID:655473,项目名称:fallout-equestria,代码行数:21,代码来源:ui_base.cpp


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