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


C++ Window::setClippedByParent方法代码示例

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


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

示例1: OnCreateNewWindow

//通知创建一个新窗口
BOOL CDataPool::OnCreateNewWindow(CEGUI::Window* pWinParent)
{
	CEGUI::Window* pWindow = NULL;
	if (m_szCreateWindowType.IsEmpty())
	{
		g_pEditorView->setCreateWindowFlag(false);
		g_pEditorView->setCreateWindow(NULL);
		return FALSE;
	}

	////显示名字对话框
	//CCreateWindowDlg dlg(pWinParent == NULL);
	//if (dlg.DoModal() == IDCANCEL)
	//{
	//	return FALSE;
	//}


	//CString name ;
	//name = dlg.m_szDefaultName;

	//if (name.IsEmpty())
	//{
	//	g_pEditorView->setCreateWindowFlag(false);
	//	g_pEditorView->setCreateWindow(NULL);
	//	return FALSE;
	//}

	//创建窗口
	try
	{
		pWindow = WindowManager::getSingleton().createWindow(m_szCreateWindowType.GetString()/*, name.GetString()*/);
		pWindow->setClippedByParent(true);
		//pWindow->setPosition(CEGUI::Absolute, Point(0,0));
		pWindow->setSize(CEGUI::Absolute, Size(100,100));
		if (pWinParent == NULL)
		{
			System::getSingleton().getGUISheet()->addChildWindow(pWindow);
			g_leftTreeWindow->InsertItemToTree(pWindow->getName().c_str(), NULL);
		}
		else
		{
			pWinParent->addChildWindow(pWindow);
			CString szParentPath = GetParentTreePath(pWindow);
			g_leftTreeWindow->InsertItemToTree(pWindow->getName().c_str(), szParentPath);
		}
		g_pEditorView->setCreateWindow(pWindow);
		return TRUE;
	}
	catch (...)
	{
		MessageBox(AfxGetMainWnd()->GetSafeHwnd(), "创建窗口出现未知错误", "提示", MB_OK);
	}
	return FALSE;
}
开发者ID:jjiezheng,项目名称:pap_full,代码行数:56,代码来源:DataPool.cpp

示例2: moveWindow

//只改变位置不改变大小
void CUIEditorView::moveWindow(CPoint point,CPoint step,CEGUI::Window* pWin/* = NULL*/)
{
	CEGUI::Window* pWindow =  pWin ? pWin : m_pSelectedWindow;
	if (pWindow)
	{
		//方向键操作
		if ( step.x != 0 || step.y != 0 )
		{
			CEGUI::Point pos = pWindow->getAbsolutePosition();
			pos.d_x += step.x;
			pos.d_y += step.y;
			pWindow->setPosition(CEGUI::Absolute, pos);
		}
		//鼠标操作
		else
		{
			CEGUI::Window* pParent = pWindow;
			CEGUI::Point pt = CEGUI::Point(point.x, point.y);
			if (pWindow->getParent() == CEGUI::System::getSingleton().getGUISheet())
			{
				pParent = pWindow->getParent();
				CEGUI::Point pointWindow = pWindow->getPixelRect().getPosition();
				//初始化位置
				if(m_ptMouseMovePos.x == 0 && m_ptMouseMovePos.y == 0)
				{
					m_ptMouseMovePos.x = point.x -  pointWindow.d_x;
					m_ptMouseMovePos.y = point.y -  pointWindow.d_y;
				}
				pt.d_x -= m_ptMouseMovePos.x;
				pt.d_y -= m_ptMouseMovePos.y;
			}
			else
			{
				while (pParent && pParent->getParent() != CEGUI::System::getSingleton().getGUISheet())
				{
					pParent = pParent->getParent();
				}
				CEGUI::Point pointParent = pParent->getPixelRect().getPosition();
				CEGUI::Point pointWindow = pWindow->getPixelRect().getPosition();
				//初始化位置
				if(m_ptMouseMovePos.x == 0 && m_ptMouseMovePos.y == 0)
				{
					m_ptMouseMovePos.x = point.x -  pointWindow.d_x;
					m_ptMouseMovePos.y = point.y -  pointWindow.d_y;
				}
				pt = CEGUI::Point(point.x-pointParent.d_x /*+pointWindow.d_x*/ - m_ptMouseMovePos.x, 
					point.y - pointParent.d_y/* +pointWindow.d_y*/ - m_ptMouseMovePos.y);
			}
			pWindow->setClippedByParent(true);
			pWindow->setPosition(CEGUI::Absolute, pt);
		}
	}
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:54,代码来源:UIEditorView.cpp

示例3: sizingWindow

//只改变大小,不改变位置
void CUIEditorView::sizingWindow(CPoint point,INT type,CEGUI::Window* pWin/* = NULL*/)
{
	CEGUI::Window* pWindow =  pWin ? pWin : m_pSelectedWindow;
	if (pWindow)
	{
		CEGUI::Window* pParent = pWindow;
		CEGUI::Size pt(0,0);
		if (pWindow->getParent() == CEGUI::System::getSingleton().getGUISheet())
		{
			CEGUI::Point pos = pWindow->getPixelRect().getPosition();
			pt = CEGUI::Size(point.x - pos.d_x, point.y - pos.d_y);
		}
		else
		{
			while (pParent && pParent->getParent() != CEGUI::System::getSingleton().getGUISheet())
			{
				pParent = pParent->getParent();
			}
			CEGUI::Rect	 rectWindow = pWindow->getPixelRect();
			pt = CEGUI::Size(point.x -rectWindow.getPosition().d_x   ,point.y -rectWindow.getPosition().d_y);
		}
		pWindow->setClippedByParent(true);
		if(type == 0)
		{
			pWindow->setHeight(CEGUI::Absolute,pt.d_height);
		}
		else if (type == 1)
		{
			pWindow->setWidth(CEGUI::Absolute,pt.d_width);
		}
		else
		{
			pWindow->setSize(CEGUI::Absolute, pt);
		}
	}
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:37,代码来源:UIEditorView.cpp


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