本文整理汇总了C++中CControlBase::Load方法的典型用法代码示例。如果您正苦于以下问题:C++ CControlBase::Load方法的具体用法?C++ CControlBase::Load怎么用?C++ CControlBase::Load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CControlBase
的用法示例。
在下文中一共展示了CControlBase::Load方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitUI
// 初始化窗口控件
void CDuiPanel::InitUI(CRect rcClient, DuiXmlNode pNode)
{
CRect rcTemp;
int nStartX = 0;
int nStartY = 0;
CControlBase * pControlBase = NULL;
// 加载所有窗口控件
if(pNode)
{
m_nVirtualHeight = 0;
m_nVirtualWidth = 0;
for (DuiXmlNode pControlElem = pNode.first_child(); pControlElem; pControlElem=pControlElem.next_sibling())
{
if(pControlElem != NULL)
{
CString strControlName = pControlElem.name();
CControlBase* pControl = _CreateControlByName(strControlName);
if(pControl)
{
pControl->Load(pControlElem);
if(pControl->IsClass(CArea::GetClassName()))
{
// Area不能响应鼠标,必须加到Area列表中
m_vecArea.push_back(pControl);
}else
{
m_vecControl.push_back(pControl);
}
CRect rcCtrl = pControl->GetRect();
if(rcCtrl.bottom > m_nVirtualHeight)
{
m_nVirtualHeight = rcCtrl.bottom - m_rc.top;
}
if(rcCtrl.right > m_nVirtualWidth)
{
m_nVirtualWidth = rcCtrl.right - m_rc.left;
}
}
}
}
// 需要的总高度大于显示区高度才会显示垂直滚动条
m_pControScrollV->SetVisible(m_nVirtualHeight > m_rc.Height());
((CDuiScrollVertical*)m_pControScrollV)->SetScrollMaxRange(m_nVirtualHeight);
// 需要的总宽度大于显示区宽度才会显示垂直滚动条
m_pControScrollH->SetVisible(m_nVirtualWidth > m_rc.Width());
((CDuiScrollHorizontal*)m_pControScrollH)->SetScrollMaxRange(m_nVirtualWidth);
}
m_bInit = true;
}
示例2: LoadXmlNode
// 加载XML节点中定义的菜单和其他控件
BOOL CDuiMenu::LoadXmlNode(TiXmlElement* pXmlElem, CString strXmlFile)
{
if(pXmlElem == NULL)
{
return FALSE;
}
TiXmlElement* pControlElem = NULL;
for (pControlElem = pXmlElem->FirstChildElement(); pControlElem != NULL; pControlElem=pControlElem->NextSiblingElement())
{
if(pControlElem != NULL)
{
CStringA strControlName = pControlElem->Value();
CControlBase* pControl = _CreateControlByName(strControlName);
if(pControl)
{
if(pControl->Load(pControlElem))
{
// 如果Load成功,则添加控件
if(pControl->IsClass(CArea::GetClassName()) || pControl->IsClass(CFrame::GetClassName()))
{
// Area和Frame不能响应鼠标,必须加到Area列表中
m_vecArea.push_back(pControl);
}else
{
m_vecControl.push_back(pControl);
}
// 如果是菜单项控件,则设置菜单项的菜单XML属性
if(pControl->IsClass(CMenuItem::GetClassName()))
{
((CMenuItem*)pControl)->SetMenuXml(strXmlFile);
}
}else
{
// 否则直接删除控件对象指针
delete pControl;
}
}
}
}
return TRUE;
}
示例3: InitUI
// 初始化窗口控件
void CDlgPopup::InitUI(CRect rcClient, DuiXmlNode pNode)
{
CRect rcTemp;
int nStartX = 0;
int nStartY = 0;
CControlBase * pControlBase = NULL;
// 加载所有窗口控件
if(pNode)
{
for (DuiXmlNode pControlElem = pNode.first_child(); pControlElem; pControlElem=pControlElem.next_sibling())
{
if(pControlElem)
{
CString strControlName = pControlElem.name();
CControlBase* pControl = _CreateControlByName(strControlName);
if(pControl)
{
if(pControl->Load(pControlElem))
{
// 如果Load成功,则添加控件
if(pControl->IsClass(CArea::GetClassName()) || pControl->IsClass(CFrame::GetClassName()))
{
// Area和Frame不能响应鼠标,必须加到Area列表中
m_vecArea.push_back(pControl);
}else
{
m_vecControl.push_back(pControl);
}
}else
{
// 否则直接删除控件对象指针
delete pControl;
}
}
}
}
}
m_bInit = true;
}
示例4: LoadXmlNode
// 加载XML节点中定义的菜单和其他控件
BOOL CDuiMenu::LoadXmlNode(DuiXmlNode pXmlElem, CString strXmlFile)
{
if(pXmlElem == NULL)
{
return FALSE;
}
for (DuiXmlNode pControlElem = pXmlElem.first_child(); pControlElem; pControlElem=pControlElem.next_sibling())
{
CString strControlName = pControlElem.name();
CControlBase* pControl = _CreateControlByName(strControlName);
if(pControl)
{
if(pControl->Load(pControlElem))
{
// 如果Load成功,则添加控件
if(pControl->IsClass(CArea::GetClassName()) || pControl->IsClass(CDuiFrame::GetClassName()))
{
// Area和Frame不能响应鼠标,必须加到Area列表中
m_vecArea.push_back(pControl);
}else
{
m_vecControl.push_back(pControl);
}
// 如果是菜单项控件,则设置菜单项的菜单XML属性
if(pControl->IsClass(CMenuItem::GetClassName()))
{
((CMenuItem*)pControl)->SetMenuXml(strXmlFile);
}
}else
{
// 否则直接删除控件对象指针
delete pControl;
}
}
}
return TRUE;
}
示例5: Load
// 加载XML节点,解析节点中的属性信息设置到当前控件的属性中
BOOL CDuiGridCtrl::Load(DuiXmlNode pXmlElem, BOOL bLoadSubControl)
{
if(!__super::Load(pXmlElem))
{
return FALSE;
}
// 使用XML节点初始化div控件
if(pXmlElem != NULL)
{
InitUI(m_rc, pXmlElem);
}
// 加载下层的cloumn节点信息
for (DuiXmlNode pColumnElem = pXmlElem.child(_T("column")); pColumnElem; pColumnElem=pColumnElem.next_sibling(_T("column")))
{
CString strTitle = pColumnElem.attribute(_T("title")).value();
CString strClrText = pColumnElem.attribute(_T("crtext")).value();
CString strWidth = pColumnElem.attribute(_T("width")).value();
CString strAlign = pColumnElem.attribute(_T("align")).value();
CString strVAlign = pColumnElem.attribute(_T("valign")).value();
DuiSystem::Instance()->ParseDuiString(strTitle);
Color clrText = Color(0, 0, 0, 0);
if(!strClrText.IsEmpty())
{
clrText = CDuiObject::StringToColor(strClrText);
}
int nWidth = -1;
if(!strWidth.IsEmpty())
{
nWidth = _ttoi(strWidth);
}
UINT uAlignment = 0xFFFFUL;
if(strAlign == _T("left"))
{
uAlignment = Align_Left;
}else
if(strAlign ==_T("center"))
{
uAlignment = Align_Center;
}else
if(strAlign == _T("right"))
{
uAlignment = Align_Right;
}
UINT uVAlignment = 0xFFFFUL;
if(strVAlign == _T("top"))
{
uVAlignment = VAlign_Top;
}else
if(strVAlign == _T("middle"))
{
uVAlignment = VAlign_Middle;
}else
if(strVAlign == _T("bottom"))
{
uVAlignment = VAlign_Bottom;
}
InsertColumn(-1, strTitle, nWidth, clrText, uAlignment, uVAlignment);
}
// 加载下层的row节点信息
for (DuiXmlNode pRowElem = pXmlElem.child(_T("row")); pRowElem; pRowElem=pRowElem.next_sibling(_T("row")))
{
CString strId = pRowElem.attribute(_T("id")).value();
CString strCheck = pRowElem.attribute(_T("check")).value();
CString strImage = pRowElem.attribute(_T("image")).value();
CString strRightImage = pRowElem.attribute(_T("right-img")).value();
CString strClrText = pRowElem.attribute(_T("crtext")).value();
int nCheck = -1;
if(!strCheck.IsEmpty())
{
nCheck = _ttoi(strCheck);
}
// 左边图片,通过Skin读取
CString strSkin = _T("");
if(strImage.Find(_T("skin:")) == 0)
{
strSkin = DuiSystem::Instance()->GetSkin(strImage);
}else
{
strSkin = strImage;
}
int nImageIndex = -1;
strImage = _T("");
if(strSkin.Find(_T(".")) != -1)
{
// 图片文件
strImage = strSkin;
}else
if(!strSkin.IsEmpty())
{
// 图片索引
nImageIndex = _ttoi(strSkin);
}
//.........这里部分代码省略.........