本文整理汇总了C++中CGUIControlFactory类的典型用法代码示例。如果您正苦于以下问题:C++ CGUIControlFactory类的具体用法?C++ CGUIControlFactory怎么用?C++ CGUIControlFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CGUIControlFactory类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadControl
void CGUIWindow::LoadControl(TiXmlElement* pControl, CGUIControlGroup *pGroup, const CRect &rect)
{
// get control type
CGUIControlFactory factory;
CGUIControl* pGUIControl = factory.Create(GetID(), rect, pControl);
if (pGUIControl)
{
float maxX = pGUIControl->GetXPosition() + pGUIControl->GetWidth();
if (maxX > m_width)
{
m_width = maxX;
}
float maxY = pGUIControl->GetYPosition() + pGUIControl->GetHeight();
if (maxY > m_height)
{
m_height = maxY;
}
// if we are in a group, add to the group, else add to our window
if (pGroup)
pGroup->AddControl(pGUIControl);
else
AddControl(pGUIControl);
// if the new control is a group, then add it's controls
if (pGUIControl->IsGroup())
{
CGUIControlGroup *grp = (CGUIControlGroup *)pGUIControl;
TiXmlElement *pSubControl = pControl->FirstChildElement("control");
CRect grpRect(grp->GetXPosition(), grp->GetYPosition(),
grp->GetXPosition() + grp->GetWidth(), grp->GetYPosition() + grp->GetHeight());
while (pSubControl)
{
LoadControl(pSubControl, grp, grpRect);
pSubControl = pSubControl->NextSiblingElement("control");
}
}
}
}
示例2: rect
void CGUIListItemLayout::LoadControl(TiXmlElement *child, CGUIControlGroup *group)
{
if (!group) return;
CRect rect(group->GetXPosition(), group->GetYPosition(), group->GetXPosition() + group->GetWidth(), group->GetYPosition() + group->GetHeight());
CGUIControlFactory factory;
CGUIControl *control = factory.Create(0, rect, child, true); // true indicating we're inside a list for the
// different label control + defaults.
if (control)
{
group->AddControl(control);
if (control->IsGroup())
{
TiXmlElement *grandChild = child->FirstChildElement("control");
while (grandChild)
{
LoadControl(grandChild, (CGUIControlGroup *)control);
grandChild = grandChild->NextSiblingElement("control");
}
}
}
}