• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

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

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

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


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


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

// Checks for necessary functional changes in the control as a result of the event.
void InputTypeButton::ProcessEvent(Core::Event& event)
{
	// Stop a click event from proceeding any further if this button is disabled.
	if (event.GetTargetElement() == element &&
		element->IsDisabled() &&
		(event == "click" || event == "dblclick"))
	{
		event.StopPropagation();
	}
}
开发者ID:MatiasNAmendola,项目名称:libRocket,代码行数:11,代码来源:InputTypeButton.cpp


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


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


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


示例8: ProcessEvent

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

	// Only process events if we're visible
	if (beacon != NULL)
	{
		if (event == "click")
		{
			if (event.GetTargetElement() == beacon->GetFirstChild())
			{
				if (!IsVisible())
					SetProperty("visibility", "visible");

				beacon->SetProperty("visibility", "hidden");
				current_beacon_level = Core::Log::LT_MAX;
			}
			else if (event.GetTargetElement()->GetId() == "close_button")
			{
				if (IsVisible())
					SetProperty("visibility", "hidden");
			}
			else
			{
				for (int i = 0; i < Core::Log::LT_MAX; i++)
				{
					if (!log_types[i].button_name.Empty() && event.GetTargetElement()->GetId() == log_types[i].button_name)
					{
						log_types[i].visible = !log_types[i].visible;
						if (log_types[i].visible)
							event.GetTargetElement()->SetInnerRML("On");
						else
							event.GetTargetElement()->SetInnerRML("Off");
						dirty_logs = true;
					}
				}
			}
		}
	}

	if (event == "resize" && auto_scroll)
	{
		if (message_content != NULL &&
			message_content->HasChildNodes())
			message_content->GetLastChild()->ScrollIntoView();
	}
}
开发者ID:UIKit0,项目名称:librocket-1,代码行数:47,代码来源:ElementLog.cpp


示例9: ProcessEvent

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

    if (event == "resize")
    {
        if (event.GetTargetElement() == header)
        {
            SetProperty("width", Core::Property(header->GetBox().GetSize(Core::Box::MARGIN).x, Core::Property::PX));
        }
    }
}
开发者ID:Wilhansen,项目名称:libRocket,代码行数:12,代码来源:ElementDataGridCell.cpp


示例10: ProcessEvent

// Event handler for events from the debugger elements.
void Plugin::ProcessEvent(Core::Event& event)
{
	if (event == "click")
	{
		if (event.GetTargetElement()->GetId() == "event-log-button")
		{
			if (log_element->IsVisible())
				log_element->SetProperty("visibility", "hidden");
			else
				log_element->SetProperty("visibility", "visible");
		}
		else if (event.GetTargetElement()->GetId() == "debug-info-button")
		{
			if (info_element->IsVisible())
				info_element->SetProperty("visibility", "hidden");
			else
				info_element->SetProperty("visibility", "visible");
		}
		else if (event.GetTargetElement()->GetId() == "outlines-button")
		{
			render_outlines = !render_outlines;
		}
	}
}
开发者ID:1vanK,项目名称:libRocket-Urho3D,代码行数:25,代码来源:Plugin.cpp


示例11: 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);
		}
	}

}
开发者ID:Kezeali,项目名称:libRocket,代码行数:83,代码来源:WidgetDropDown.cpp


示例12: ProcessEvent

void ElementInfo::ProcessEvent(Core::Event& event)
{
	Core::ElementDocument::ProcessEvent(event);

	// Only process events if we're visible
	if (IsVisible())
	{
		if (event == "click")
		{
			Core::Element* target_element = event.GetTargetElement();

			// Deal with clicks on our own elements differently.
			if (target_element->GetOwnerDocument() == this)
			{
				// If it's a pane title, then we need to toggle the visibility of its sibling (the contents pane underneath it).
				if (target_element->GetTagName() == "h2")
				{
					Core::Element* panel = target_element->GetNextSibling();
					if (panel->IsVisible())
						panel->SetProperty("display", "none");
					else
						panel->SetProperty("display", "block");
					event.StopPropagation();
				}
				else if (event.GetTargetElement()->GetId() == "close_button")
				{
					if (IsVisible())
						SetProperty("visibility", "hidden");
				}
				// Check if the id is in the form "a %d" or "c %d" - these are the ancestor or child labels.
				else
				{
					int element_index;
					if (sscanf(target_element->GetId().CString(), "a %d", &element_index) == 1)
					{
						Core::Element* new_source_element = source_element;
						for (int i = 0; i < element_index; i++)
						{
							if (new_source_element != NULL)
								new_source_element = new_source_element->GetParentNode();
						}
						SetSourceElement(new_source_element);
					}
					else if (sscanf(target_element->GetId().CString(), "c %d", &element_index) == 1)
					{
						if (source_element != NULL)
							SetSourceElement(source_element->GetChild(element_index));
					}
					event.StopPropagation();
				}
			}
			// Otherwise we just want to focus on the clicked element (unless it's on a debug element)
			else if (target_element->GetOwnerDocument() != NULL && !IsDebuggerElement(target_element))
			{
				Core::Element* new_source_element = target_element;
				if (new_source_element != source_element)
				{
					SetSourceElement(new_source_element);
					event.StopPropagation();
				}
			}
		}
		else if (event == "mouseover")
		{
			Core::Element* target_element = event.GetTargetElement();

			// Deal with clicks on our own elements differently.
			Core::ElementDocument* owner_document = target_element->GetOwnerDocument();
			if (owner_document == this)
			{
				// Check if the id is in the form "a %d" or "c %d" - these are the ancestor or child labels.
				int element_index;
				if (sscanf(target_element->GetId().CString(), "a %d", &element_index) == 1)
				{
					hover_element = source_element;
					for (int i = 0; i < element_index; i++)
					{
						if (hover_element != NULL)
							hover_element = hover_element->GetParentNode();
					}
				}
				else if (sscanf(target_element->GetId().CString(), "c %d", &element_index) == 1)
				{
					if (source_element != NULL)
						hover_element = source_element->GetChild(element_index);
				}
			}
			// Otherwise we just want to focus on the clicked element (unless it's on a debug element)
			else if (owner_document != NULL && owner_document->GetId().Find("rkt-debug-") != 0)
			{
				hover_element = target_element;
			}
		}
	}
}
开发者ID:yaxinhoo,项目名称:ogrelibrocketkit,代码行数:95,代码来源:ElementInfo.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ core::FileIconProvider类代码示例发布时间:2022-05-31
下一篇:
C++ core::Element类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap