CGUIControl* ControlButton::Create() { CLabelInfo label; label.font = g_fontManager.GetFont(strFont); label.textColor = textColor; label.disabledColor = disabledColor; label.shadowColor = shadowColor; label.focusedColor = focusedColor; label.align = align; label.offsetX = (float)textOffsetX; label.offsetY = (float)textOffsetY; label.angle = (float)-iAngle; pGUIControl = new CGUIButtonControl( iParentId, iControlId, (float)dwPosX, (float)dwPosY, (float)dwWidth, (float)dwHeight, CTextureInfo(strTextureFocus), CTextureInfo(strTextureNoFocus), label); CGUIButtonControl* pGuiButtonControl = (CGUIButtonControl*)pGUIControl; pGuiButtonControl->SetLabel(strText); pGuiButtonControl->SetLabel2(strText2); return pGUIControl; }
CGUIControl* ControlButton_Create(ControlButton* pControl) { CLabelInfo label; label.font = g_fontManager.GetFont(pControl->strFont); label.textColor = pControl->textColor; label.disabledColor = pControl->disabledColor; label.shadowColor = pControl->shadowColor; label.focusedColor = pControl->focusedColor; label.align = pControl->align; label.offsetX = (float)pControl->textOffsetX; label.offsetY = (float)pControl->textOffsetY; label.angle = (float)-pControl->iAngle; pControl->pGUIControl = new CGUIButtonControl( pControl->iParentId, pControl->iControlId, (float)pControl->dwPosX, (float)pControl->dwPosY, (float)pControl->dwWidth, (float)pControl->dwHeight, (CStdString)pControl->strTextureFocus, (CStdString)pControl->strTextureNoFocus, label); CGUIButtonControl* pGuiButtonControl = (CGUIButtonControl*)pControl->pGUIControl; pGuiButtonControl->SetLabel(pControl->strText); pGuiButtonControl->SetLabel2(pControl->strText2); return pControl->pGUIControl; }
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_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); } } if (setting.enabled) { CONTROL_ENABLE(controlID); } else { CONTROL_DISABLE(controlID); } }