本文整理汇总了C++中CGUISettingsSliderControl::SetFloatValue方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUISettingsSliderControl::SetFloatValue方法的具体用法?C++ CGUISettingsSliderControl::SetFloatValue怎么用?C++ CGUISettingsSliderControl::SetFloatValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUISettingsSliderControl
的用法示例。
在下文中一共展示了CGUISettingsSliderControl::SetFloatValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateSetting
void CGUIDialogSettings::UpdateSetting(unsigned int id)
{
unsigned int settingNum = (unsigned int)-1;
for (unsigned int i = 0; i < m_settings.size(); i++)
{
if (m_settings[i].id == id)
{
settingNum = i;
break;
}
}
if(settingNum == (unsigned int)-1)
return;
SettingInfo &setting = m_settings.at(settingNum);
unsigned int controlID = settingNum + CONTROL_START;
if (setting.type == SettingInfo::SPIN)
{
CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(controlID);
if (pControl && setting.data) pControl->SetValue(*(int *)setting.data);
}
else if (setting.type == SettingInfo::CHECK)
{
CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(controlID);
if (pControl && setting.data) pControl->SetSelected(*(bool *)setting.data);
}
else if (setting.type == SettingInfo::CHECK_UCHAR)
{
CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(controlID);
if (pControl && setting.data) pControl->SetSelected(*(unsigned char*)setting.data ? true : false);
}
else if (setting.type == SettingInfo::SLIDER)
{
CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(controlID);
float value = *(float *)setting.data;
if (pControl && setting.data)
{
pControl->SetFloatValue(value);
if (setting.formatFunction) pControl->SetTextValue(setting.formatFunction(value, setting.interval));
}
}
else if (setting.type == SettingInfo::BUTTON)
{
SET_CONTROL_LABEL(controlID,setting.name);
if (m_usePopupSliders && setting.data && setting.formatFunction)
SET_CONTROL_LABEL2(controlID,setting.formatFunction(*(float *)setting.data, setting.interval));
}
if (setting.enabled)
{
CONTROL_ENABLE(controlID);
}
else
{
CONTROL_DISABLE(controlID);
}
}
示例2: set_float_value
void Interface_GUIControlSettingsSlider::set_float_value(void* kodiBase, void* handle, float value)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
CGUISettingsSliderControl* control = static_cast<CGUISettingsSliderControl*>(handle);
if (!addon || !control)
{
CLog::Log(LOGERROR, "Interface_GUIControlSettingsSlider::%s - invalid handler data (kodiBase='%p', handle='%p') on addon '%s'",
__FUNCTION__, addon, control, addon ? addon->ID().c_str() : "unknown");
return;
}
control->SetType(SLIDER_CONTROL_TYPE_FLOAT);
control->SetFloatValue(value);
}
示例3: SetFloatValue
void Interface_GUIControlSettingsSlider::SetFloatValue(void* kodiBase, void* handle, float value)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
if (!addon)
{
CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSettingsSlider::%s - invalid data", __FUNCTION__);
return;
}
if (!handle)
{
CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSettingsSlider::%s - invalid handler data on addon '%s'", __FUNCTION__, addon->ID().c_str());
return;
}
CGUISettingsSliderControl* pControl = static_cast<CGUISettingsSliderControl*>(handle);
pControl->SetType(SLIDER_CONTROL_TYPE_FLOAT);
pControl->SetFloatValue(value);
}
示例4: UpdateSetting
void CGUIDialogSettings::UpdateSetting(unsigned int id)
{
unsigned int settingNum = (unsigned int)-1;
for (unsigned int i = 0; i < m_settings.size(); i++)
{
if (m_settings[i].id == id)
{
settingNum = i;
break;
}
}
if(settingNum == (unsigned int)-1)
return;
SettingInfo &setting = m_settings.at(settingNum);
unsigned int controlID = settingNum + CONTROL_START;
if (setting.type == SettingInfo::SPIN)
{
CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(controlID);
if (pControl && setting.data) pControl->SetValue(*(int *)setting.data);
}
else if (setting.type == SettingInfo::CHECK)
{
CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(controlID);
if (pControl && setting.data) pControl->SetSelected(*(bool *)setting.data);
}
else if (setting.type == SettingInfo::CHECK_UCHAR)
{
CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(controlID);
if (pControl && setting.data) pControl->SetSelected(*(unsigned char*)setting.data ? true : false);
}
else if (setting.type == SettingInfo::SLIDER)
{
CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(controlID);
if (pControl && setting.data)
{
float value = *(float *)setting.data;
pControl->SetFloatValue(value);
if (setting.formatFunction) pControl->SetTextValue(setting.formatFunction(value, setting.interval));
}
}
else if (setting.type == SettingInfo::BUTTON_DIALOG)
{
SET_CONTROL_LABEL(controlID,setting.name);
CGUIButtonControl *pControl = (CGUIButtonControl *)GetControl(controlID);
if (pControl && setting.data) pControl->SetLabel2(*(CStdString *)setting.data);
}
else if (setting.type == SettingInfo::EDIT)
{
CGUIEditControl *pControl = (CGUIEditControl *)GetControl(controlID);
if (pControl && setting.data) pControl->SetLabel2(*(CStdString *)setting.data);
}
else if (setting.type == SettingInfo::EDIT_NUM)
{
CGUIEditControl *pControl = (CGUIEditControl *)GetControl(controlID);
if (pControl && setting.data) {
CStdString strIndex;
strIndex.Format("%i", *(int *)setting.data);
pControl->SetLabel2(strIndex);
}
}
else if (setting.type == SettingInfo::STRING)
{
SET_CONTROL_LABEL(controlID, setting.name);
string strNewValue = string(*(CStdString *)setting.data);
if (strNewValue.empty())
strNewValue = "-";
SET_CONTROL_LABEL2(controlID, strNewValue);
}
if (setting.enabled)
{
CONTROL_ENABLE(controlID);
}
else
{
CONTROL_DISABLE(controlID);
}
}