本文整理汇总了C++中CGUIButtonControl::Clone方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIButtonControl::Clone方法的具体用法?C++ CGUIButtonControl::Clone怎么用?C++ CGUIButtonControl::Clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIButtonControl
的用法示例。
在下文中一共展示了CGUIButtonControl::Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateSections
void CGUIDialogAddonSettings::CreateSections()
{
CGUIControlGroupList *group = dynamic_cast<CGUIControlGroupList *>(GetControl(CONTROL_SECTION_AREA));
CGUIButtonControl *originalButton = dynamic_cast<CGUIButtonControl *>(GetControl(CONTROL_DEFAULT_SECTION_BUTTON));
if (!m_addon)
return;
if (originalButton)
originalButton->SetVisible(false);
// clear the category group
FreeSections();
// grab our categories
const TiXmlElement *category = m_addon->GetSettingsXML()->FirstChildElement("category");
if (!category) // add a default one...
category = m_addon->GetSettingsXML();
int buttonID = CONTROL_START_SECTION;
while (category)
{ // add a category
CGUIButtonControl *button = originalButton ? originalButton->Clone() : NULL;
std::string label = GetString(category->Attribute("label"));
if (label.empty())
label = g_localizeStrings.Get(128);
if (buttonID >= CONTROL_START_SETTING)
{
CLog::Log(LOGERROR, "%s - cannot have more than %d categories - simplify your addon!", __FUNCTION__, CONTROL_START_SETTING - CONTROL_START_SECTION);
break;
}
// add the category button
if (button && group)
{
button->SetID(buttonID++);
button->SetLabel(label);
button->SetVisible(true);
group->AddControl(button);
}
// grab a local copy of all the settings in this category
const TiXmlElement *setting = category->FirstChildElement("setting");
while (setting)
{
const std::string id = XMLUtils::GetAttribute(setting, "id");
if (!id.empty())
m_settings[id] = m_addon->GetSetting(id);
setting = setting->NextSiblingElement("setting");
}
category = category->NextSiblingElement("category");
}
m_totalSections = buttonID - CONTROL_START_SECTION;
}