void CGUIDialogSlider::SetSlider(const CStdString &label, float value, float min, float delta, float max, ISliderCallback *callback, void *callbackData) { SET_CONTROL_LABEL(CONTROL_HEADING, label); CGUISliderControl *slider = (CGUISliderControl *)GetControl(CONTROL_SLIDER); m_callback = callback; m_callbackData = callbackData; if (slider) { slider->SetType(SPIN_CONTROL_TYPE_FLOAT); slider->SetFloatRange(min, max); slider->SetFloatInterval(delta); slider->SetFloatValue(value); if (m_callback) { m_callback->OnSliderChange(m_callbackData, slider); SET_CONTROL_LABEL(CONTROL_LABEL, slider->GetDescription()); } } }
void Interface_GUIControlSlider::SetFloatValue(void* kodiBase, void* handle, float value) { CAddonDll* addon = static_cast<CAddonDll*>(kodiBase); if (!addon) { CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSlider::%s - invalid data", __FUNCTION__); return; } if (!handle) { CLog::Log(LOGERROR, "ADDON::Interface_GUIControlSlider::%s - invalid handler data on addon '%s'", __FUNCTION__, addon->ID().c_str()); return; } CGUISliderControl* pControl = static_cast<CGUISliderControl *>(handle); pControl->SetType(SLIDER_CONTROL_TYPE_FLOAT); pControl->SetFloatValue(value); }