本文整理汇总了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);
}
}