Fix keymap.
[vuplus_xbmc] / xbmc / settings / SettingControl.h
1 #pragma once
2 /*
3  *      Copyright (C) 2013 Team XBMC
4  *      http://xbmc.org
5  *
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)
9  *  any later version.
10  *
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.
15  *
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/>.
19  *
20  */
21
22 #include "settings/lib/ISettingControl.h"
23
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"
30
31 class CSettingControlCheckmark : public ISettingControl
32 {
33 public:
34   CSettingControlCheckmark()
35   {
36     m_format = "boolean";
37   }
38   virtual ~CSettingControlCheckmark() { }
39
40   // implementation of ISettingControl
41   virtual std::string GetType() const { return "toggle"; }
42
43 protected:
44   virtual bool SetFormat(const std::string &format);
45 };
46
47 class CSettingControlSpinner : public ISettingControl
48 {
49 public:
50   CSettingControlSpinner()
51     : m_formatLabel(-1),
52       m_formatString("%i"),
53       m_minimumLabel(-1)
54   { }
55   virtual ~CSettingControlSpinner() { }
56
57   // implementation of ISettingControl
58   virtual std::string GetType() const { return "spinner"; }
59   virtual bool Deserialize(const TiXmlNode *node, bool update = false);
60
61   int GetFormatLabel() const { return m_formatLabel; }
62   const std::string& GetFormatString() const { return m_formatString; }
63   int GetMinimumLabel() const { return m_minimumLabel; }
64
65 protected:
66   virtual bool SetFormat(const std::string &format);
67
68   int m_formatLabel;
69   std::string m_formatString;
70   int m_minimumLabel;
71
72 };
73
74 class CSettingControlEdit : public ISettingControl
75 {
76 public:
77   CSettingControlEdit()
78     : m_hidden(false),
79       m_verifyNewValue(false),
80       m_heading(-1)
81   {
82     m_delayed = true;
83   }
84   virtual ~CSettingControlEdit() { }
85
86   // implementation of ISettingControl
87   virtual std::string GetType() const { return "edit"; }
88   virtual bool Deserialize(const TiXmlNode *node, bool update = false);
89
90   bool IsHidden() const { return m_hidden; }
91   bool VerifyNewValue() const { return m_verifyNewValue; }
92   int GetHeading() const { return m_heading; }
93
94 protected:
95   virtual bool SetFormat(const std::string &format);
96
97   bool m_hidden;
98   bool m_verifyNewValue;
99   int m_heading;
100 };
101
102 class CSettingControlButton : public ISettingControl
103 {
104 public:
105   CSettingControlButton()
106     : m_heading(-1),
107       m_hideValue(false)
108   { }
109   virtual ~CSettingControlButton() { }
110
111   // implementation of ISettingControl
112   virtual std::string GetType() const { return "button"; }
113   virtual bool Deserialize(const TiXmlNode *node, bool update = false);
114
115   int GetHeading() const { return m_heading; }
116   bool HideValue() const { return m_hideValue; }
117
118 protected:
119   virtual bool SetFormat(const std::string &format);
120
121   int m_heading;
122   bool m_hideValue;
123 };
124
125 class CSettingControlList : public ISettingControl
126 {
127 public:
128   CSettingControlList()
129     : m_heading(-1),
130       m_multiselect(false)
131   { }
132   virtual ~CSettingControlList() { }
133
134   // implementation of ISettingControl
135   virtual std::string GetType() const { return "list"; }
136   virtual bool Deserialize(const TiXmlNode *node, bool update = false);
137   
138   int GetHeading() const { return m_heading; }
139   bool CanMultiSelect() const { return m_multiselect; }
140
141 protected:
142   virtual bool SetFormat(const std::string &format);
143   
144   int m_heading;
145   bool m_multiselect;
146 };