summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls')
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Button.h176
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Edit.h276
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h159
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Image.h123
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Label.h128
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h121
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h171
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Rendering.h215
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h323
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Slider.h336
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h376
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h176
12 files changed, 2580 insertions, 0 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Button.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Button.h
new file mode 100644
index 0000000..5892d24
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Button.h
@@ -0,0 +1,176 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
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 KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CButton Control Button
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CButton }
37 /// **Standard push button control for window**
38 ///
39 /// The button control is used for creating push buttons in Kodi. You can
40 /// choose the position, size, and look of the button, as well as choosing
41 /// what action(s) should be performed when pushed.
42 ///
43 /// It has the header \ref Button.h "#include <kodi/gui/controls/Button.h>"
44 /// be included to enjoy it.
45 ///
46 /// Here you find the needed skin part for a \ref skin_Button_control "button control"
47 ///
48 /// @note The call of the control is only possible from the corresponding
49 /// window as its class and identification number is required.
50 ///
51 class CButton : public CAddonGUIControlBase
52 {
53 public:
54 //==========================================================================
55 ///
56 /// @ingroup cpp_kodi_gui_control_CButton
57 /// @brief Construct a new control
58 ///
59 /// @param[in] window related window control class
60 /// @param[in] controlId Used skin xml control id
61 ///
62 CButton(CWindow* window, int controlId)
63 : CAddonGUIControlBase(window)
64 {
65 m_controlHandle = m_interface->kodi_gui->window->get_control_button(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
66 if (!m_controlHandle)
67 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::CButton can't create control class from Kodi !!!");
68 }
69 //--------------------------------------------------------------------------
70
71 //==========================================================================
72 ///
73 /// @ingroup cpp_kodi_gui_control_CButton
74 /// @brief Destructor
75 ///
76 ~CButton() override = default;
77 //--------------------------------------------------------------------------
78
79 //==========================================================================
80 ///
81 /// @ingroup cpp_kodi_gui_control_CButton
82 /// @brief Set the control on window to visible
83 ///
84 /// @param[in] visible If true visible, otherwise hidden
85 ///
86 void SetVisible(bool visible)
87 {
88 m_interface->kodi_gui->control_button->set_visible(m_interface->kodiBase, m_controlHandle, visible);
89 }
90 //--------------------------------------------------------------------------
91
92 //==========================================================================
93 ///
94 /// @ingroup cpp_kodi_gui_control_CButton
95 /// @brief Set's the control's enabled/disabled state
96 ///
97 /// @param[in] enabled If true enabled, otherwise disabled
98 ///
99 void SetEnabled(bool enabled)
100 {
101 m_interface->kodi_gui->control_button->set_enabled(m_interface->kodiBase, m_controlHandle, enabled);
102 }
103 //--------------------------------------------------------------------------
104
105 //==========================================================================
106 ///
107 /// @ingroup cpp_kodi_gui_control_CButton
108 /// @brief To set the text string on button
109 ///
110 /// @param[in] label Text to show
111 ///
112 void SetLabel(const std::string& label)
113 {
114 m_interface->kodi_gui->control_button->set_label(m_interface->kodiBase, m_controlHandle, label.c_str());
115 }
116 //--------------------------------------------------------------------------
117
118 //==========================================================================
119 ///
120 /// @ingroup cpp_kodi_gui_control_CButton
121 /// @brief Get the used text from button
122 ///
123 /// @return Text shown
124 ///
125 std::string GetLabel() const
126 {
127 std::string label;
128 char* ret = m_interface->kodi_gui->control_button->get_label(m_interface->kodiBase, m_controlHandle);
129 if (ret != nullptr)
130 {
131 if (std::strlen(ret))
132 label = ret;
133 m_interface->free_string(m_interface->kodiBase, ret);
134 }
135 return label;
136 }
137 //--------------------------------------------------------------------------
138
139 //==========================================================================
140 ///
141 /// @ingroup cpp_kodi_gui_control_CButton
142 /// @brief If two labels are used for button becomes it set with them
143 ///
144 /// @param[in] label Text for second label
145 ///
146 void SetLabel2(const std::string& label)
147 {
148 m_interface->kodi_gui->control_button->set_label2(m_interface->kodiBase, m_controlHandle, label.c_str());
149 }
150 //--------------------------------------------------------------------------
151
152 //==========================================================================
153 ///
154 /// @ingroup cpp_kodi_gui_control_CButton
155 /// @brief Get the second label if present
156 ///
157 /// @return Second label
158 ///
159 std::string GetLabel2() const
160 {
161 std::string label;
162 char* ret = m_interface->kodi_gui->control_button->get_label2(m_interface->kodiBase, m_controlHandle);
163 if (ret != nullptr)
164 {
165 if (std::strlen(ret))
166 label = ret;
167 m_interface->free_string(m_interface->kodiBase, ret);
168 }
169 return label;
170 }
171 //--------------------------------------------------------------------------
172 };
173
174} /* namespace controls */
175} /* namespace gui */
176} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Edit.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Edit.h
new file mode 100644
index 0000000..83eeede
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Edit.h
@@ -0,0 +1,276 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
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 KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CEdit Control Edit
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CEdit }
37 /// **Editable window text control used as an input control for the osd keyboard
38 /// and other input fields**
39 ///
40 /// The edit control allows a user to input text in Kodi. You can choose the
41 /// font, size, colour, location and header of the text to be displayed.
42 ///
43 /// It has the header \ref Edit.h "#include <kodi/gui/controls/Edit.h>"
44 /// be included to enjoy it.
45 ///
46 /// Here you find the needed skin part for a \ref skin_Edit_control
47 /// "edit control".
48 ///
49 /// @note The call of the control is only possible from the corresponding
50 /// window as its class and identification number is required.
51 ///
52
53 //============================================================================
54 // see gui/definition.h for use of group "cpp_kodi_gui_controls_CEdit_Defs"
55 ///
56 /// \defgroup cpp_kodi_gui_controls_CEdit_Defs Definitions, structures and enumerators
57 /// \ingroup cpp_kodi_gui_controls_CEdit
58 /// @brief **Library definition values**
59 ///
60
61} /* namespace controls */
62} /* namespace gui */
63} /* namespace kodi */
64
65//============================================================================
66///
67/// \ingroup cpp_kodi_gui_controls_CEdit_Defs
68/// @{
69/// @anchor AddonGUIInputType
70/// @brief Text input types used on kodi::gui::controls::CEdit
71enum AddonGUIInputType
72{
73 /// Text inside edit control only readable
74 ADDON_INPUT_TYPE_READONLY = -1,
75 /// Normal text entries
76 ADDON_INPUT_TYPE_TEXT = 0,
77 /// To use on edit control only numeric numbers
78 ADDON_INPUT_TYPE_NUMBER,
79 /// To insert seconds
80 ADDON_INPUT_TYPE_SECONDS,
81 /// To insert time
82 ADDON_INPUT_TYPE_TIME,
83 /// To insert a date
84 ADDON_INPUT_TYPE_DATE,
85 /// Used for write in IP addresses
86 ADDON_INPUT_TYPE_IPADDRESS,
87 /// Text field used as password entry field with not visible text
88 ADDON_INPUT_TYPE_PASSWORD,
89 /// Text field used as password entry field with not visible text but
90 /// returned as MD5 value
91 ADDON_INPUT_TYPE_PASSWORD_MD5,
92 /// Use text field for search purpose
93 ADDON_INPUT_TYPE_SEARCH,
94 /// Text field as filter
95 ADDON_INPUT_TYPE_FILTER,
96 ///
97 ADDON_INPUT_TYPE_PASSWORD_NUMBER_VERIFY_NEW
98};
99/// @}
100//----------------------------------------------------------------------------
101
102namespace kodi
103{
104namespace gui
105{
106namespace controls
107{
108
109 class CEdit : public CAddonGUIControlBase
110 {
111 public:
112 //==========================================================================
113 ///
114 /// \ingroup cpp_kodi_gui_controls_CEdit
115 /// @brief Construct a new control
116 ///
117 /// @param[in] window related window control class
118 /// @param[in] controlId Used skin xml control id
119 ///
120 CEdit(CWindow* window, int controlId)
121 : CAddonGUIControlBase(window)
122 {
123 m_controlHandle = m_interface->kodi_gui->window->get_control_edit(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
124 if (!m_controlHandle)
125 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::control::CEdit can't create control class from Kodi !!!");
126 }
127 //--------------------------------------------------------------------------
128
129 //==========================================================================
130 ///
131 /// \ingroup cpp_kodi_gui_controls_CEdit
132 /// @brief Destructor
133 ///
134 ~CEdit() override = default;
135 //--------------------------------------------------------------------------
136
137 //==========================================================================
138 ///
139 /// \ingroup cpp_kodi_gui_controls_CEdit
140 /// @brief Set the control on window to visible
141 ///
142 /// @param[in] visible If true visible, otherwise hidden
143 ///
144 void SetVisible(bool visible)
145 {
146 m_interface->kodi_gui->control_edit->set_visible(m_interface->kodiBase, m_controlHandle, visible);
147 }
148 //--------------------------------------------------------------------------
149
150 //==========================================================================
151 ///
152 /// \ingroup cpp_kodi_gui_controls_CEdit
153 /// @brief Set's the control's enabled/disabled state
154 ///
155 /// @param[in] enabled If true enabled, otherwise disabled
156 ///
157 void SetEnabled(bool enabled)
158 {
159 m_interface->kodi_gui->control_edit->set_enabled(m_interface->kodiBase, m_controlHandle, enabled);
160 }
161 //--------------------------------------------------------------------------
162
163 //==========================================================================
164 ///
165 /// \ingroup cpp_kodi_gui_controls_CEdit
166 /// @brief To set the text string on edit control
167 ///
168 /// @param[in] label Text to show
169 ///
170 void SetLabel(const std::string& label)
171 {
172 m_interface->kodi_gui->control_edit->set_label(m_interface->kodiBase, m_controlHandle, label.c_str());
173 }
174 //--------------------------------------------------------------------------
175
176 //==========================================================================
177 ///
178 /// \ingroup cpp_kodi_gui_controls_CEdit
179 /// @brief Returns the text heading for this edit control.
180 ///
181 /// @return Heading text
182 ///
183 std::string GetLabel() const
184 {
185 std::string label;
186 char* ret = m_interface->kodi_gui->control_edit->get_label(m_interface->kodiBase, m_controlHandle);
187 if (ret != nullptr)
188 {
189 if (std::strlen(ret))
190 label = ret;
191 m_interface->free_string(m_interface->kodiBase, ret);
192 }
193 return label;
194 }
195 //--------------------------------------------------------------------------
196
197 //==========================================================================
198 ///
199 /// \ingroup cpp_kodi_gui_controls_CEdit
200 /// @brief Set's text heading for this edit control.
201 ///
202 /// @param[in] text string or unicode - text string.
203 ///
204 void SetText(const std::string& text)
205 {
206 m_interface->kodi_gui->control_edit->set_text(m_interface->kodiBase, m_controlHandle, text.c_str());
207 }
208 //--------------------------------------------------------------------------
209
210 //==========================================================================
211 ///
212 /// \ingroup cpp_kodi_gui_controls_CEdit
213 /// @brief Returns the text value for this edit control.
214 ///
215 /// @return Text value of control
216 ///
217 std::string GetText() const
218 {
219 std::string text;
220 char* ret = m_interface->kodi_gui->control_edit->get_text(m_interface->kodiBase, m_controlHandle);
221 if (ret != nullptr)
222 {
223 if (std::strlen(ret))
224 text = ret;
225 m_interface->free_string(m_interface->kodiBase, ret);
226 }
227 return text;
228 }
229 //--------------------------------------------------------------------------
230
231 //==========================================================================
232 ///
233 /// \ingroup cpp_kodi_gui_controls_CEdit
234 /// @brief Set the cursor position on text.
235 ///
236 /// @param[in] iPosition The position to set
237 ///
238 void SetCursorPosition(unsigned int iPosition)
239 {
240 m_interface->kodi_gui->control_edit->set_cursor_position(m_interface->kodiBase, m_controlHandle, iPosition);
241 }
242 //--------------------------------------------------------------------------
243
244 //==========================================================================
245 ///
246 /// \ingroup cpp_kodi_gui_controls_CEdit
247 /// @brief To get current cursor position on text field
248 ///
249 /// @return The current cursor position
250 ///
251 unsigned int GetCursorPosition()
252 {
253 return m_interface->kodi_gui->control_edit->get_cursor_position(m_interface->kodiBase, m_controlHandle);
254 }
255 //--------------------------------------------------------------------------
256
257 //==========================================================================
258 ///
259 /// \ingroup cpp_kodi_gui_controls_CEdit
260 /// @brief To set field input type which are defined on \ref AddonGUIInputType
261 ///
262 /// @param[in] type The \ref AddonGUIInputType "Add-on input type"
263 /// to use
264 /// @param[in] heading The heading text for related keyboard
265 /// dialog
266 ///
267 void SetInputType(AddonGUIInputType type, const std::string& heading)
268 {
269 m_interface->kodi_gui->control_edit->set_input_type(m_interface->kodiBase, m_controlHandle, static_cast<int>(type), heading.c_str());
270 }
271 //--------------------------------------------------------------------------
272 };
273
274} /* namespace controls */
275} /* namespace gui */
276} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h
new file mode 100644
index 0000000..82d17ff
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h
@@ -0,0 +1,159 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
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 KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CFadeLabel Control Fade Label
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CFadeLabel }
37 /// **Window control used to show multiple pieces of text in the same position,
38 /// by fading from one to the other**
39 ///
40 /// The fade label control is used for displaying multiple pieces of text in
41 /// the same space in Kodi. You can choose the font, size, colour, location
42 /// and contents of the text to be displayed. The first piece of information
43 /// to display fades in over 50 frames, then scrolls off to the left. Once it
44 /// is finished scrolling off screen, the second piece of information fades
45 /// in and the process repeats. A fade label control is not supported in a
46 /// list container.
47 ///
48 /// It has the header \ref FadeLabel.h "#include <kodi/gui/controls/FadeLabel.h>"
49 /// be included to enjoy it.
50 ///
51 /// Here you find the needed skin part for a \ref Fade_Label_Control "fade label control"
52 ///
53 /// @note The call of the control is only possible from the corresponding
54 /// window as its class and identification number is required.
55 ///
56 class CFadeLabel : public CAddonGUIControlBase
57 {
58 public:
59 //==========================================================================
60 ///
61 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
62 /// @brief Construct a new control.
63 ///
64 /// @param[in] window related window control class
65 /// @param[in] controlId Used skin xml control id
66 ///
67 CFadeLabel(CWindow* window, int controlId)
68 : CAddonGUIControlBase(window)
69 {
70 m_controlHandle = m_interface->kodi_gui->window->get_control_fade_label(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
71 if (!m_controlHandle)
72 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CFadeLabel can't create control class from Kodi !!!");
73 }
74 //--------------------------------------------------------------------------
75
76 //==========================================================================
77 ///
78 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
79 /// @brief Destructor.
80 ///
81 ~CFadeLabel() override = default;
82 //--------------------------------------------------------------------------
83
84 //==========================================================================
85 ///
86 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
87 /// @brief Set the control on window to visible.
88 ///
89 /// @param[in] visible If true visible, otherwise hidden
90 ///
91 void SetVisible(bool visible)
92 {
93 m_interface->kodi_gui->control_fade_label->set_visible(m_interface->kodiBase, m_controlHandle, visible);
94 }
95 //--------------------------------------------------------------------------
96
97 //==========================================================================
98 ///
99 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
100 /// @brief To add additional text string on fade label.
101 ///
102 /// @param[in] label Text to show
103 ///
104 void AddLabel(const std::string& label)
105 {
106 m_interface->kodi_gui->control_fade_label->add_label(m_interface->kodiBase, m_controlHandle, label.c_str());
107 }
108 //--------------------------------------------------------------------------
109
110 //==========================================================================
111 ///
112 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
113 /// @brief Get the used text from button
114 ///
115 /// @return Text shown
116 ///
117 std::string GetLabel() const
118 {
119 std::string label;
120 char* ret = m_interface->kodi_gui->control_fade_label->get_label(m_interface->kodiBase, m_controlHandle);
121 if (ret != nullptr)
122 {
123 if (std::strlen(ret))
124 label = ret;
125 m_interface->free_string(m_interface->kodiBase, ret);
126 }
127 return label;
128 }
129 //--------------------------------------------------------------------------
130
131 //==========================================================================
132 ///
133 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
134 /// @brief To enable or disable scrolling on fade label
135 ///
136 /// @param[in] scroll To enable scrolling set to true, otherwise is
137 /// disabled
138 ///
139 void SetScrolling(bool scroll)
140 {
141 m_interface->kodi_gui->control_fade_label->set_scrolling(m_interface->kodiBase, m_controlHandle, scroll);
142 }
143 //--------------------------------------------------------------------------
144
145 //==========================================================================
146 ///
147 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
148 /// @brief To reset al inserted labels.
149 ///
150 void Reset()
151 {
152 m_interface->kodi_gui->control_fade_label->reset(m_interface->kodiBase, m_controlHandle);
153 }
154 //--------------------------------------------------------------------------
155 };
156
157} /* namespace controls */
158} /* namespace gui */
159} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Image.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Image.h
new file mode 100644
index 0000000..1179fab
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Image.h
@@ -0,0 +1,123 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
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 KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CImage Control Image
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CImage }
37 /// **Window control used to show an image.**
38 ///
39 /// The image control is used for displaying images in Kodi. You can choose
40 /// the position, size, transparency and contents of the image to be displayed.
41 ///
42 /// It has the header \ref Image.h "#include <kodi/gui/controls/Image.h>"
43 /// be included to enjoy it.
44 ///
45 /// Here you find the needed skin part for a \ref Image_Control "image control"
46 ///
47 /// @note The call of the control is only possible from the corresponding
48 /// window as its class and identification number is required.
49 ///
50 class CImage : public CAddonGUIControlBase
51 {
52 public:
53 //==========================================================================
54 ///
55 /// \ingroup cpp_kodi_gui_controls_CImage
56 /// @brief Construct a new control
57 ///
58 /// @param[in] window related window control class
59 /// @param[in] controlId Used skin xml control id
60 ///
61 CImage(CWindow* window, int controlId)
62 : CAddonGUIControlBase(window)
63 {
64 m_controlHandle = m_interface->kodi_gui->window->get_control_image(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
65 if (!m_controlHandle)
66 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CImage can't create control class from Kodi !!!");
67 }
68 //--------------------------------------------------------------------------
69
70 //==========================================================================
71 ///
72 /// \ingroup cpp_kodi_gui_controls_CImage
73 /// @brief Destructor
74 ///
75 ~CImage() override = default;
76 //--------------------------------------------------------------------------
77
78 //==========================================================================
79 ///
80 /// \ingroup cpp_kodi_gui_controls_CImage
81 /// @brief Set the control on window to visible
82 ///
83 /// @param[in] visible If true visible, otherwise hidden
84 ///
85 void SetVisible(bool visible)
86 {
87 m_interface->kodi_gui->control_image->set_visible(m_interface->kodiBase, m_controlHandle, visible);
88 }
89 //--------------------------------------------------------------------------
90
91 //==========================================================================
92 ///
93 /// \ingroup cpp_kodi_gui_controls_CImage
94 /// @brief To set the filename used on image control.
95 ///
96 /// @param[in] filename Image file to use
97 /// @param[in] useCache To define storage of image, default is
98 /// in cache, if false becomes it loaded
99 /// always on changes again
100 ///
101 void SetFileName(const std::string& filename, bool useCache = true)
102 {
103 m_interface->kodi_gui->control_image->set_filename(m_interface->kodiBase, m_controlHandle, filename.c_str(), useCache);
104 }
105 //--------------------------------------------------------------------------
106
107 //==========================================================================
108 ///
109 /// \ingroup cpp_kodi_gui_controls_CImage
110 /// @brief To set set the diffuse color on image.
111 ///
112 /// @param[in] colorDiffuse Color to use for diffuse
113 ///
114 void SetColorDiffuse(uint32_t colorDiffuse)
115 {
116 m_interface->kodi_gui->control_image->set_color_diffuse(m_interface->kodiBase, m_controlHandle, colorDiffuse);
117 }
118 //--------------------------------------------------------------------------
119 };
120
121} /* namespace controls */
122} /* namespace gui */
123} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Label.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Label.h
new file mode 100644
index 0000000..f74ac03
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Label.h
@@ -0,0 +1,128 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
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 KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CLabel Control Label
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CLabel }
37 /// **Window control used to show some lines of text.**
38 ///
39 /// The label control is used for displaying text in Kodi. You can choose
40 /// the font, size, colour, location and contents of the text to be displayed.
41 ///
42 /// It has the header \ref Label.h "#include <kodi/gui/controls/Label.h>"
43 /// be included to enjoy it.
44 ///
45 /// Here you find the needed skin part for a \ref Label_Control "label control"
46 ///
47 /// @note The call of the control is only possible from the corresponding
48 /// window as its class and identification number is required.
49 ///
50 class CLabel : public CAddonGUIControlBase
51 {
52 public:
53 //==========================================================================
54 ///
55 /// \ingroup cpp_kodi_gui_controls_CLabel
56 /// @brief Construct a new control
57 ///
58 /// @param[in] window related window control class
59 /// @param[in] controlId Used skin xml control id
60 ///
61 CLabel(CWindow* window, int controlId)
62 : CAddonGUIControlBase(window)
63 {
64 m_controlHandle = m_interface->kodi_gui->window->get_control_label(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
65 if (!m_controlHandle)
66 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CLabel can't create control class from Kodi !!!");
67 }
68 //--------------------------------------------------------------------------
69
70 //==========================================================================
71 ///
72 /// \ingroup cpp_kodi_gui_controls_CLabel
73 /// @brief Destructor
74 ///
75 ~CLabel() override = default;
76 //--------------------------------------------------------------------------
77
78 //==========================================================================
79 ///
80 /// \ingroup cpp_kodi_gui_controls_CLabel
81 /// @brief Set the control on window to visible
82 ///
83 /// @param[in] visible If true visible, otherwise hidden
84 ///
85 void SetVisible(bool visible)
86 {
87 m_interface->kodi_gui->control_label->set_visible(m_interface->kodiBase, m_controlHandle, visible);
88 }
89 //--------------------------------------------------------------------------
90
91 //==========================================================================
92 ///
93 /// \ingroup cpp_kodi_gui_controls_CLabel
94 /// @brief To set the text string on label
95 ///
96 /// @param[in] text Text to show
97 ///
98 void SetLabel(const std::string& text)
99 {
100 m_interface->kodi_gui->control_label->set_label(m_interface->kodiBase, m_controlHandle, text.c_str());
101 }
102 //--------------------------------------------------------------------------
103
104 //==========================================================================
105 ///
106 /// \ingroup cpp_kodi_gui_controls_CLabel
107 /// @brief Get the used text from control
108 ///
109 /// @return Used text on label control
110 ///
111 std::string GetLabel() const
112 {
113 std::string label;
114 char* ret = m_interface->kodi_gui->control_label->get_label(m_interface->kodiBase, m_controlHandle);
115 if (ret != nullptr)
116 {
117 if (std::strlen(ret))
118 label = ret;
119 m_interface->free_string(m_interface->kodiBase, ret);
120 }
121 return label;
122 }
123 //--------------------------------------------------------------------------
124 };
125
126} /* namespace controls */
127} /* namespace gui */
128} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h
new file mode 100644
index 0000000..44310ed
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h
@@ -0,0 +1,121 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
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 KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CProgress Control Progress
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CProgress }
37 /// **Window control to show the progress of a particular operation**
38 ///
39 /// The progress control is used to show the progress of an item that may take
40 /// a long time, or to show how far through a movie you are. You can choose
41 /// the position, size, and look of the progress control.
42 ///
43 /// It has the header \ref Progress.h "#include <kodi/gui/controls/Progress.h>"
44 /// be included to enjoy it.
45 ///
46 /// Here you find the needed skin part for a \ref Progress_Control "progress control"
47 ///
48 /// @note The call of the control is only possible from the corresponding
49 /// window as its class and identification number is required.
50 ///
51 class CProgress : public CAddonGUIControlBase
52 {
53 public:
54 //==========================================================================
55 ///
56 /// \ingroup cpp_kodi_gui_controls_CProgress
57 /// @brief Construct a new control
58 ///
59 /// @param[in] window related window control class
60 /// @param[in] controlId Used skin xml control id
61 ///
62 CProgress(CWindow* window, int controlId)
63 : CAddonGUIControlBase(window)
64 {
65 m_controlHandle = m_interface->kodi_gui->window->get_control_progress(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
66 if (!m_controlHandle)
67 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CProgress can't create control class from Kodi !!!");
68 }
69 //--------------------------------------------------------------------------
70
71 //==========================================================================
72 ///
73 /// \ingroup cpp_kodi_gui_controls_CProgress
74 /// @brief Destructor
75 ///
76 ~CProgress() override = default;
77 //--------------------------------------------------------------------------
78
79 //==========================================================================
80 ///
81 /// \ingroup cpp_kodi_gui_controls_CProgress
82 /// @brief Set the control on window to visible
83 ///
84 /// @param[in] visible If true visible, otherwise hidden
85 ///
86 void SetVisible(bool visible)
87 {
88 m_interface->kodi_gui->control_progress->set_visible(m_interface->kodiBase, m_controlHandle, visible);
89 }
90 //--------------------------------------------------------------------------
91
92 //==========================================================================
93 ///
94 /// \ingroup cpp_kodi_gui_controls_CProgress
95 /// @brief To set Percent position of control
96 ///
97 /// @param[in] percent The percent position to use
98 ///
99 void SetPercentage(float percent)
100 {
101 m_interface->kodi_gui->control_progress->set_percentage(m_interface->kodiBase, m_controlHandle, percent);
102 }
103 //--------------------------------------------------------------------------
104
105 //==========================================================================
106 ///
107 /// \ingroup cpp_kodi_gui_controls_CProgress
108 /// @brief Get the active percent position of progress bar
109 ///
110 /// @return Progress position as percent
111 ///
112 float GetPercentage() const
113 {
114 return m_interface->kodi_gui->control_progress->get_percentage(m_interface->kodiBase, m_controlHandle);
115 }
116 //--------------------------------------------------------------------------
117 };
118
119} /* namespace controls */
120} /* namespace gui */
121} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h
new file mode 100644
index 0000000..b87920d
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h
@@ -0,0 +1,171 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
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 KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CRadioButton Control Radio Button
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CRadioButton }
37 /// **Window control for a radio button (as used for on/off settings)**
38 ///
39 /// The radio button control is used for creating push button on/off settings
40 /// in Kodi. You can choose the position, size, and look of the button. When
41 /// the user clicks on the radio button, the state will change, toggling the
42 /// extra textures (textureradioon and textureradiooff). Used for settings
43 /// controls.
44 ///
45 /// It has the header \ref RadioButton.h "#include <kodi/gui/controls/RadioButton.h>"
46 /// be included to enjoy it.
47 ///
48 /// Here you find the needed skin part for a \ref Radio_button_control "radio button control"
49 ///
50 /// @note The call of the control is only possible from the corresponding
51 /// window as its class and identification number is required.
52 ///
53 class CRadioButton : public CAddonGUIControlBase
54 {
55 public:
56 //==========================================================================
57 ///
58 /// \ingroup cpp_kodi_gui_controls_CRadioButton
59 /// @brief Construct a new control
60 ///
61 /// @param[in] window related window control class
62 /// @param[in] controlId Used skin xml control id
63 ///
64 CRadioButton(CWindow* window, int controlId)
65 : CAddonGUIControlBase(window)
66 {
67 m_controlHandle = m_interface->kodi_gui->window->get_control_radio_button(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
68 if (!m_controlHandle)
69 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CRadioButton can't create control class from Kodi !!!");
70 }
71 //--------------------------------------------------------------------------
72
73 //==========================================================================
74 ///
75 /// \ingroup cpp_kodi_gui_controls_CRadioButton
76 /// @brief Destructor
77 ///
78 ~CRadioButton() override = default;
79 //--------------------------------------------------------------------------
80
81 //==========================================================================
82 ///
83 /// \ingroup cpp_kodi_gui_controls_CRadioButton
84 /// @brief Set the control on window to visible
85 ///
86 /// @param[in] visible If true visible, otherwise hidden
87 ///
88 void SetVisible(bool visible)
89 {
90 m_interface->kodi_gui->control_radio_button->set_visible(m_interface->kodiBase, m_controlHandle, visible);
91 }
92 //--------------------------------------------------------------------------
93
94 //==========================================================================
95 ///
96 /// \ingroup cpp_kodi_gui_controls_CRadioButton
97 /// @brief Set's the control's enabled/disabled state
98 ///
99 /// @param[in] enabled If true enabled, otherwise disabled
100 ///
101 void SetEnabled(bool enabled)
102 {
103 m_interface->kodi_gui->control_radio_button->set_enabled(m_interface->kodiBase, m_controlHandle, enabled);
104 }
105 //--------------------------------------------------------------------------
106
107 //==========================================================================
108 ///
109 /// \ingroup cpp_kodi_gui_controls_CRadioButton
110 /// @brief To set the text string on radio button
111 ///
112 /// @param[in] label Text to show
113 ///
114 void SetLabel(const std::string& label)
115 {
116 m_interface->kodi_gui->control_radio_button->set_label(m_interface->kodiBase, m_controlHandle, label.c_str());
117 }
118 //--------------------------------------------------------------------------
119
120 //==========================================================================
121 ///
122 /// \ingroup cpp_kodi_gui_controls_CRadioButton
123 /// @brief Get the used text from control
124 ///
125 /// @return Text shown
126 ///
127 std::string GetLabel() const
128 {
129 std::string label;
130 char* ret = m_interface->kodi_gui->control_radio_button->get_label(m_interface->kodiBase, m_controlHandle);
131 if (ret != nullptr)
132 {
133 if (std::strlen(ret))
134 label = ret;
135 m_interface->free_string(m_interface->kodiBase, ret);
136 }
137 return label;
138 }
139 //--------------------------------------------------------------------------
140
141 //==========================================================================
142 ///
143 /// \ingroup cpp_kodi_gui_controls_CRadioButton
144 /// @brief To set radio button condition to on or off
145 ///
146 /// @param[in] selected true set radio button to selection on, otherwise
147 /// off
148 ///
149 void SetSelected(bool selected)
150 {
151 m_interface->kodi_gui->control_radio_button->set_selected(m_interface->kodiBase, m_controlHandle, selected);
152 }
153 //--------------------------------------------------------------------------
154
155 //==========================================================================
156 ///
157 /// \ingroup cpp_kodi_gui_controls_CRadioButton
158 /// @brief Get the current selected condition of radio button
159 ///
160 /// @return Selected condition
161 ///
162 bool IsSelected() const
163 {
164 return m_interface->kodi_gui->control_radio_button->is_selected(m_interface->kodiBase, m_controlHandle);
165 }
166 //--------------------------------------------------------------------------
167 };
168
169} /* namespace controls */
170} /* namespace gui */
171} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Rendering.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Rendering.h
new file mode 100644
index 0000000..f80fcfa
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Rendering.h
@@ -0,0 +1,215 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
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 KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CRendering Control Rendering
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CRendering }
37 /// **Window control for rendering own parts**
38 ///
39 /// This rendering control is used when own parts are needed. You have the
40 /// control over them to render direct OpenGL or DirectX content to the
41 /// screen set by the size of them.
42 ///
43 /// Alternative can be the virtual functions from t his been ignored if the
44 /// callbacks are defined by the \ref CRendering_SetIndependentCallbacks function and
45 /// class is used as single and not as a parent class.
46 ///
47 /// It has the header \ref Rendering.h "#include <kodi/gui/controls/Rendering.h>"
48 /// be included to enjoy it.
49 ///
50 /// Here you find the needed skin part for a \ref Addon_Rendering_control "rendering control"
51 ///
52 /// @note The call of the control is only possible from the corresponding
53 /// window as its class and identification number is required.
54 ///
55
56 //============================================================================
57 ///
58 /// \defgroup cpp_kodi_gui_controls_CRendering_Defs Definitions, structures and enumerators
59 /// \ingroup cpp_kodi_gui_controls_CRendering
60 /// @brief **Library definition values**
61 ///
62
63 class CRendering : public CAddonGUIControlBase
64 {
65 public:
66 //==========================================================================
67 ///
68 /// \ingroup cpp_kodi_gui_controls_CRendering
69 /// @brief Construct a new control
70 ///
71 /// @param[in] window related window control class
72 /// @param[in] controlId Used skin xml control id
73 ///
74 CRendering(CWindow* window, int controlId)
75 : CAddonGUIControlBase(window)
76 {
77 m_controlHandle = m_interface->kodi_gui->window->get_control_render_addon(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
78 if (m_controlHandle)
79 m_interface->kodi_gui->control_rendering->set_callbacks(m_interface->kodiBase, m_controlHandle, this,
80 OnCreateCB, OnRenderCB, OnStopCB, OnDirtyCB);
81 else
82 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::%s can't create control class from Kodi !!!", __FUNCTION__);
83 }
84 //--------------------------------------------------------------------------
85
86 //==========================================================================
87 ///
88 /// \ingroup cpp_kodi_gui_controls_CRendering
89 /// @brief Destructor
90 ///
91 ~CRendering() override
92 {
93 m_interface->kodi_gui->control_rendering->destroy(m_interface->kodiBase, m_controlHandle);
94 }
95 //--------------------------------------------------------------------------
96
97 //==========================================================================
98 ///
99 /// \ingroup cpp_kodi_gui_controls_CRendering
100 /// @brief To create rendering control on Add-on
101 ///
102 /// Function creates the needed rendering control for Kodi which becomes
103 /// handled and processed from Add-on
104 ///
105 /// @note This is callback function from Kodi to Add-on and not to use
106 /// for calls from add-on to this function.
107 ///
108 /// @param[in] x Horizontal position
109 /// @param[in] y Vertical position
110 /// @param[in] w Width of control
111 /// @param[in] h Height of control
112 /// @param[in] device The device to use. For OpenGL is empty
113 /// on Direct X is the needed device send.
114 /// @return Add-on needs to return true if successed,
115 /// otherwise false.
116 ///
117 virtual bool Create(int x, int y, int w, int h, void* device) { return false; }
118 //--------------------------------------------------------------------------
119
120 //==========================================================================
121 ///
122 /// \ingroup cpp_kodi_gui_controls_CRendering
123 /// @brief Render process call from Kodi
124 ///
125 /// @note This is callback function from Kodi to Add-on and not to use
126 /// for calls from add-on to this function.
127 ///
128 virtual void Render() { }
129 //--------------------------------------------------------------------------
130
131 //==========================================================================
132 ///
133 /// \ingroup cpp_kodi_gui_controls_CRendering
134 /// @brief Call from Kodi to stop rendering process
135 ///
136 /// @note This is callback function from Kodi to Add-on and not to use
137 /// for calls from add-on to this function.
138 ///
139 virtual void Stop() { }
140 //--------------------------------------------------------------------------
141
142 //==========================================================================
143 ///
144 /// \ingroup cpp_kodi_gui_controls_CRendering
145 /// @brief Call from Kodi where add-on becomes asked about dirty rendering
146 /// region.
147 ///
148 /// @note This is callback function from Kodi to Add-on and not to use
149 /// for calls from add-on to this function.
150 ///
151 virtual bool Dirty() { return false; }
152 //--------------------------------------------------------------------------
153
154 //==========================================================================
155 ///
156 /// \ingroup cpp_kodi_gui_controls_CRendering
157 /// \anchor CRendering_SetIndependentCallbacks
158 /// @brief If the class is used independent (with "new CRendering")
159 /// and not as parent (with "cCLASS_own : CRendering") from own must
160 /// be the callback from Kodi to add-on overdriven with own functions!
161 ///
162 void SetIndependentCallbacks(
163 GUIHANDLE cbhdl,
164 bool (*CBCreate)(GUIHANDLE cbhdl,
165 int x,
166 int y,
167 int w,
168 int h,
169 void* device),
170 void (*CBRender)(GUIHANDLE cbhdl),
171 void (*CBStop) (GUIHANDLE cbhdl),
172 bool (*CBDirty) (GUIHANDLE cbhdl))
173 {
174 if (!cbhdl ||
175 !CBCreate || !CBRender || !CBStop || !CBDirty)
176 {
177 kodi::Log(ADDON_LOG_ERROR, "kodi::gui::controls::%s called with nullptr !!!", __FUNCTION__);
178 return;
179 }
180
181 m_interface->kodi_gui->control_rendering->set_callbacks(m_interface->kodiBase, m_controlHandle, cbhdl,
182 CBCreate, CBRender, CBStop, CBDirty);
183 }
184 //--------------------------------------------------------------------------
185
186 private:
187 /*
188 * Defined callback functions from Kodi to add-on, for use in parent / child system
189 * (is private)!
190 */
191 static bool OnCreateCB(void* cbhdl, int x, int y, int w, int h, void* device)
192 {
193 return static_cast<CRendering*>(cbhdl)->Create(x, y, w, h, device);
194 }
195
196 static void OnRenderCB(void* cbhdl)
197 {
198 static_cast<CRendering*>(cbhdl)->Render();
199 }
200
201 static void OnStopCB(void* cbhdl)
202 {
203 static_cast<CRendering*>(cbhdl)->Stop();
204 }
205
206 static bool OnDirtyCB(void* cbhdl)
207 {
208 return static_cast<CRendering*>(cbhdl)->Dirty();
209 }
210
211 };
212
213} /* namespace controls */
214} /* namespace gui */
215} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h
new file mode 100644
index 0000000..e51433a
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h
@@ -0,0 +1,323 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
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 KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CSettingsSlider Control Settings Slider
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CSettingsSlider }
37 /// **Window control for moveable slider with text name**
38 ///
39 /// The settings slider control is used in the settings screens for when an
40 /// option is best specified on a sliding scale. You can choose the position,
41 /// size, and look of the slider control. It is basically a cross between the
42 /// button control and a slider control. It has a label and focus and non
43 /// focus textures, as well as a slider control on the right.
44 ///
45 /// It has the header \ref SettingsSlider.h "#include <kodi/gui/controls/SettingsSlider.h>"
46 /// be included to enjoy it.
47 ///
48 /// Here you find the needed skin part for a \ref Settings_Slider_Control "settings slider control"
49 ///
50 /// @note The call of the control is only possible from the corresponding
51 /// window as its class and identification number is required.
52 ///
53 class CSettingsSlider : public CAddonGUIControlBase
54 {
55 public:
56 //==========================================================================
57 ///
58 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
59 /// @brief Construct a new control
60 ///
61 /// @param[in] window related window control class
62 /// @param[in] controlId Used skin xml control id
63 ///
64 CSettingsSlider(CWindow* window, int controlId)
65 : CAddonGUIControlBase(window)
66 {
67 m_controlHandle = m_interface->kodi_gui->window->get_control_settings_slider(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
68 if (!m_controlHandle)
69 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CSettingsSlider can't create control class from Kodi !!!");
70 }
71 //--------------------------------------------------------------------------
72
73 //==========================================================================
74 ///
75 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
76 /// @brief Destructor
77 ///
78 ~CSettingsSlider() override = default;
79 //--------------------------------------------------------------------------
80
81 //==========================================================================
82 ///
83 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
84 /// @brief Set the control on window to visible
85 ///
86 /// @param[in] visible If true visible, otherwise hidden
87 ///
88 void SetVisible(bool visible)
89 {
90 m_interface->kodi_gui->control_settings_slider->set_visible(m_interface->kodiBase, m_controlHandle, visible);
91 }
92 //--------------------------------------------------------------------------
93
94 //==========================================================================
95 ///
96 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
97 /// @brief Set's the control's enabled/disabled state
98 ///
99 /// @param[in] enabled If true enabled, otherwise disabled
100 ///
101 void SetEnabled(bool enabled)
102 {
103 m_interface->kodi_gui->control_settings_slider->set_enabled(m_interface->kodiBase, m_controlHandle, enabled);
104 }
105 //--------------------------------------------------------------------------
106
107 //==========================================================================
108 ///
109 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
110 /// @brief To set the text string on settings slider
111 ///
112 /// @param[in] text Text to show
113 ///
114 void SetText(const std::string& text)
115 {
116 m_interface->kodi_gui->control_settings_slider->set_text(m_interface->kodiBase, m_controlHandle, text.c_str());
117 }
118 //--------------------------------------------------------------------------
119
120 //==========================================================================
121 ///
122 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
123 /// @brief To reset slider on defaults
124 ///
125 void Reset()
126 {
127 m_interface->kodi_gui->control_settings_slider->reset(m_interface->kodiBase, m_controlHandle);
128 }
129 //--------------------------------------------------------------------------
130
131 //==========================================================================
132 ///
133 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
134 /// @brief To set the the range as integer of slider, e.g. -10 is the slider
135 /// start and e.g. +10 is the from here defined position where it reach the
136 /// end.
137 ///
138 /// Ad default is the range from 0 to 100.
139 ///
140 /// The integer interval is as default 1 and can be changed with
141 /// @ref SetIntInterval.
142 ///
143 /// @param[in] start Integer start value
144 /// @param[in] end Integer end value
145 ///
146 /// @note Percent, floating point or integer are alone possible. Combining
147 /// these different values can be not together and can, therefore, only
148 /// one each can be used.
149 ///
150 void SetIntRange(int start, int end)
151 {
152 m_interface->kodi_gui->control_settings_slider->set_int_range(m_interface->kodiBase, m_controlHandle, start, end);
153 }
154 //--------------------------------------------------------------------------
155
156 //==========================================================================
157 ///
158 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
159 /// @brief Set the slider position with the given integer value. The Range
160 /// must be defined with a call from \ref SetIntRange before.
161 ///
162 /// @param[in] value Position in range to set with integer
163 ///
164 /// @note Percent, floating point or integer are alone possible. Combining
165 /// these different values ​​can be not together and can, therefore, only
166 /// one each can be used.
167 ///
168 void SetIntValue(int value)
169 {
170 m_interface->kodi_gui->control_settings_slider->set_int_value(m_interface->kodiBase, m_controlHandle, value);
171 }
172 //--------------------------------------------------------------------------
173
174 //==========================================================================
175 ///
176 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
177 /// @brief To get the current position as integer value.
178 ///
179 /// @return The position as integer
180 ///
181 /// @note Percent, floating point or integer are alone possible. Combining
182 /// these different values ​​can be not together and can, therefore, only
183 /// one each can be used.
184 ///
185 int GetIntValue() const
186 {
187 return m_interface->kodi_gui->control_settings_slider->get_int_value(m_interface->kodiBase, m_controlHandle);
188 }
189 //--------------------------------------------------------------------------
190
191 //==========================================================================
192 ///
193 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
194 /// @brief To set the interval steps of slider, as default is it 1. If it
195 /// becomes changed with this function will a step of the user with the
196 /// value fixed here be executed.
197 ///
198 /// @param[in] interval Intervall step to set.
199 ///
200 /// @note Percent, floating point or integer are alone possible. Combining
201 /// these different values ​​can be not together and can, therefore, only
202 /// one each can be used.
203 ///
204 void SetIntInterval(int interval)
205 {
206 m_interface->kodi_gui->control_settings_slider->set_int_interval(m_interface->kodiBase, m_controlHandle, interval);
207 }
208 //--------------------------------------------------------------------------
209
210 //==========================================================================
211 ///
212 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
213 /// @brief Sets the percent of the slider.
214 ///
215 /// @param[in] percent float - Percent value of slide
216 ///
217 /// @note Percent, floating point or integer are alone possible. Combining
218 /// these different values ​​can be not together and can, therefore, only
219 /// one each can be used.
220 ///
221 void SetPercentage(float percent)
222 {
223 m_interface->kodi_gui->control_settings_slider->set_percentage(m_interface->kodiBase, m_controlHandle, percent);
224 }
225 //--------------------------------------------------------------------------
226
227 //==========================================================================
228 ///
229 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
230 /// @brief Returns a float of the percent of the slider.
231 ///
232 /// @return float - Percent of slider
233 ///
234 /// @note Percent, floating point or integer are alone possible. Combining
235 /// these different values ​​can be not together and can, therefore, only
236 /// one each can be used.
237 ///
238 float GetPercentage() const
239 {
240 return m_interface->kodi_gui->control_settings_slider->get_percentage(m_interface->kodiBase, m_controlHandle);
241 }
242 //--------------------------------------------------------------------------
243
244 //==========================================================================
245 ///
246 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
247 /// @brief To set the the range as float of slider, e.g. -25.0 is the slider
248 /// start and e.g. +25.0 is the from here defined position where it reach
249 /// the end.
250 ///
251 /// As default is the range 0.0 to 1.0.
252 ///
253 /// The float interval is as default 0.1 and can be changed with
254 /// @ref SetFloatInterval.
255 ///
256 /// @param[in] start Integer start value
257 /// @param[in] end Integer end value
258 ///
259 /// @note Percent, floating point or integer are alone possible. Combining
260 /// these different values ​​ can be not together and can, therefore, only
261 /// one each can be used.
262 ///
263 void SetFloatRange(float start, float end)
264 {
265 m_interface->kodi_gui->control_settings_slider->set_float_range(m_interface->kodiBase, m_controlHandle, start, end);
266 }
267 //--------------------------------------------------------------------------
268
269 //==========================================================================
270 ///
271 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
272 /// @brief Set the slider position with the given float value. The Range
273 /// can be defined with a call from \ref SetIntRange before, as default it
274 /// is 0.0 to 1.0.
275 ///
276 /// @param[in] value Position in range to set with float
277 ///
278 /// @note Percent, floating point or integer are alone possible. Combining
279 /// these different values ​​can be not together and can, therefore, only
280 /// one each can be used.
281 ///
282 void SetFloatValue(float value)
283 {
284 m_interface->kodi_gui->control_settings_slider->set_float_value(m_interface->kodiBase, m_controlHandle, value);
285 }
286 //--------------------------------------------------------------------------
287
288 //==========================================================================
289 ///
290 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
291 /// @brief To get the current position as float value.
292 ///
293 /// @return The position as float
294 ///
295 float GetFloatValue() const
296 {
297 return m_interface->kodi_gui->control_settings_slider->get_float_value(m_interface->kodiBase, m_controlHandle);
298 }
299 //--------------------------------------------------------------------------
300
301 //==========================================================================
302 ///
303 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
304 /// @brief To set the interval steps of slider, as default is it 0.1 If it
305 /// becomes changed with this function will a step of the user with the
306 /// value fixed here be executed.
307 ///
308 /// @param[in] interval Intervall step to set.
309 ///
310 /// @note Percent, floating point or integer are alone possible. Combining
311 /// these different values ​​can be not together and can, therefore, only
312 /// one each can be used.
313 ///
314 void SetFloatInterval(float interval)
315 {
316 m_interface->kodi_gui->control_settings_slider->set_float_interval(m_interface->kodiBase, m_controlHandle, interval);
317 }
318 //--------------------------------------------------------------------------
319 };
320
321} /* namespace controls */
322} /* namespace gui */
323} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Slider.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Slider.h
new file mode 100644
index 0000000..cbb9b8f
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Slider.h
@@ -0,0 +1,336 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
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 KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CSlider Control Slider
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CSlider }
37 /// **Window control for moveable slider**
38 ///
39 /// The slider control is used for things where a sliding bar best represents
40 /// the operation at hand (such as a volume control or seek control). You can
41 /// choose the position, size, and look of the slider control.
42 ///
43 /// It has the header \ref Slider.h "#include <kodi/gui/controls/Slider.h>"
44 /// be included to enjoy it.
45 ///
46 /// Here you find the needed skin part for a \ref Slider_Control "slider control"
47 ///
48 /// @note The call of the control is only possible from the corresponding
49 /// window as its class and identification number is required.
50 ///
51 class CSlider : public CAddonGUIControlBase
52 {
53 public:
54 //==========================================================================
55 ///
56 /// \ingroup cpp_kodi_gui_controls_CSlider
57 /// @brief Construct a new control
58 ///
59 /// @param[in] window related window control class
60 /// @param[in] controlId Used skin xml control id
61 ///
62 CSlider(CWindow* window, int controlId)
63 : CAddonGUIControlBase(window)
64 {
65 m_controlHandle = m_interface->kodi_gui->window->get_control_slider(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
66 if (!m_controlHandle)
67 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CSlider can't create control class from Kodi !!!");
68 }
69 //--------------------------------------------------------------------------
70
71 //==========================================================================
72 ///
73 /// \ingroup cpp_kodi_gui_controls_CSlider
74 /// @brief Destructor
75 ///
76 ~CSlider() override = default;
77 //--------------------------------------------------------------------------
78
79 //==========================================================================
80 ///
81 /// \ingroup cpp_kodi_gui_controls_CSlider
82 /// @brief Set the control on window to visible
83 ///
84 /// @param[in] visible If true visible, otherwise hidden
85 ///
86 void SetVisible(bool visible)
87 {
88 m_interface->kodi_gui->control_slider->set_visible(m_interface->kodiBase, m_controlHandle, visible);
89 }
90 //--------------------------------------------------------------------------
91
92 //==========================================================================
93 ///
94 /// \ingroup cpp_kodi_gui_controls_CSlider
95 /// @brief Set's the control's enabled/disabled state
96 ///
97 /// @param[in] enabled If true enabled, otherwise disabled
98 ///
99 void SetEnabled(bool enabled)
100 {
101 m_interface->kodi_gui->control_slider->set_enabled(m_interface->kodiBase, m_controlHandle, enabled);
102 }
103 //--------------------------------------------------------------------------
104
105 //==========================================================================
106 ///
107 /// \ingroup cpp_kodi_gui_controls_CSlider
108 /// @brief To reset slider on defaults
109 ///
110 void Reset()
111 {
112 m_interface->kodi_gui->control_slider->reset(m_interface->kodiBase, m_controlHandle);
113 }
114 //--------------------------------------------------------------------------
115
116 //==========================================================================
117 ///
118 /// \ingroup cpp_kodi_gui_controls_CSlider
119 /// @brief With GetDescription becomes a string value of position returned.
120 ///
121 /// @return Text string about current slider position
122 ///
123 /// The following are the text definition returned from this:
124 /// | Value | Without range selection | With range selection |
125 /// |:---------:|:------------------------|:-------------------------------|
126 /// | float | <c>%2.2f</c> | <c>[%2.2f, %2.2f]</c> |
127 /// | integer | <c>%i</c> | <c>[%i, %i]</c> |
128 /// | percent | <c>%i%%</c> | <c>[%i%%, %i%%]</c> |
129 ///
130 std::string GetDescription() const
131 {
132 std::string text;
133 char* ret = m_interface->kodi_gui->control_slider->get_description(m_interface->kodiBase, m_controlHandle);
134 if (ret != nullptr)
135 {
136 if (std::strlen(ret))
137 text = ret;
138 m_interface->free_string(m_interface->kodiBase, ret);
139 }
140 return text;
141 }
142 //--------------------------------------------------------------------------
143
144 //==========================================================================
145 ///
146 /// \ingroup cpp_kodi_gui_controls_CSlider
147 /// @brief To set the the range as integer of slider, e.g. -10 is the slider
148 /// start and e.g. +10 is the from here defined position where it reach the
149 /// end.
150 ///
151 /// Ad default is the range from 0 to 100.
152 ///
153 /// The integer interval is as default 1 and can be changed with
154 /// @ref SetIntInterval.
155 ///
156 /// @param[in] start Integer start value
157 /// @param[in] end Integer end value
158 ///
159 /// @note Percent, floating point or integer are alone possible. Combining
160 /// these different values can be not together and can, therefore, only one
161 /// each can be used.
162 ///
163 void SetIntRange(int start, int end)
164 {
165 m_interface->kodi_gui->control_slider->set_int_range(m_interface->kodiBase, m_controlHandle, start, end);
166 }
167 //--------------------------------------------------------------------------
168
169 //==========================================================================
170 ///
171 /// \ingroup CSlider
172 /// @brief Set the slider position with the given integer value. The Range
173 /// must be defined with a call from \ref SetIntRange before.
174 ///
175 /// @param[in] value Position in range to set with integer
176 ///
177 /// @note Percent, floating point or integer are alone possible. Combining
178 /// these different values can be not together and can, therefore, only one
179 /// each can be used.
180 ///
181 void SetIntValue(int value)
182 {
183 m_interface->kodi_gui->control_slider->set_int_value(m_interface->kodiBase, m_controlHandle, value);
184 }
185 //--------------------------------------------------------------------------
186
187 //==========================================================================
188 ///
189 /// \ingroup cpp_kodi_gui_controls_CSlider
190 /// @brief To get the current position as integer value.
191 ///
192 /// @return The position as integer
193 ///
194 /// @note Percent, floating point or integer are alone possible. Combining
195 /// these different values can be not together and can, therefore, only
196 /// one each can be used.
197 ///
198 int GetIntValue() const
199 {
200 return m_interface->kodi_gui->control_slider->get_int_value(m_interface->kodiBase, m_controlHandle);
201 }
202 //--------------------------------------------------------------------------
203
204 //==========================================================================
205 ///
206 /// \ingroup cpp_kodi_gui_controls_CSlider
207 /// @brief To set the interval steps of slider, as default is it 1. If it
208 /// becomes changed with this function will a step of the user with the
209 /// value fixed here be executed.
210 ///
211 /// @param[in] interval Intervall step to set.
212 ///
213 /// @note Percent, floating point or integer are alone possible. Combining
214 /// these different values can be not together and can, therefore, only one
215 /// each can be used.
216 ///
217 void SetIntInterval(int interval)
218 {
219 m_interface->kodi_gui->control_slider->set_int_interval(m_interface->kodiBase, m_controlHandle, interval);
220 }
221 //--------------------------------------------------------------------------
222
223 //==========================================================================
224 ///
225 /// \ingroup cpp_kodi_gui_controls_CSlider
226 /// @brief Sets the percent of the slider.
227 ///
228 /// @param[in] percent float - Percent value of slide
229 ///
230 /// @note Percent, floating point or integer are alone possible. Combining
231 /// these different values can be not together and can, therefore, only one
232 /// each can be used.
233 ///
234 void SetPercentage(float percent)
235 {
236 m_interface->kodi_gui->control_slider->set_percentage(m_interface->kodiBase, m_controlHandle, percent);
237 }
238 //--------------------------------------------------------------------------
239
240 //==========================================================================
241 ///
242 /// \ingroup cpp_kodi_gui_controls_CSlider
243 /// @brief Returns a float of the percent of the slider.
244 ///
245 /// @return float - Percent of slider
246 ///
247 /// @note Percent, floating point or integer are alone possible. Combining
248 /// these different values can be not together and can, therefore, only one
249 /// each can be used.
250 ///
251 float GetPercentage() const
252 {
253 return m_interface->kodi_gui->control_slider->get_percentage(m_interface->kodiBase, m_controlHandle);
254 }
255 //--------------------------------------------------------------------------
256
257 //==========================================================================
258 ///
259 /// \ingroup cpp_kodi_gui_controls_CSlider
260 /// @brief To set the the range as float of slider, e.g. -25.0 is the slider
261 /// start and e.g. +25.0 is the from here defined position where it reach
262 /// the end.
263 ///
264 /// As default is the range 0.0 to 1.0.
265 ///
266 /// The float interval is as default 0.1 and can be changed with
267 /// @ref SetFloatInterval.
268 ///
269 /// @param[in] start Integer start value
270 /// @param[in] end Integer end value
271 ///
272 /// @note Percent, floating point or integer are alone possible. Combining
273 /// these different values can be not together and can, therefore, only
274 /// one each can be used.
275 ///
276 void SetFloatRange(float start, float end)
277 {
278 m_interface->kodi_gui->control_slider->set_float_range(m_interface->kodiBase, m_controlHandle, start, end);
279 }
280 //--------------------------------------------------------------------------
281
282 //==========================================================================
283 ///
284 /// \ingroup cpp_kodi_gui_controls_CSlider
285 /// @brief Set the slider position with the given float value. The Range
286 /// can be defined with a call from \ref SetIntRange before, as default it
287 /// is 0.0 to 1.0.
288 ///
289 /// @param[in] value Position in range to set with float
290 ///
291 /// @note Percent, floating point or integer are alone possible. Combining
292 /// these different values can be not together and can, therefore, only one
293 /// each can be used.
294 ///
295 void SetFloatValue(float value)
296 {
297 m_interface->kodi_gui->control_slider->set_float_value(m_interface->kodiBase, m_controlHandle, value);
298 }
299 //--------------------------------------------------------------------------
300
301 //==========================================================================
302 ///
303 /// \ingroup cpp_kodi_gui_controls_CSlider
304 /// @brief To get the current position as float value.
305 ///
306 /// @return The position as float
307 ///
308 float GetFloatValue() const
309 {
310 return m_interface->kodi_gui->control_slider->get_float_value(m_interface->kodiBase, m_controlHandle);
311 }
312 //--------------------------------------------------------------------------
313
314 //==========================================================================
315 ///
316 /// \ingroup cpp_kodi_gui_controls_CSlider
317 /// @brief To set the interval steps of slider, as default is it 0.1 If it
318 /// becomes changed with this function will a step of the user with the
319 /// value fixed here be executed.
320 ///
321 /// @param[in] interval Intervall step to set.
322 ///
323 /// @note Percent, floating point or integer are alone possible. Combining
324 /// these different values can be not together and can, therefore, only
325 /// one each can be used.
326 ///
327 void SetFloatInterval(float interval)
328 {
329 m_interface->kodi_gui->control_slider->set_float_interval(m_interface->kodiBase, m_controlHandle, interval);
330 }
331 //--------------------------------------------------------------------------
332 };
333
334} /* namespace controls */
335} /* namespace gui */
336} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h
new file mode 100644
index 0000000..b39cd06
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h
@@ -0,0 +1,376 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
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 KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CSpin Control Spin
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CSpin }
37 /// **Window control used for cycling up/down controls**
38 ///
39 /// The settings spin control is used in the settings screens for when a list
40 /// of options can be chosen from using up/down arrows. You can choose the
41 /// position, size, and look of the spin control. It is basically a cross
42 /// between the button control and a spin control. It has a label and focus
43 /// and non focus textures, as well as a spin control on the right.
44 ///
45 /// It has the header \ref Spin.h "#include <kodi/gui/controls/Spin.h>"
46 /// be included to enjoy it.
47 ///
48 /// Here you find the needed skin part for a \ref Spin_Control "spin control"
49 ///
50 /// @note The call of the control is only possible from the corresponding
51 /// window as its class and identification number is required.
52 ///
53
54
55 //============================================================================
56 ///
57 /// \ingroup cpp_kodi_gui_controls_CSpin
58 /// @anchor AddonGUISpinControlType
59 /// @brief The values here defines the used value format for steps on
60 /// spin control.
61 ///
62 typedef enum AddonGUISpinControlType
63 {
64 /// One spin step interpreted as integer
65 ADDON_SPIN_CONTROL_TYPE_INT = 1,
66 /// One spin step interpreted as floating point value
67 ADDON_SPIN_CONTROL_TYPE_FLOAT = 2,
68 /// One spin step interpreted as text string
69 ADDON_SPIN_CONTROL_TYPE_TEXT = 3,
70 /// One spin step interpreted as a page change value
71 ADDON_SPIN_CONTROL_TYPE_PAGE = 4
72 } AddonGUISpinControlType;
73 //----------------------------------------------------------------------------
74
75 class CSpin : public CAddonGUIControlBase
76 {
77 public:
78 //==========================================================================
79 ///
80 /// \ingroup cpp_kodi_gui_controls_CSpin
81 /// @brief Construct a new control
82 ///
83 /// @param[in] window related window control class
84 /// @param[in] controlId Used skin xml control id
85 ///
86 CSpin(CWindow* window, int controlId)
87 : CAddonGUIControlBase(window)
88 {
89 m_controlHandle = m_interface->kodi_gui->window->get_control_spin(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
90 if (!m_controlHandle)
91 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CSpin can't create control class from Kodi !!!");
92 }
93 //--------------------------------------------------------------------------
94
95 //==========================================================================
96 ///
97 /// \ingroup cpp_kodi_gui_controls_CSpin
98 /// @brief Destructor
99 ///
100 ~CSpin() override = default;
101 //--------------------------------------------------------------------------
102
103 //==========================================================================
104 ///
105 /// \ingroup cpp_kodi_gui_controls_CSpin
106 /// @brief Set the control on window to visible
107 ///
108 /// @param[in] visible If true visible, otherwise hidden
109 ///
110 void SetVisible(bool visible)
111 {
112 m_interface->kodi_gui->control_spin->set_visible(m_interface->kodiBase, m_controlHandle, visible);
113 }
114 //--------------------------------------------------------------------------
115
116 //==========================================================================
117 ///
118 /// \ingroup cpp_kodi_gui_controls_CSpin
119 /// @brief Set's the control's enabled/disabled state
120 ///
121 /// @param[in] enabled If true enabled, otherwise disabled
122 ///
123 void SetEnabled(bool enabled)
124 {
125 m_interface->kodi_gui->control_spin->set_enabled(m_interface->kodiBase, m_controlHandle, enabled);
126 }
127 //--------------------------------------------------------------------------
128
129 //==========================================================================
130 ///
131 /// \ingroup cpp_kodi_gui_controls_CSpin
132 /// @brief To set the text string on spin control
133 ///
134 /// @param[in] text Text to show as name for spin
135 ///
136 void SetText(const std::string& text)
137 {
138 m_interface->kodi_gui->control_spin->set_text(m_interface->kodiBase, m_controlHandle, text.c_str());
139 }
140 //--------------------------------------------------------------------------
141
142 //==========================================================================
143 ///
144 /// \ingroup cpp_kodi_gui_controls_CSpin
145 /// @brief To reset spin control to defaults
146 ///
147 void Reset()
148 {
149 m_interface->kodi_gui->control_spin->reset(m_interface->kodiBase, m_controlHandle);
150 }
151 //--------------------------------------------------------------------------
152
153 //==========================================================================
154 ///
155 /// \ingroup cpp_kodi_gui_controls_CSpin
156 /// @brief To set the with SpinControlType defined types of spin.
157 ///
158 /// @param[in] type The type to use
159 ///
160 /// @note See description of \ref AddonGUISpinControlType for available types.
161 ///
162 void SetType(AddonGUISpinControlType type)
163 {
164 m_interface->kodi_gui->control_spin->set_type(m_interface->kodiBase, m_controlHandle, (int)type);
165 }
166 //--------------------------------------------------------------------------
167
168 //==========================================================================
169 ///
170 /// \ingroup cpp_kodi_gui_controls_CSpin
171 /// @brief To add a label entry in spin defined with a value as string.
172 ///
173 /// Format must be set to ADDON_SPIN_CONTROL_TYPE_TEXT to use this function.
174 ///
175 /// @param[in] label Label string to view on skin
176 /// @param[in] value String value to use for selection
177 /// of them.
178 ///
179 void AddLabel(const std::string& label, const std::string& value)
180 {
181 m_interface->kodi_gui->control_spin->add_string_label(m_interface->kodiBase, m_controlHandle, label.c_str(), value.c_str());
182 }
183 //--------------------------------------------------------------------------
184
185 //==========================================================================
186 ///
187 /// \ingroup cpp_kodi_gui_controls_CSpin
188 /// @brief To add a label entry in spin defined with a value as integer.
189 ///
190 /// Format must be set to ADDON_SPIN_CONTROL_TYPE_INT to use this function.
191 ///
192 /// @param[in] label Label string to view on skin
193 /// @param[in] value Integer value to use for selection
194 /// of them.
195 ///
196 void AddLabel(const std::string& label, int value)
197 {
198 m_interface->kodi_gui->control_spin->add_int_label(m_interface->kodiBase, m_controlHandle, label.c_str(), value);
199 }
200 //--------------------------------------------------------------------------
201
202 //==========================================================================
203 ///
204 /// \ingroup cpp_kodi_gui_controls_CSpin
205 /// @brief To change the spin to position with them string as value.
206 ///
207 /// Format must be set to ADDON_SPIN_CONTROL_TYPE_TEXT to use this function.
208 ///
209 /// @param[in] value String value to change to
210 ///
211 void SetStringValue(const std::string& value)
212 {
213 m_interface->kodi_gui->control_spin->set_string_value(m_interface->kodiBase, m_controlHandle, value.c_str());
214 }
215 //--------------------------------------------------------------------------
216
217 //==========================================================================
218 ///
219 /// \ingroup cpp_kodi_gui_controls_CSpin
220 /// @brief To get the current spin control position with text string value.
221 ///
222 /// Format must be set to ADDON_SPIN_CONTROL_TYPE_TEXT to use this function.
223 ///
224 /// @return Currently selected string value
225 ///
226 std::string GetStringValue() const
227 {
228 std::string value;
229 char* ret = m_interface->kodi_gui->control_spin->get_string_value(m_interface->kodiBase, m_controlHandle);
230 if (ret != nullptr)
231 {
232 if (std::strlen(ret))
233 value = ret;
234 m_interface->free_string(m_interface->kodiBase, ret);
235 }
236 return value;
237 }
238 //--------------------------------------------------------------------------
239
240 //==========================================================================
241 ///
242 /// \ingroup cpp_kodi_gui_controls_CSpin
243 /// @brief To set the the range as integer of slider, e.g. -10 is the slider
244 /// start and e.g. +10 is the from here defined position where it reach the
245 /// end.
246 ///
247 /// Ad default is the range from 0 to 100.
248 ///
249 /// @param[in] start Integer start value
250 /// @param[in] end Integer end value
251 ///
252 /// @note Percent, floating point or integer are alone possible. Combining
253 /// these different values can be not together and can, therefore, only
254 /// one each can be used and must be defined with \ref SetType before.
255 ///
256 void SetIntRange(int start, int end)
257 {
258 m_interface->kodi_gui->control_spin->set_int_range(m_interface->kodiBase, m_controlHandle, start, end);
259 }
260 //--------------------------------------------------------------------------
261
262 //==========================================================================
263 ///
264 /// \ingroup cpp_kodi_gui_controls_CSpin
265 /// @brief Set the slider position with the given integer value. The Range
266 /// must be defined with a call from \ref SetIntRange before.
267 ///
268 /// @param[in] value Position in range to set with integer
269 ///
270 /// @note Percent, floating point or integer are alone possible. Combining
271 /// these different values can be not together and can, therefore, only
272 /// one each can be used and must be defined with \ref SetType before.
273 ///
274 void SetIntValue(int value)
275 {
276 m_interface->kodi_gui->control_spin->set_int_value(m_interface->kodiBase, m_controlHandle, value);
277 }
278 //--------------------------------------------------------------------------
279
280 //==========================================================================
281 ///
282 /// \ingroup cpp_kodi_gui_controls_CSpin
283 /// @brief To get the current position as integer value.
284 ///
285 /// @return The position as integer
286 ///
287 /// @note Percent, floating point or integer are alone possible. Combining
288 /// these different values can be not together and can, therefore, only
289 /// one each can be used and must be defined with \ref SetType before.
290 ///
291 int GetIntValue() const
292 {
293 return m_interface->kodi_gui->control_spin->get_int_value(m_interface->kodiBase, m_controlHandle);
294 }
295 //--------------------------------------------------------------------------
296
297 //==========================================================================
298 ///
299 /// \ingroup cpp_kodi_gui_controls_CSpin
300 /// @brief To set the the range as float of spin, e.g. -25.0 is the spin
301 /// start and e.g. +25.0 is the from here defined position where it reach
302 /// the end.
303 ///
304 /// As default is the range 0.0 to 1.0.
305 ///
306 /// The float interval is as default 0.1 and can be changed with
307 /// @ref SetFloatInterval.
308 ///
309 /// @param[in] start Integer start value
310 /// @param[in] end Integer end value
311 ///
312 /// @note Percent, floating point or integer are alone possible. Combining
313 /// these different values can be not together and can, therefore, only
314 /// one each can be used and must be defined with \ref SetType before.
315 ///
316 void SetFloatRange(float start, float end)
317 {
318 m_interface->kodi_gui->control_spin->set_float_range(m_interface->kodiBase, m_controlHandle, start, end);
319 }
320 //--------------------------------------------------------------------------
321
322 //==========================================================================
323 ///
324 /// \ingroup cpp_kodi_gui_controls_CSpin
325 /// @brief Set the spin position with the given float value. The Range
326 /// can be defined with a call from \ref SetIntRange before, as default it
327 /// is 0.0 to 1.0.
328 ///
329 /// @param[in] value Position in range to set with float
330 ///
331 /// @note Percent, floating point or integer are alone possible. Combining
332 /// these different values can be not together and can, therefore, only
333 /// one each can be used and must be defined with \ref SetType before.
334 ///
335 void SetFloatValue(float value)
336 {
337 m_interface->kodi_gui->control_spin->set_float_value(m_interface->kodiBase, m_controlHandle, value);
338 }
339 //--------------------------------------------------------------------------
340
341 //==========================================================================
342 ///
343 /// \ingroup cpp_kodi_gui_controls_CSpin
344 /// @brief To get the current position as float value.
345 ///
346 /// @return The position as float
347 ///
348 float GetFloatValue() const
349 {
350 return m_interface->kodi_gui->control_spin->get_float_value(m_interface->kodiBase, m_controlHandle);
351 }
352 //--------------------------------------------------------------------------
353
354 //==========================================================================
355 ///
356 /// \ingroup cpp_kodi_gui_controls_CSpin
357 /// @brief To set the interval steps of spin, as default is it 0.1 If it
358 /// becomes changed with this function will a step of the user with the
359 /// value fixed here be executed.
360 ///
361 /// @param[in] interval Intervall step to set.
362 ///
363 /// @note Percent, floating point or integer are alone possible. Combining
364 /// these different values can be not together and can, therefore, only
365 /// one each can be used and must be defined with \ref SetType before.
366 ///
367 void SetFloatInterval(float interval)
368 {
369 m_interface->kodi_gui->control_spin->set_float_interval(m_interface->kodiBase, m_controlHandle, interval);
370 }
371 //--------------------------------------------------------------------------
372 };
373
374} /* namespace controls */
375} /* namespace gui */
376} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h
new file mode 100644
index 0000000..9d8976e
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h
@@ -0,0 +1,176 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
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 KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CTextBox Control Text Box
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CTextBox }
37 /// **Used to show a multi-page piece of text**
38 ///
39 /// The text box control can be used to display descriptions, help texts or
40 /// other larger texts. It corresponds to the representation which is also to
41 /// be seen on the CDialogTextViewer.
42 ///
43 /// It has the header \ref TextBox.h "#include <kodi/gui/controls/TextBox.h>"
44 /// be included to enjoy it.
45 ///
46 /// Here you find the needed skin part for a \ref Text_Box "textbox control".
47 ///
48 /// @note The call of the control is only possible from the corresponding
49 /// window as its class and identification number is required.
50 ///
51 class CTextBox : public CAddonGUIControlBase
52 {
53 public:
54 //==========================================================================
55 ///
56 /// \ingroup cpp_kodi_gui_controls_CTextBox
57 /// @brief Construct a new control
58 ///
59 /// @param[in] window related window control class
60 /// @param[in] controlId Used skin xml control id
61 ///
62 CTextBox(CWindow* window, int controlId)
63 : CAddonGUIControlBase(window)
64 {
65 m_controlHandle = m_interface->kodi_gui->window->get_control_text_box(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
66 if (!m_controlHandle)
67 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CTextBox can't create control class from Kodi !!!");
68 }
69 //--------------------------------------------------------------------------
70
71 //==========================================================================
72 ///
73 /// \ingroup cpp_kodi_gui_controls_CTextBox
74 /// @brief Destructor
75 ///
76 ~CTextBox() override = default;
77 //--------------------------------------------------------------------------
78
79 //==========================================================================
80 ///
81 /// \ingroup cpp_kodi_gui_controls_CTextBox
82 /// @brief Set the control on window to visible
83 ///
84 /// @param[in] visible If true visible, otherwise hidden
85 ///
86 void SetVisible(bool visible)
87 {
88 m_interface->kodi_gui->control_text_box->set_visible(m_interface->kodiBase, m_controlHandle, visible);
89 }
90 //--------------------------------------------------------------------------
91
92 //==========================================================================
93 ///
94 /// \ingroup cpp_kodi_gui_controls_CTextBox
95 /// @brief To reset box an remove all the text
96 ///
97 void Reset()
98 {
99 m_interface->kodi_gui->control_text_box->reset(m_controlHandle, m_controlHandle);
100 }
101 //--------------------------------------------------------------------------
102
103 //==========================================================================
104 ///
105 /// \ingroup cpp_kodi_gui_controls_CTextBox
106 /// @brief To set the text on box
107 ///
108 /// @param[in] text Text to show
109 ///
110 void SetText(const std::string& text)
111 {
112 m_interface->kodi_gui->control_text_box->set_text(m_interface->kodiBase, m_controlHandle, text.c_str());
113 }
114 //--------------------------------------------------------------------------
115
116 //==========================================================================
117 ///
118 /// \ingroup cpp_kodi_gui_controls_CTextBox
119 /// @brief Get the used text from control
120 ///
121 /// @return Text shown
122 ///
123 std::string GetText() const
124 {
125 std::string text;
126 char* ret = m_interface->kodi_gui->control_text_box->get_text(m_interface->kodiBase, m_controlHandle);
127 if (ret != nullptr)
128 {
129 if (std::strlen(ret))
130 text = ret;
131 m_interface->free_string(m_interface->kodiBase, ret);
132 }
133 return text;
134 }
135 //--------------------------------------------------------------------------
136
137 //==========================================================================
138 ///
139 /// \ingroup cpp_kodi_gui_controls_CTextBox
140 /// @brief To scroll text on other position
141 ///
142 /// @param[in] position The line position to scroll to
143 ///
144 void Scroll(unsigned int position)
145 {
146 m_interface->kodi_gui->control_text_box->scroll(m_interface->kodiBase, m_controlHandle, position);
147 }
148 //--------------------------------------------------------------------------
149
150 //==========================================================================
151 ///
152 /// \ingroup cpp_kodi_gui_controls_CTextBox
153 /// @brief To set automatic scrolling of textbox
154 ///
155 /// Specifies the timing and conditions of any autoscrolling this textbox
156 /// should have. Times are in milliseconds. The content is delayed for the
157 /// given delay, then scrolls at a rate of one line per time interval until
158 /// the end. If the repeat tag is present, it then delays for the repeat
159 /// time, fades out over 1 second, and repeats. It does not wrap or reset
160 /// to the top at the end of the scroll.
161 ///
162 /// @param[in] delay Content delay
163 /// @param[in] time One line per time interval
164 /// @param[in] repeat Delays with given time, fades out over 1
165 /// second, and repeats
166 ///
167 void SetAutoScrolling(int delay, int time, int repeat)
168 {
169 m_interface->kodi_gui->control_text_box->set_auto_scrolling(m_interface->kodiBase, m_controlHandle, delay, time, repeat);
170 }
171 //--------------------------------------------------------------------------
172 };
173
174} /* namespace controls */
175} /* namespace gui */
176} /* namespace kodi */