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


C++ CFrame::SetModal方法代码示例

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


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

示例1: HandleMessage

bool CView::HandleMessage(CMessage* pMessage)
{
	bool bHandled = false;

	if (pMessage)
	{
		switch(pMessage->MessageType())
		{
		case CMessage::APP_PAINT :
			if (pMessage->Destination() == this || pMessage->Destination() == 0)
			{
				vid_plugin->lock();
				SDL_Surface* pFloatingSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, m_pScreenSurface->w,
m_pScreenSurface->h, CApplication::Instance()->GetBitsPerPixel(), 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000);
				PaintToSurface(*m_pScreenSurface, *pFloatingSurface, CPoint(0, 0));
				// judb use entire application SDL surface (otherwise strange clipping effects occur
				// when moving frames, also clipping of listboxes.)
//				SDL_Rect SourceRect = CRect(m_WindowRect.SizeRect()).SDLRect();
				SDL_Rect SourceRect = CRect(0, 0, m_pScreenSurface->w, m_pScreenSurface->h).SDLRect();
//				SDL_Rect DestRect = CRect(m_WindowRect.SizeRect()).SDLRect();
				SDL_Rect DestRect = CRect(0, 0, m_pScreenSurface->w, m_pScreenSurface->h).SDLRect();
				SDL_BlitSurface(pFloatingSurface, &SourceRect, m_pScreenSurface, &DestRect);
				SDL_FreeSurface(pFloatingSurface);
				//SDL_UpdateRect(m_pScreenSurface, 0, 0, 0, 0);
				vid_plugin->unlock();
				vid_plugin->flip();

				bHandled = true;
			}
			break;
		case CMessage::APP_DESTROY_FRAME:
			if (pMessage->Destination() == this || pMessage->Destination() == 0)
			{
				CFrame* pFrame = dynamic_cast<CFrame*>(const_cast<CMessageClient*>(pMessage->Source()));
				if (pFrame)
				{
					pFrame->SetModal(false);
          pFrame->SetNewParent(0);
					CMessageServer::Instance().QueueMessage(new CMessage(CMessage::APP_PAINT, 0, this));
					delete pFrame;
				}
				bHandled = true;
			}
			break;
		case CMessage::CTRL_RESIZE:
		{
			TPointMessage* pResizeMessage = dynamic_cast<TPointMessage*>(pMessage);
			if (pResizeMessage && pResizeMessage->Source() == CApplication::Instance())
			{
				CWindow::SetWindowRect(CRect(m_WindowRect.TopLeft(), m_WindowRect.TopLeft() + pResizeMessage->Value()));
				Uint32 iFlags = SDL_SWSURFACE | SDL_ANYFORMAT;
				if(m_bResizable)
				{
					iFlags |= SDL_RESIZABLE;
				}

				m_ClientRect = CRect(m_ClientRect.Left(), m_ClientRect.Top(), m_WindowRect.Width(), m_WindowRect.Height());
				m_ClientRect.ClipTo(m_WindowRect.SizeRect());

				m_pScreenSurface = SDL_SetVideoMode(m_WindowRect.Width(), m_WindowRect.Height(), DEFAULT_BPP, iFlags);
				if (m_pScreenSurface == NULL)
					throw( Wg_Ex_SDL(std::string("Could not set video mode : ") + SDL_GetError()) );

				bHandled = true;
			}
			break;
		}
		case CMessage::MOUSE_BUTTONDOWN:
		{
			CMouseMessage* pMouseMessage = dynamic_cast<CMouseMessage*>(pMessage);
			if (pMouseMessage && m_WindowRect.HitTest(pMouseMessage->Point) == CRect::RELPOS_INSIDE)
			{
				if (!m_pFloatingWindow || !m_pFloatingWindow->OnMouseButtonDown(pMouseMessage->Point, pMouseMessage->Button))
				{
					if (pMouseMessage->Destination() == 0)
					{
						OnMouseButtonDown(pMouseMessage->Point, pMouseMessage->Button);
					}
					else if (dynamic_cast<const CWindow*>(pMouseMessage->Destination()))
					{
						const_cast<CWindow*>(static_cast<const CWindow*>(pMouseMessage->Destination()))->
							OnMouseButtonDown(pMouseMessage->Point, pMouseMessage->Button);
					}
				}
			}
			break;
		}
		case CMessage::MOUSE_BUTTONUP:
		{
			CMouseMessage* pMouseMessage = dynamic_cast<CMouseMessage*>(pMessage);
			if (pMouseMessage && m_WindowRect.HitTest(pMouseMessage->Point) == CRect::RELPOS_INSIDE)
			{
				if (!m_pFloatingWindow || !m_pFloatingWindow->OnMouseButtonUp(pMouseMessage->Point, pMouseMessage->Button))
				{
					if (pMouseMessage->Destination() == 0)
					{
						OnMouseButtonUp(pMouseMessage->Point, pMouseMessage->Button);
					}
					else if (dynamic_cast<const CWindow*>(pMouseMessage->Destination()))
					{
//.........这里部分代码省略.........
开发者ID:Mokona,项目名称:caprice32,代码行数:101,代码来源:wg_view.cpp


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