当前位置: 首页>>代码示例>>C++>>正文


C++ CGUIButtonControl::Clone方法代码示例

本文整理汇总了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;
}
开发者ID:meijin007,项目名称:xbmc,代码行数:55,代码来源:GUIDialogAddonSettings.cpp


注:本文中的CGUIButtonControl::Clone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。