3 * Copyright (C) 2013 Team XBMC
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with XBMC; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
22 #include "settings/lib/ISettingControl.h"
24 #define SETTING_XML_ELM_CONTROL_FORMATLABEL "formatlabel"
25 #define SETTING_XML_ELM_CONTROL_HIDDEN "hidden"
26 #define SETTING_XML_ELM_CONTROL_VERIFYNEW "verifynew"
27 #define SETTING_XML_ELM_CONTROL_HEADING "heading"
28 #define SETTING_XML_ELM_CONTROL_HIDEVALUE "hidevalue"
29 #define SETTING_XML_ELM_CONTROL_MULTISELECT "multiselect"
31 class CSettingControlCheckmark : public ISettingControl
34 CSettingControlCheckmark()
38 virtual ~CSettingControlCheckmark() { }
40 // implementation of ISettingControl
41 virtual std::string GetType() const { return "toggle"; }
44 virtual bool SetFormat(const std::string &format);
47 class CSettingControlSpinner : public ISettingControl
50 CSettingControlSpinner()
55 virtual ~CSettingControlSpinner() { }
57 // implementation of ISettingControl
58 virtual std::string GetType() const { return "spinner"; }
59 virtual bool Deserialize(const TiXmlNode *node, bool update = false);
61 int GetFormatLabel() const { return m_formatLabel; }
62 const std::string& GetFormatString() const { return m_formatString; }
63 int GetMinimumLabel() const { return m_minimumLabel; }
66 virtual bool SetFormat(const std::string &format);
69 std::string m_formatString;
74 class CSettingControlEdit : public ISettingControl
79 m_verifyNewValue(false),
84 virtual ~CSettingControlEdit() { }
86 // implementation of ISettingControl
87 virtual std::string GetType() const { return "edit"; }
88 virtual bool Deserialize(const TiXmlNode *node, bool update = false);
90 bool IsHidden() const { return m_hidden; }
91 bool VerifyNewValue() const { return m_verifyNewValue; }
92 int GetHeading() const { return m_heading; }
95 virtual bool SetFormat(const std::string &format);
98 bool m_verifyNewValue;
102 class CSettingControlButton : public ISettingControl
105 CSettingControlButton()
109 virtual ~CSettingControlButton() { }
111 // implementation of ISettingControl
112 virtual std::string GetType() const { return "button"; }
113 virtual bool Deserialize(const TiXmlNode *node, bool update = false);
115 int GetHeading() const { return m_heading; }
116 bool HideValue() const { return m_hideValue; }
119 virtual bool SetFormat(const std::string &format);
125 class CSettingControlList : public ISettingControl
128 CSettingControlList()
132 virtual ~CSettingControlList() { }
134 // implementation of ISettingControl
135 virtual std::string GetType() const { return "list"; }
136 virtual bool Deserialize(const TiXmlNode *node, bool update = false);
138 int GetHeading() const { return m_heading; }
139 bool CanMultiSelect() const { return m_multiselect; }
142 virtual bool SetFormat(const std::string &format);