本文整理汇总了C++中DuiXmlNode::first_child方法的典型用法代码示例。如果您正苦于以下问题:C++ DuiXmlNode::first_child方法的具体用法?C++ DuiXmlNode::first_child怎么用?C++ DuiXmlNode::first_child使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DuiXmlNode
的用法示例。
在下文中一共展示了DuiXmlNode::first_child方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: Load
// 重载加载XML节点函数,判断是否有子菜单
BOOL CMenuItem::Load(DuiXmlNode pXmlElem, BOOL bLoadSubControl)
{
BOOL bRet = __super::Load(pXmlElem);
// 判断是否有定义子菜单
if(pXmlElem && (pXmlElem.first_child() != NULL))
{
m_bIsPopup = TRUE;
}
// 如果是嵌套菜单(有menu属性),则通过调用父菜单的Load函数将嵌套菜单作为平级菜单加载
CDuiMenu* pParentMenu = GetParentMenu();
if(pParentMenu && !m_strMenuXml.IsEmpty())
{
pParentMenu->LoadXmlFile(m_strMenuXml);
// 如果是嵌套菜单,则返回FALSE,这样就不会创建此菜单项,只会创建嵌套菜单中定义的菜单项
return FALSE;
}
return bRet;
}
示例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: LoadSubMenu
// 加载指定名字的菜单节点
BOOL CDuiMenu::LoadSubMenu(DuiXmlNode pXmlElem, CString strSubItemName)
{
if(pXmlElem == NULL)
{
return FALSE;
}
// 递归遍历下层节点,看是否有指定名字的节点
for (DuiXmlNode pItemElem = pXmlElem.first_child(); pItemElem; pItemElem=pItemElem.next_sibling())
{
CString strName = pItemElem.attribute(_T("name")).value();
if(strSubItemName == strName)
{
// 加载子菜单
return Load(pItemElem);
}
if(LoadSubMenu(pItemElem, strSubItemName))
{
// 如果递归加载成功则返回,否则继续向下遍历查找
return TRUE;
}
}
return FALSE;
}
示例6: Load
//.........这里部分代码省略.........
int nRightImageIndex = -1;
strRightImage = _T("");
if(strRightSkin.Find(_T(".")) != -1)
{
// 图片文件
strRightImage = strRightSkin;
}else
if(!strRightSkin.IsEmpty())
{
// 图片索引
nRightImageIndex = _ttoi(strRightSkin);
}
Color clrText = CDuiObject::StringToColor(strClrText);
InsertRow(-1, strId, nImageIndex, clrText, strImage, nRightImageIndex, strRightImage, nCheck);
int nRowIndex = m_vecRowInfo.size()-1;
int nItemIndex = 0;
// 加载下层的item节点信息
for (DuiXmlNode pItemElem = pRowElem.child(_T("item")); pItemElem; pItemElem=pItemElem.next_sibling(_T("item")))
{
CString strTitle = pItemElem.attribute(_T("title")).value();
CString strContent = pItemElem.attribute(_T("content")).value();
CString strClrText = pItemElem.attribute(_T("crtext")).value();
CString strImage = pItemElem.attribute(_T("image")).value();
CString strLink = pItemElem.attribute(_T("link")).value();
CString strLinkAction = pItemElem.attribute(_T("linkaction")).value();
CString strFontTitle = pItemElem.attribute(_T("font-title")).value();
DuiSystem::Instance()->ParseDuiString(strTitle);
DuiSystem::Instance()->ParseDuiString(strContent);
DuiSystem::Instance()->ParseDuiString(strLink);
DuiSystem::Instance()->ParseDuiString(strLinkAction);
Color clrText = CDuiObject::StringToColor(strClrText);
// 图片,通过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);
}
BOOL bUseTitleFont = (strFontTitle == _T("1"));
if(!strLink.IsEmpty())
{
SetSubItemLink(nRowIndex, nItemIndex, strLink, strLinkAction, nImageIndex, clrText, strImage);
}else
{
SetSubItem(nRowIndex, nItemIndex, strTitle, strContent, bUseTitleFont, nImageIndex, clrText, strImage);
}
// 加载下层的控件节点信息
GridItemInfo* pItemInfo = GetItemInfo(nRowIndex, nItemIndex);
for (DuiXmlNode pControlElem = pItemElem.first_child(); pControlElem; pControlElem=pControlElem.next_sibling())
{
if((pControlElem != NULL) && (pItemInfo != NULL))
{
CString strControlName = pControlElem.name();
CControlBase* pControl = _CreateControlByName(strControlName);
if(pControl)
{
pControl->Load(pControlElem);
pControl->SetVisible(FALSE);
// 将控件指针添加到gridctrl控件的子控件列表中
m_vecControl.push_back(pControl);
// 将控件指针添加到单元格的控件列表中(仅用于按照单元格查找子控件)
pItemInfo->vecControl.push_back(pControl);
}
}
}
nItemIndex++;
}
}
// 计算横向滚动条
CalcColumnsPos();
// 计算每一行的位置和滚动条
CalcRowsPos();
return TRUE;
}