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


C++ HeeksObj::OneOfAKind方法代码示例

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


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

示例1: OnMouse

void CTreeCanvas::OnMouse( wxMouseEvent& event )
{
	if(wxGetApp().m_property_grid_validation)return;

	if(event.Entering()){
		SetFocus(); // so middle wheel works
	}

	if(event.LeftDown())
	{
		const CTreeButton* button = HitTest(event.GetPosition());

		if(button)
		{
			switch(button->type)
			{
			case ButtonTypePlus:
			case ButtonTypeMinus:
				SetExpanded(button->obj, button->type == 0);
				SetVirtualSize(GetRenderSize());
				this->Refresh();
				break;

			case ButtonTypeLabelBefore:
			case ButtonTypeLabel:
			default:
				OnLabelLeftDown(button->obj, event);
				clicked_object = button->obj;
				break;
			}
		}
		else
		{
			wxGetApp().m_marked_list->Clear(true);
		}

		m_button_down_point = event.GetPosition();
	}

	if(event.LeftUp())
	{
		if(m_dragging)
		{
			m_dragging = false;

			// find the object to drop on to
			const CTreeButton* button = HitTest(event.GetPosition());

			if(button == NULL || !wxGetApp().m_marked_list->ObjectMarked(button->obj)) // can only drop on to an item other than one of the items being dragged
			{
				// test drop possible
				bool drag_possible = true;

				HeeksObj* add_to = &wxGetApp();
				if(button && button->paste_into)add_to = button->paste_into;
				for(std::list<HeeksObj*>::iterator It = m_dragged_list.begin(); It != m_dragged_list.end(); It++)
				{
					HeeksObj* object = *It;

					if(!add_to->CanAdd(object) || !object->CanAddTo(add_to))
					{
						drag_possible = false;
						break;
					}
				}

				if(drag_possible)
				{
					wxGetApp().CreateUndoPoint();

					// cut the objects
					wxGetApp().Remove(m_dragged_list);

					// paste the objects
					for(std::list<HeeksObj*>::iterator It = m_dragged_list.begin(); It != m_dragged_list.end(); It++)
					{
						HeeksObj* object = *It;
						{
							if(object->OneOfAKind())
							{
								bool one_found = false;
								for(HeeksObj* child = add_to->GetFirstChild(); child; child = add_to->GetNextChild())
								{
									if(child->GetType() == object->GetType())
									{
										child->CopyFrom(object);
										one_found = true;
										break;
									}
								}
								if(!one_found)
								{
									add_to->Add(object, button ? button->paste_before : NULL);
								}
							}
							else
							{
								add_to->Add(object, button ? button->paste_before : NULL);
							}
						}
//.........这里部分代码省略.........
开发者ID:CarlosGS,项目名称:heekscad,代码行数:101,代码来源:TreeCanvas.cpp


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