本文整理汇总了C++中core::Event::GetCurrentElement方法的典型用法代码示例。如果您正苦于以下问题:C++ Event::GetCurrentElement方法的具体用法?C++ Event::GetCurrentElement怎么用?C++ Event::GetCurrentElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core::Event
的用法示例。
在下文中一共展示了Event::GetCurrentElement方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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);
}
}
}
}
示例3: 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);
}
}
示例4: ProcessEvent
void WidgetDropDown::ProcessEvent(Core::Event& event)
{
if (parent_element->IsDisabled())
return;
// Process the button onclick
if (event == "click")
{
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);
}
else if (event == "keydown")
{
Core::Input::KeyIdentifier key_identifier = (Core::Input::KeyIdentifier) event.GetParameter< int >("key_identifier", 0);
switch (key_identifier)
{
case Core::Input::KI_UP:
SetSelection( (selected_option - 1 + options.size()) % options.size() );
break;
case Core::Input::KI_DOWN:
SetSelection( (selected_option + 1) % options.size() );
break;
default:
break;
}
}
if (event.GetTargetElement() == parent_element)
{
if (event == "focus")
{
value_element->SetPseudoClass("focus", true);
button_element->SetPseudoClass("focus", true);
}
else if (event == "blur")
{
value_element->SetPseudoClass("focus", false);
button_element->SetPseudoClass("focus", false);
}
}
}