本文整理汇总了C++中CGUIControl::IsGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIControl::IsGroup方法的具体用法?C++ CGUIControl::IsGroup怎么用?C++ CGUIControl::IsGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIControl
的用法示例。
在下文中一共展示了CGUIControl::IsGroup方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InsertControl
bool CGUIControlGroup::InsertControl(CGUIControl *control, const CGUIControl *insertPoint)
{
// find our position
for (unsigned int i = 0; i < m_children.size(); i++)
{
CGUIControl *child = m_children[i];
if (child->IsGroup() && ((CGUIControlGroup *)child)->InsertControl(control, insertPoint))
return true;
else if (child == insertPoint)
{
AddControl(control, i);
return true;
}
}
return false;
}
示例2: RemoveControl
// Note: This routine doesn't delete the control. It just removes it from the control list
bool CGUIControlGroup::RemoveControl(const CGUIControl *control)
{
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIControl *child = *it;
if (child->IsGroup() && ((CGUIControlGroup *)child)->RemoveControl(control))
return true;
if (control == child)
{
m_children.erase(it);
RemoveLookup(child);
return true;
}
}
return false;
}
示例3:
// in the case of id == 0, we don't match id
CGUIControl *CGUIControlGroup::GetFirstFocusableControl(int id)
{
if (!CanFocus()) return NULL;
if (id && id == (int) GetID()) return this; // we're focusable and they want us
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIControl* pControl = *it;
if (pControl->IsGroup())
{
CGUIControlGroup *group = (CGUIControlGroup *)pControl;
CGUIControl *control = group->GetFirstFocusableControl(id);
if (control) return control;
}
if ((!id || (int) pControl->GetID() == id) && pControl->CanFocus())
return pControl;
}
return NULL;
}
示例4: LoadControl
void CGUIWindow::LoadControl(TiXmlElement* pControl, CGUIControlGroup *pGroup)
{
// get control type
CGUIControlFactory factory;
CRect rect(0, 0, (float)m_coordsRes.iWidth, (float)m_coordsRes.iHeight);
if (pGroup)
{
rect.x1 = pGroup->GetXPosition();
rect.y1 = pGroup->GetYPosition();
rect.x2 = rect.x1 + pGroup->GetWidth();
rect.y2 = rect.y1 + pGroup->GetHeight();
}
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())
{
TiXmlElement *pSubControl = pControl->FirstChildElement("control");
while (pSubControl)
{
LoadControl(pSubControl, (CGUIControlGroup *)pGUIControl);
pSubControl = pSubControl->NextSiblingElement("control");
}
}
}
}
示例5: RemoveControl
// Note: This routine doesn't delete the control. It just removes it from the control list
bool CGUIControlGroup::RemoveControl(int id)
{
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIControl *control = *it;
if (control->IsGroup())
{
CGUIControlGroup *group = (CGUIControlGroup *)control;
if (group->RemoveControl(id))
return true;
}
if ((int) control->GetID() == id)
{
m_children.erase(it);
return true;
}
}
return false;
}
示例6: ControlGroupHasFocus
// returns true if the control group with id groupID has controlID as
// its focused control
bool CGUIWindow::ControlGroupHasFocus(int groupID, int controlID)
{
// 1. Run through and get control with groupID (assume unique)
// 2. Get it's selected item.
CGUIControl *group = GetFirstFocusableControl(groupID);
if (!group) group = (CGUIControl *)GetControl(groupID);
if (group && group->IsGroup())
{
if (controlID == 0)
{ // just want to know if the group is focused
return group->HasFocus();
}
else
{
CGUIMessage message(GUI_MSG_ITEM_SELECTED, GetID(), group->GetID());
group->OnMessage(message);
return (controlID == (int) message.GetParam1());
}
}
return false;
}
示例7: 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");
}
}
}
}
示例8: LoadControl
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");
}
}
}
}