本文整理汇总了C++中CGUISettingsSliderControl::GetFloatValue方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUISettingsSliderControl::GetFloatValue方法的具体用法?C++ CGUISettingsSliderControl::GetFloatValue怎么用?C++ CGUISettingsSliderControl::GetFloatValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUISettingsSliderControl
的用法示例。
在下文中一共展示了CGUISettingsSliderControl::GetFloatValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_float_value
float Interface_GUIControlSettingsSlider::get_float_value(void* kodiBase, void* handle)
{
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 0.0f;
}
return control->GetFloatValue();
}
示例2: OnClick
void CGUIDialogSettings::OnClick(int iID)
{
if (iID == CONTROL_OKAY_BUTTON)
{
OnOkay();
Close();
return;
}
if (iID == CONTROL_CANCEL_BUTTON)
{
OnCancel();
Close();
return;
}
unsigned int settingNum = iID - CONTROL_START;
if (settingNum >= m_settings.size()) return;
SettingInfo &setting = m_settings.at(settingNum);
if (setting.type == SettingInfo::SPIN)
{
CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(iID);
if (setting.data) *(int *)setting.data = pControl->GetValue();
}
else if (setting.type == SettingInfo::BUTTON_DIALOG)
{
CGUIButtonControl *pControl = (CGUIButtonControl *)GetControl(iID);
if (setting.data) *(CStdString *)setting.data = pControl->GetLabel2();
}
else if (setting.type == SettingInfo::EDIT)
{
CGUIEditControl *pControl = (CGUIEditControl *)GetControl(iID);
if (setting.data) *(CStdString *)setting.data = pControl->GetLabel2();
}
else if (setting.type == SettingInfo::EDIT_NUM)
{
CGUIEditControl *pControl = (CGUIEditControl *)GetControl(iID);
if (setting.data) {
CStdString strIndex = pControl->GetLabel2();
*(int *)setting.data = atol(strIndex.c_str());
}
}
else if (setting.type == SettingInfo::CHECK)
{
CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(iID);
if (setting.data) *(bool *)setting.data = pControl->IsSelected();
}
else if (setting.type == SettingInfo::CHECK_UCHAR)
{
CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(iID);
if (setting.data) *(unsigned char*)setting.data = pControl->IsSelected() ? 1 : 0;
}
else if (setting.type == SettingInfo::SLIDER)
{
CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(iID);
if (setting.data) *(float *)setting.data = pControl->GetFloatValue();
if (setting.formatFunction.standard) pControl->SetTextValue(setting.formatFunction.standard(pControl->GetFloatValue(), setting.interval));
}
else if (setting.type == SettingInfo::BUTTON && m_usePopupSliders && setting.data)
{ // we're using popup sliders
CGUIDialogSlider::ShowAndGetInput(setting.name, *(float *)setting.data, setting.min, setting.interval, setting.max, this, &setting);
if (setting.formatFunction.standard)
SET_CONTROL_LABEL2(iID, setting.formatFunction.standard(*(float *)setting.data, setting.interval));
}
else if (setting.type == SettingInfo::STRING)
{
CGUIKeyboardFactory::ShowAndGetInput(*(CStdString *) setting.data, true);
string strNewValue = string(*(CStdString *)setting.data);
if (strNewValue.empty())
strNewValue = "-";
SET_CONTROL_LABEL2(iID, strNewValue);
}
else if (setting.type == SettingInfo::RANGE)
{
CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(iID);
if (setting.data)
{
*((float **)setting.data)[0] = pControl->GetFloatValue(CGUISliderControl::RangeSelectorLower);
*((float **)setting.data)[1] = pControl->GetFloatValue(CGUISliderControl::RangeSelectorUpper);
}
if (setting.formatFunction.range)
pControl->SetTextValue(setting.formatFunction.range(pControl->GetFloatValue(CGUISliderControl::RangeSelectorLower),
pControl->GetFloatValue(CGUISliderControl::RangeSelectorUpper),
setting.interval));
}
OnSettingChanged(setting);
}