本文整理汇总了C++中core::Element类的典型用法代码示例。如果您正苦于以下问题:C++ Element类的具体用法?C++ Element怎么用?C++ Element使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Element类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: ProcessEvent
// Checks for necessary functional changes in the control as a result of the event.
void InputTypeSubmit::ProcessEvent(Core::Event& event)
{
if (event == "click" &&
!element->IsDisabled())
{
Core::Element* parent = element->GetParentNode();
while (parent)
{
ElementForm* form = dynamic_cast< ElementForm* >(parent);
if (form != NULL)
{
form->Submit(element->GetAttribute< Rocket::Core::String >("name", ""), element->GetAttribute< Rocket::Core::String >("value", ""));
return;
}
else
{
parent = parent->GetParentNode();
}
}
}
}
开发者ID:MatiasNAmendola,项目名称:libRocket,代码行数:22,代码来源:InputTypeSubmit.cpp
示例17: SetActiveTab
void ElementTabSet::SetActiveTab(int tab_index)
{
// Update display if the tab has changed
if (tab_index != active_tab)
{
Core::Element* tabs = GetChildByTag("tabs");
Core::Element* old_tab = tabs->GetChild(active_tab);
Core::Element* new_tab = tabs->GetChild(tab_index);
if (old_tab)
old_tab->SetPseudoClass("selected", false);
if (new_tab)
new_tab->SetPseudoClass("selected", true);
Core::Element* windows = GetChildByTag("panels");
Core::Element* old_window = windows->GetChild(active_tab);
Core::Element* new_window = windows->GetChild(tab_index);
if (old_window)
old_window->SetProperty("display", "none");
if (new_window)
new_window->SetProperty("display", "inline-block");
active_tab = tab_index;
Rocket::Core::Dictionary parameters;
parameters.Set("tab_index", active_tab);
DispatchEvent("tabchange", parameters);
}
}
开发者ID:BlueMustache,项目名称:Unvanquished,代码行数:30,代码来源:ElementTabSet.cpp
示例18: AddOption
// Adds a new option to the select control.
int WidgetDropDown::AddOption(const Rocket::Core::String& rml, const Rocket::Core::String& value, int before, bool select, bool selectable)
{
// Instance a new element for the option.
Core::Element* element = Core::Factory::InstanceElement(selection_element, "*", "option", Rocket::Core::XMLAttributes());
// Force to block display and inject the RML. Register a click handler so we can be notified of selection.
element->SetProperty("display", "block");
element->SetProperty("clip", "auto");
element->SetInnerRML(rml);
element->AddEventListener("click", this);
int option_index;
if (before < 0 ||
before >= (int) options.size())
{
selection_element->AppendChild(element);
options.push_back(SelectOption(element, value, selectable));
option_index = (int) options.size() - 1;
}
else
{
selection_element->InsertBefore(element, selection_element->GetChild(before));
options.insert(options.begin() + before, SelectOption(element, value, selectable));
option_index = before;
}
element->RemoveReference();
// Select the option if appropriate.
if (select)
SetSelection(option_index);
box_layout_dirty = true;
return option_index;
}
开发者ID:MatiasNAmendola,项目名称:libRocket,代码行数:36,代码来源:WidgetDropDown.cpp
示例19: ProcessEvent
// Process the incoming event.
void ElementTabSet::ProcessEvent(Core::Event& event)
{
Core::Element::ProcessEvent(event);
if (event.GetCurrentElement() == this && event == "click")
{
// Find the tab that this click occured on
Core::Element* tabs = GetChildByTag("tabs");
Core::Element* tab = event.GetTargetElement();
while (tab && tab != this && tab->GetParentNode() != tabs)
tab = tab->GetParentNode();
// Abort if we couldn't find the tab the click occured on
if (!tab || tab == this)
return;
// Determine the new active tab index
int new_active_tab = active_tab;
for (int i = 0; i < tabs->GetNumChildren(); i++)
{
if (tabs->GetChild(i) == tab)
{
new_active_tab = i;
break;
}
}
SetActiveTab(new_active_tab);
}
}
开发者ID:BlueMustache,项目名称:Unvanquished,代码行数:31,代码来源:ElementTabSet.cpp
示例20: RemoveTab
// Remove one of the tab set's panels and its corresponding tab.
void ElementTabSet::RemoveTab(int tab_index)
{
if (tab_index < 0)
return;
Core::Element* panels = GetChildByTag("panels");
Core::Element* tabs = GetChildByTag("tabs");
if (panels->GetNumChildren() > tab_index &&
tabs->GetNumChildren() > tab_index)
{
panels->RemoveChild(panels->GetChild(tab_index));
tabs->RemoveChild(tabs->GetChild(tab_index));
}
}
开发者ID:BlueMustache,项目名称:Unvanquished,代码行数:16,代码来源:ElementTabSet.cpp
注:本文中的core::Element类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论