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


C++ CGUISpinControlEx::SetStringValue方法代码示例

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


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

示例1: FillControl

void CGUIWindowSettingsCategory::FillControl(CSetting *pSetting, CGUIControl *pSettingControl)
{
  void *filler = CSettings::Get().GetSettingOptionsFiller(pSetting);
  if (filler == NULL)
    return;

  if (pSetting->GetType() == SettingTypeInteger)
  {
    CSettingInt *pSettingInt = (CSettingInt*)pSetting;

    // get the list of options and the current option
    IntegerSettingOptions options;
    int currentOption = pSettingInt->GetValue();
    ((IntegerSettingOptionsFiller)filler)(pSetting, options, currentOption);

    // clear the spinner control
    CGUISpinControlEx *pSpinControl = (CGUISpinControlEx *)pSettingControl;
    pSpinControl->Clear();

    // fill the spinner control
    for (IntegerSettingOptions::const_iterator option = options.begin(); option != options.end(); option++)
      pSpinControl->AddLabel(option->first, option->second);

    // set the current option
    pSpinControl->SetValue(currentOption);

    // check if the current setting has changed
    if (currentOption != pSettingInt->GetValue())
      pSettingInt->SetValue(currentOption);
  }
  else if (pSetting->GetType() == SettingTypeString)
  {
    CSettingString *pSettingString = (CSettingString*)pSetting;

    // get the list of options and the current option
    StringSettingOptions options;
    std::string currentOption = pSettingString->GetValue();
    ((StringSettingOptionsFiller)filler)(pSetting, options, currentOption);

    // clear the spinner control
    CGUISpinControlEx *pSpinControl = (CGUISpinControlEx *)pSettingControl;
    pSpinControl->Clear();

    // fill the spinner control
    for (StringSettingOptions::const_iterator option = options.begin(); option != options.end(); option++)
      pSpinControl->AddLabel(option->first, option->second);

    // set the current option
    pSpinControl->SetStringValue(currentOption);

    // check if the current setting has changed
    if (currentOption.compare(pSettingString->GetValue()) != 0)
      pSettingString->SetValue(currentOption);
  }
}
开发者ID:,项目名称:,代码行数:55,代码来源:


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