GUIFooter::GUIFooter()
: GUIControlContainer()
{
	int32 h = GUISystem::Instance()->GetSkin()->GetSprite(EDT_FOOTER_BUTTON_LEFT, GUISkinLocal::ESSH3_CENTER)->GetHeight();
	ControlRect r(0, GetApplication()->GetGraphicsSystem()->GetHeight() - h
		, GetApplication()->GetGraphicsSystem()->GetWidth()
		, h);
	SetControlRect(r);
	SetID(ECIDS_FOOTER_ID);
	SetStretch(ECS_STRETCH);

	GUILayoutBox *layout = new GUILayoutBox(false, this);

	GUIText *text = new GUIText((char16*)L" ", layout);
	text->SetID(ECIDS_FOOTER_ID + 1);
	text->SetDrawType(EDT_FOOTER_BUTTON_LEFT);

	text = new GUIText((char16*)L" ", layout);
	text->SetID(ECIDS_FOOTER_ID + 2);
	text->SetDrawType(EDT_FOOTER_BUTTON_RIGHT);

}
Exemple #2
0
void CControlBase::SetRect(CRect rc)
{ 
	CRect rcAll = m_rc | rc;
	SetControlRect(rc);
	UpdateControl(rcAll, m_bIsVisible, true);
}
Exemple #3
0
// 设置菜单项位置
void CDuiMenu::SetMenuPoint()
{
	int nXPos = 2;
	int nYPos = (m_nTopHeight != 0) ? m_nTopHeight : 2;
	CRect rc;
	for (size_t i = 0; i < m_vecControl.size(); i++)
	{
		CControlBase * pControlBase = m_vecControl[i];
		if(pControlBase == NULL)
		{
			continue;
		}
		if(pControlBase->IsClass(CMenuItem::GetClassName()))	// 如果是MenuItem类型控件
		{
			CMenuItem* pMenuItem = (CMenuItem*)pControlBase;
			pMenuItem->SetFrameWidth(m_nFrameWidth);
			if(!pMenuItem->GetVisible())
			{
				// 菜单项不可见
				rc.SetRect(0,0,0,0);
			}else
			if(pMenuItem->IsSeparator())
			{
				// 分隔线
				rc.SetRect(m_nLeft + 1, nYPos + 1, m_nWidth - 1, nYPos + 2);
				nYPos += 4;
			}else
			{
				// 普通菜单项
				rc.SetRect(nXPos, nYPos, m_nWidth - 2, nYPos + m_nHeight);
				nYPos += m_nHeight;
				// 设置菜单项的鼠标移动时候的背景
				if(m_pImageRowHover != NULL)
				{
					pMenuItem->m_pImageHover = m_pImageRowHover;
					pMenuItem->m_sizeHover = m_sizeRowHover;
				}else
				{
					pMenuItem->m_clrHover = m_clrRowHover;	// 设置菜单项的背景色
				}
				// 设置菜单项的弹出菜单箭头图片
				if(m_pImagePopupArrow != NULL)
				{
					pMenuItem->m_pImagePopupArrow = m_pImagePopupArrow;
					pMenuItem->m_sizePopupArrow = m_sizePopupArrow;
				}
			}
			SetControlRect(pControlBase, rc);
		}else
		if(-1 == pControlBase->GetControlID())
		{
			rc.SetRect(m_nLeft + 4, nYPos + 1, m_nWidth - 9, nYPos + 2);
			nYPos += 4;
			SetControlRect(pControlBase, rc);
		}
	}
	nYPos += ((m_nBottomHeight != 0) ? m_nBottomHeight : 2);
	SetWindowPos(NULL, 0, 0, m_nWidth, nYPos, SWP_NOMOVE);
	SetRect(CRect(0, 0, m_nWidth, nYPos));	// 设置菜单窗口的大小

	// 设置非菜单项控件的位置(必须在高度计算出来之后设置)
	for (size_t i = 0; i < m_vecControl.size(); i++)
	{
		CControlBase * pControlBase = m_vecControl[i];
		if(pControlBase == NULL)
		{
			continue;
		}
		if(pControlBase->IsClass(CMenuItem::GetClassName()))
		{
			continue;
		}else
		if(-1 == pControlBase->GetControlID())
		{
			continue;
		}else
		{
			pControlBase->OnAttributePosChange(pControlBase->GetPosStr(), FALSE);
		}
	}

	InvalidateRect(NULL);
}