void Interface_GUIControlButton::GetLabel2(void* kodiBase, void* handle, char &label, unsigned int &iMaxStringSize) { CAddonDll* addon = static_cast<CAddonDll*>(kodiBase); if (!addon) { CLog::Log(LOGERROR, "ADDON::Interface_GUIControlButton::%s - invalid data", __FUNCTION__); return; } if (!handle) { CLog::Log(LOGERROR, "ADDON::Interface_GUIControlButton::%s - invalid handler data on addon '%s'", __FUNCTION__, addon->ID().c_str()); return; } CGUIButtonControl* pButton = static_cast<CGUIButtonControl *>(handle); std::string text = pButton->GetLabel2(); strncpy(&label, text.c_str(), iMaxStringSize); iMaxStringSize = text.length(); }
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) pControl->SetTextValue(setting.formatFunction(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) SET_CONTROL_LABEL2(iID, setting.formatFunction(*(float *)setting.data, setting.interval)); } OnSettingChanged(setting); }