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


C++ CSetting::GetLabel方法代码示例

本文整理汇总了C++中CSetting::GetLabel方法的典型用法代码示例。如果您正苦于以下问题:C++ CSetting::GetLabel方法的具体用法?C++ CSetting::GetLabel怎么用?C++ CSetting::GetLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSetting的用法示例。


在下文中一共展示了CSetting::GetLabel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnAction

bool CGUIWindowSettingsCategory::OnAction(const CAction &action)
{
  switch (action.GetID())
  {
    case ACTION_SETTINGS_RESET:
    {
      if (CGUIDialogYesNo::ShowAndGetInput(10041, 0, 10042, 0))
      {
        for(vector<BaseSettingControlPtr>::iterator it = m_settingControls.begin(); it != m_settingControls.end(); it++)
        {
          CSetting *setting = (*it)->GetSetting();
          if (setting != NULL)
            setting->Reset();
        }
      }
      return true;
    }

    case ACTION_SETTINGS_LEVEL_CHANGE:
    {
      CViewStateSettings::Get().CycleSettingLevel();
      CSettings::Get().Save();

      // try to keep the current position
      std::string oldCategory;
      if (m_iCategory >= 0 && m_iCategory < (int)m_categories.size())
        oldCategory = m_categories[m_iCategory]->GetId();

      SET_CONTROL_LABEL(CONTRL_BTN_LEVELS, 10036 + (int)CViewStateSettings::Get().GetSettingLevel());
      // only re-create the categories, the settings will be created later
      SetupControls(false);

      m_iCategory = 0;
      // try to find the category that was previously selected
      if (!oldCategory.empty())
      {
        for (int i = 0; i < (int)m_categories.size(); i++)
        {
          if (m_categories[i]->GetId() == oldCategory)
          {
            m_iCategory = i;
            break;
          }
        }
      }

      CreateSettings();
      return true;
    }

    case ACTION_SHOW_INFO:
    {
      int label = -1;
      int help = -1;
      int focusedControl = GetFocusedControlID();
      // check if we are focusing a category
      if (focusedControl >= CONTROL_START_BUTTONS && focusedControl < (int)(CONTROL_START_BUTTONS + m_categories.size()))
      {
        CSettingCategory *category = m_categories[focusedControl - CONTROL_START_BUTTONS];
        label = category->GetLabel();
        help = category->GetHelp();
      }
      else if (focusedControl >= CONTROL_START_CONTROL && focusedControl < (int)(CONTROL_START_CONTROL + m_settingControls.size()))
      {
        CSetting *setting = GetSettingControl(focusedControl)->GetSetting();
        if (setting != NULL)
        {
          label = setting->GetLabel();
          help = setting->GetHelp();
        }
      }
      else
        break;

      if (help >= 0)
      {
        CGUIDialogTextViewer *dialog = (CGUIDialogTextViewer*)g_windowManager.GetWindow(WINDOW_DIALOG_TEXT_VIEWER);
        if (dialog != NULL)
        {
          if (label < 0)
            label = 10043; // "Help"
          dialog->SetHeading(g_localizeStrings.Get(label));
          dialog->SetText(g_localizeStrings.Get(help));
          dialog->DoModal();
        }
      }
      else
        CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(10043), g_localizeStrings.Get(10044), 2000U);
      return true;
    }

    default:
      break;
  }

  return CGUIWindow::OnAction(action);
}
开发者ID:,项目名称:,代码行数:97,代码来源:


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