Exemple #1
0
	//************************************
	// 函数名称: Invalidate
	// 返回类型: void
	// 函数说明: 
	//************************************
	void CTreeNodeUI::Invalidate()
	{
		if( !IsVisible() )
			return;

		if( GetParent() ) {
			CContainerUI* pParentContainer = static_cast<CContainerUI*>(GetParent()->GetInterface(_T("Container")));
			if( pParentContainer ) {
				RECT rc = pParentContainer->GetPos();
				RECT rcInset = pParentContainer->GetInset();
				rc.left += rcInset.left;
				rc.top += rcInset.top;
				rc.right -= rcInset.right;
				rc.bottom -= rcInset.bottom;
				CScrollBarUI* pVerticalScrollBar = pParentContainer->GetVerticalScrollBar();
				if( pVerticalScrollBar && pVerticalScrollBar->IsVisible() ) rc.right -= pVerticalScrollBar->GetFixedWidth();
				CScrollBarUI* pHorizontalScrollBar = pParentContainer->GetHorizontalScrollBar();
				if( pHorizontalScrollBar && pHorizontalScrollBar->IsVisible() ) rc.bottom -= pHorizontalScrollBar->GetFixedHeight();

				RECT invalidateRc = m_rcItem;
				if( !::IntersectRect(&invalidateRc, &m_rcItem, &rc) ) 
					return;

				CControlUI* pParent = GetParent();
				RECT rcTemp;
				RECT rcParent;
				while( pParent = pParent->GetParent() )
				{
					rcTemp = invalidateRc;
					rcParent = pParent->GetPos();
					if( !::IntersectRect(&invalidateRc, &rcTemp, &rcParent) ) 
						return;
				}

				if( m_pManager != NULL ) m_pManager->Invalidate(invalidateRc);
			}
			else {
				CContainerUI::Invalidate();
			}
		}
		else {
			CContainerUI::Invalidate();
		}
	}
Exemple #2
0
UINT CMessageDialog::DuiMessageBox(CFrameWnd *pMainWnd, LPCTSTR lpText, LPCTSTR lpCaption ,UINT uType, UINT uIcon)
{
	m_pMainWnd = pMainWnd;
	m_strXMLPath = _T("xmls\\MessageBoxDialog.xml");
	Create(m_pMainWnd->GetHWND(), _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);

	if ( uType == MB_OK)
	{
		if ( m_pButtonCancel != NULL )
		{
			m_pButtonCancel->SetVisible(false);
		}

	}
	else if( uType == MB_OKCANCEL )
	{	
		//保持默认xml配置
	}
	else
		return 0;

	CContainerUI* pTextLayout = static_cast<CContainerUI*>(m_pm.FindControl(_T("TextLayout")));
	if (pTextLayout != NULL)
	{
		switch(uIcon)
		{
		case MB_ICONASTERISK:
			{
				pTextLayout->SetBkImage(_T("file='UI\\MessageDialog\\BK.png' source='222,0,333,120' corner='111,0,0,0'"));
				break;
			}
		case MB_ICONQUESTION:
			{
				pTextLayout->SetBkImage(_T("file='UI\\MessageDialog\\BK.png' source='111,0,222,120' corner='111,0,0,0'"));
				break;
			}
		case MB_ICONWARNING:
			{
				pTextLayout->SetBkImage(_T("file='UI\\MessageDialog\\BK.png' source='0,0,111,120' corner='111,0,0,0'"));
				break;
			}
		case MB_ICONERROR:
			{
				pTextLayout->SetBkImage(_T("file='UI\\MessageDialog\\BK.png' source='222,0,333,120' corner='111,0,0,0'"));
				break;
			}
		default:
			break;				
		}
	}

	CTextUI* pCaption_control = static_cast<CTextUI*>(m_pm.FindControl( _T("caption")));
	if (pCaption_control != NULL)
	{
		pCaption_control->SetText(lpCaption);
	}

	CTextUI* pText_control = static_cast<CTextUI*>(m_pm.FindControl( _T("text")));
	if (pText_control != NULL)
	{
		SIZE m_szClient = m_pm.GetClientSize();
		int nCTextUIWidth = m_szClient.cx - pTextLayout->GetChildPadding() - pTextLayout->GetInset().left - 15;
		pText_control->SetText(lpText);
		RECT rect;
		GetClientRect(m_hWnd, &rect);
		SIZE szSpace = { 0 };
		HFONT hOldFont =(HFONT)::SelectObject(m_pm.GetPaintDC(),m_pm.GetFont(0));
		::GetTextExtentPoint32(m_pm.GetPaintDC(), lpText, _tcslen(lpText), &szSpace);
		::SelectObject(m_pm.GetPaintDC(),(HGDIOBJ)hOldFont);
		rect.right = rect.right + szSpace.cx - nCTextUIWidth;
		if((rect.right - rect.left) < m_szClient.cx )
			rect.right = rect.left + m_szClient.cx;
		SetWindowPos (m_hWnd, NULL, rect.left, rect.top, rect.right , rect.bottom, SWP_SHOWWINDOW );

	}

	CenterWindow();
	UINT uRet = ShowModal();
	return uRet;
}
Exemple #3
0
//道具栏UI位置匹配
void CRightFrame::FixPropUI(int cx,int cy)
{
	if (cy <= 0)
	{
		return;
	}

	//匹配用户信息栏位置////////////////////////////////////////////////////////////////////////////////
	CContainerUI* pInfoLeft = static_cast<CContainerUI*>(m_pm.FindControl("Info_Ctn_Left"));
	if (pInfoLeft)
	{
		pInfoLeft->SetFixedWidth(cx <= 300 ? 5 : 100);
	}

	//匹配道具栏的位置///////////////////////////////////////////////////////////////////////////////////

	CContainerUI* pPropMainCtn = static_cast<CContainerUI*>(m_pm.FindControl("Prop_Ctn_Main"));
	if (pPropMainCtn)
	{
		RECT rcWnd;
		::GetWindowRect(m_hWnd,&rcWnd);

		int iWidth = rcWnd.right - rcWnd.left - 50 - 34;

		const int iSpace = 4;
		const int iHorMums = iWidth / (34 + iSpace) + 1;
		m_uPropPageSize = iHorMums * 2;
		int iCount = 0;

		//计算页数
		m_uPropPageNums = (MAX_PROP_NUMS % m_uPropPageSize) == 0 ? 
			MAX_PROP_NUMS / m_uPropPageSize : MAX_PROP_NUMS / m_uPropPageSize + 1;

		for (int iPage = 0; iPage < m_uPropPageNums; ++iPage)
		{
			for (int iCol = 0; iCol < 2; ++iCol)
			{
				for (int iRow = 0; iRow < iHorMums; ++iRow)
				{
					if (iCount < MAX_PROP_NUMS)
					{
						SIZE sz = {(34 + 4) * iRow,15 + (34 + 4) * iCol};	
						m_pPropBtn[iCount++]->SetFixedXY(sz);
					}
				}
			}
		}

		//每次重定位后,都显示第一页
		ShowPropPage(0);

	}

	//匹配聊天框的位置///////////////////////////////////////////////////////////////////////////////////

	int x = 0,y = 0,width = 0,height = 0;

	CContainerUI* pCtrl = NULL;
	
	pCtrl = static_cast<CContainerUI*>(m_pm.FindControl("Hor_Talk"));
	x += pCtrl ? pCtrl->GetInset().left : 0;

	pCtrl = static_cast<CContainerUI*>(m_pm.FindControl("Ctn_Talk_Main"));
	x += pCtrl ? pCtrl->GetInset().left : 0;


	pCtrl = static_cast<CContainerUI*>(m_pm.FindControl("Hor_Info"));
	y += pCtrl ? pCtrl->GetFixedHeight() : 0;

	pCtrl = static_cast<CContainerUI*>(m_pm.FindControl("Hor_UserList"));
	y += pCtrl ? pCtrl->GetFixedHeight() : 0;

	pCtrl = static_cast<CContainerUI*>(m_pm.FindControl("Hor_Prop"));
	y += pCtrl ? pCtrl->GetFixedHeight() : 0;

	pCtrl = static_cast<CContainerUI*>(m_pm.FindControl("Hor_Talk"));
	y += pCtrl ? pCtrl->GetInset().top : 0;

	pCtrl = static_cast<CContainerUI*>(m_pm.FindControl("Ctn_Talk_Main"));
	y += pCtrl ? pCtrl->GetInset().top : 0;


	width = cx - x;

	pCtrl = static_cast<CContainerUI*>(m_pm.FindControl("Hor_Talk"));
	width -= pCtrl ? pCtrl->GetInset().right : 0;

	pCtrl = static_cast<CContainerUI*>(m_pm.FindControl("Ctn_Talk_Main"));
	width -= pCtrl ? pCtrl->GetInset().right : 0;


	height = cy - y;

	pCtrl = static_cast<CContainerUI*>(m_pm.FindControl("Hor_Talk"));
	height -= pCtrl ? pCtrl->GetInset().bottom : 0;

	pCtrl = static_cast<CContainerUI*>(m_pm.FindControl("Hor_Talk_Control"));
	height -= pCtrl ? pCtrl->GetFixedHeight() : 0;

	pCtrl = static_cast<CContainerUI*>(m_pm.FindControl("Ctn_Talk_Main"));
	height -= pCtrl ? pCtrl->GetInset().bottom : 0; 

	//调整聊天输入框位置//////////////////////////////////////////////////////////////////////////////////////////

	width = cx;

	pCtrl = static_cast<CContainerUI*>(m_pm.FindControl("Hor_Talk"));
	width -= pCtrl ? pCtrl->GetInset().left : 0;
	width -= pCtrl ? pCtrl->GetInset().right : 0;

	pCtrl = static_cast<CContainerUI*>(m_pm.FindControl("Hor_Talk_Control"));
	width -= pCtrl ? pCtrl->GetInset().left : 0;
	width -= pCtrl ? pCtrl->GetInset().right : 0;

	pCtrl = static_cast<CContainerUI*>(m_pm.FindControl("Talk_Ctn_01"));
	width -= pCtrl ? pCtrl->GetFixedWidth() : 0;

	pCtrl = static_cast<CContainerUI*>(m_pm.FindControl("Talk_Ctn_02"));
	width -= pCtrl ? pCtrl->GetFixedWidth() : 0;

	pCtrl = static_cast<CContainerUI*>(m_pm.FindControl("Talk_Ctn_04"));
	width -= pCtrl ? pCtrl->GetFixedWidth() : 0;

	pCtrl = static_cast<CContainerUI*>(m_pm.FindControl("Talk_Ctn_05"));
	width -= pCtrl ? pCtrl->GetFixedWidth() : 0;

	pCtrl = static_cast<CContainerUI*>(m_pm.FindControl("Talk_Ctn_03"));
	width -= pCtrl ? pCtrl->GetInset().left : 0;
	width -= pCtrl ? pCtrl->GetInset().right : 0;


	CEditUI* pEdtCtrl = static_cast<CEditUI*>(m_pm.FindControl("Talk_Edt_Inp"));
	if (pEdtCtrl)
	{
		pEdtCtrl->SetFixedWidth(width - 30);
	}


	return;
}