summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2020-10-19 00:52:24 +0200
committermanuel <manuel@mausz.at>2020-10-19 00:52:24 +0200
commitbe933ef2241d79558f91796cc5b3a161f72ebf9c (patch)
treefe3ab2f130e20c99001f2d7a81d610c78c96a3f4 /xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h
parent5f8335c1e49ce108ef3481863833c98efa00411b (diff)
downloadkodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.gz
kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.bz2
kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.zip
sync with upstream
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h')
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h365
1 files changed, 0 insertions, 365 deletions
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
deleted file mode 100644
index db8d491..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h
+++ /dev/null
@@ -1,365 +0,0 @@
1/*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include "../../AddonBase.h"
12#include "../Window.h"
13
14namespace kodi
15{
16namespace gui
17{
18namespace controls
19{
20
21 //============================================================================
22 ///
23 /// \defgroup cpp_kodi_gui_controls_CSpin Control Spin
24 /// \ingroup cpp_kodi_gui
25 /// @brief \cpp_class{ kodi::gui::controls::CSpin }
26 /// **Window control used for cycling up/down controls**
27 ///
28 /// The settings spin control is used in the settings screens for when a list
29 /// of options can be chosen from using up/down arrows. You can choose the
30 /// position, size, and look of the spin control. It is basically a cross
31 /// between the button control and a spin control. It has a label and focus
32 /// and non focus textures, as well as a spin control on the right.
33 ///
34 /// It has the header \ref Spin.h "#include <kodi/gui/controls/Spin.h>"
35 /// be included to enjoy it.
36 ///
37 /// Here you find the needed skin part for a \ref Spin_Control "spin control"
38 ///
39 /// @note The call of the control is only possible from the corresponding
40 /// window as its class and identification number is required.
41 ///
42
43
44 //============================================================================
45 ///
46 /// \ingroup cpp_kodi_gui_controls_CSpin
47 /// @anchor AddonGUISpinControlType
48 /// @brief The values here defines the used value format for steps on
49 /// spin control.
50 ///
51 typedef enum AddonGUISpinControlType
52 {
53 /// One spin step interpreted as integer
54 ADDON_SPIN_CONTROL_TYPE_INT = 1,
55 /// One spin step interpreted as floating point value
56 ADDON_SPIN_CONTROL_TYPE_FLOAT = 2,
57 /// One spin step interpreted as text string
58 ADDON_SPIN_CONTROL_TYPE_TEXT = 3,
59 /// One spin step interpreted as a page change value
60 ADDON_SPIN_CONTROL_TYPE_PAGE = 4
61 } AddonGUISpinControlType;
62 //----------------------------------------------------------------------------
63
64 class ATTRIBUTE_HIDDEN CSpin : public CAddonGUIControlBase
65 {
66 public:
67 //==========================================================================
68 ///
69 /// \ingroup cpp_kodi_gui_controls_CSpin
70 /// @brief Construct a new control
71 ///
72 /// @param[in] window related window control class
73 /// @param[in] controlId Used skin xml control id
74 ///
75 CSpin(CWindow* window, int controlId)
76 : CAddonGUIControlBase(window)
77 {
78 m_controlHandle = m_interface->kodi_gui->window->get_control_spin(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
79 if (!m_controlHandle)
80 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CSpin can't create control class from Kodi !!!");
81 }
82 //--------------------------------------------------------------------------
83
84 //==========================================================================
85 ///
86 /// \ingroup cpp_kodi_gui_controls_CSpin
87 /// @brief Destructor
88 ///
89 ~CSpin() override = default;
90 //--------------------------------------------------------------------------
91
92 //==========================================================================
93 ///
94 /// \ingroup cpp_kodi_gui_controls_CSpin
95 /// @brief Set the control on window to visible
96 ///
97 /// @param[in] visible If true visible, otherwise hidden
98 ///
99 void SetVisible(bool visible)
100 {
101 m_interface->kodi_gui->control_spin->set_visible(m_interface->kodiBase, m_controlHandle, visible);
102 }
103 //--------------------------------------------------------------------------
104
105 //==========================================================================
106 ///
107 /// \ingroup cpp_kodi_gui_controls_CSpin
108 /// @brief Set's the control's enabled/disabled state
109 ///
110 /// @param[in] enabled If true enabled, otherwise disabled
111 ///
112 void SetEnabled(bool enabled)
113 {
114 m_interface->kodi_gui->control_spin->set_enabled(m_interface->kodiBase, m_controlHandle, enabled);
115 }
116 //--------------------------------------------------------------------------
117
118 //==========================================================================
119 ///
120 /// \ingroup cpp_kodi_gui_controls_CSpin
121 /// @brief To set the text string on spin control
122 ///
123 /// @param[in] text Text to show as name for spin
124 ///
125 void SetText(const std::string& text)
126 {
127 m_interface->kodi_gui->control_spin->set_text(m_interface->kodiBase, m_controlHandle, text.c_str());
128 }
129 //--------------------------------------------------------------------------
130
131 //==========================================================================
132 ///
133 /// \ingroup cpp_kodi_gui_controls_CSpin
134 /// @brief To reset spin control to defaults
135 ///
136 void Reset()
137 {
138 m_interface->kodi_gui->control_spin->reset(m_interface->kodiBase, m_controlHandle);
139 }
140 //--------------------------------------------------------------------------
141
142 //==========================================================================
143 ///
144 /// \ingroup cpp_kodi_gui_controls_CSpin
145 /// @brief To set the with SpinControlType defined types of spin.
146 ///
147 /// @param[in] type The type to use
148 ///
149 /// @note See description of \ref AddonGUISpinControlType for available types.
150 ///
151 void SetType(AddonGUISpinControlType type)
152 {
153 m_interface->kodi_gui->control_spin->set_type(m_interface->kodiBase, m_controlHandle, (int)type);
154 }
155 //--------------------------------------------------------------------------
156
157 //==========================================================================
158 ///
159 /// \ingroup cpp_kodi_gui_controls_CSpin
160 /// @brief To add a label entry in spin defined with a value as string.
161 ///
162 /// Format must be set to ADDON_SPIN_CONTROL_TYPE_TEXT to use this function.
163 ///
164 /// @param[in] label Label string to view on skin
165 /// @param[in] value String value to use for selection
166 /// of them.
167 ///
168 void AddLabel(const std::string& label, const std::string& value)
169 {
170 m_interface->kodi_gui->control_spin->add_string_label(m_interface->kodiBase, m_controlHandle, label.c_str(), value.c_str());
171 }
172 //--------------------------------------------------------------------------
173
174 //==========================================================================
175 ///
176 /// \ingroup cpp_kodi_gui_controls_CSpin
177 /// @brief To add a label entry in spin defined with a value as integer.
178 ///
179 /// Format must be set to ADDON_SPIN_CONTROL_TYPE_INT to use this function.
180 ///
181 /// @param[in] label Label string to view on skin
182 /// @param[in] value Integer value to use for selection
183 /// of them.
184 ///
185 void AddLabel(const std::string& label, int value)
186 {
187 m_interface->kodi_gui->control_spin->add_int_label(m_interface->kodiBase, m_controlHandle, label.c_str(), value);
188 }
189 //--------------------------------------------------------------------------
190
191 //==========================================================================
192 ///
193 /// \ingroup cpp_kodi_gui_controls_CSpin
194 /// @brief To change the spin to position with them string as value.
195 ///
196 /// Format must be set to ADDON_SPIN_CONTROL_TYPE_TEXT to use this function.
197 ///
198 /// @param[in] value String value to change to
199 ///
200 void SetStringValue(const std::string& value)
201 {
202 m_interface->kodi_gui->control_spin->set_string_value(m_interface->kodiBase, m_controlHandle, value.c_str());
203 }
204 //--------------------------------------------------------------------------
205
206 //==========================================================================
207 ///
208 /// \ingroup cpp_kodi_gui_controls_CSpin
209 /// @brief To get the current spin control position with text string value.
210 ///
211 /// Format must be set to ADDON_SPIN_CONTROL_TYPE_TEXT to use this function.
212 ///
213 /// @return Currently selected string value
214 ///
215 std::string GetStringValue() const
216 {
217 std::string value;
218 char* ret = m_interface->kodi_gui->control_spin->get_string_value(m_interface->kodiBase, m_controlHandle);
219 if (ret != nullptr)
220 {
221 if (std::strlen(ret))
222 value = ret;
223 m_interface->free_string(m_interface->kodiBase, ret);
224 }
225 return value;
226 }
227 //--------------------------------------------------------------------------
228
229 //==========================================================================
230 ///
231 /// \ingroup cpp_kodi_gui_controls_CSpin
232 /// @brief To set the the range as integer of slider, e.g. -10 is the slider
233 /// start and e.g. +10 is the from here defined position where it reach the
234 /// end.
235 ///
236 /// Ad default is the range from 0 to 100.
237 ///
238 /// @param[in] start Integer start value
239 /// @param[in] end Integer end value
240 ///
241 /// @note Percent, floating point or integer are alone possible. Combining
242 /// these different values can be not together and can, therefore, only
243 /// one each can be used and must be defined with \ref SetType before.
244 ///
245 void SetIntRange(int start, int end)
246 {
247 m_interface->kodi_gui->control_spin->set_int_range(m_interface->kodiBase, m_controlHandle, start, end);
248 }
249 //--------------------------------------------------------------------------
250
251 //==========================================================================
252 ///
253 /// \ingroup cpp_kodi_gui_controls_CSpin
254 /// @brief Set the slider position with the given integer value. The Range
255 /// must be defined with a call from \ref SetIntRange before.
256 ///
257 /// @param[in] value Position in range to set with integer
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 and must be defined with \ref SetType before.
262 ///
263 void SetIntValue(int value)
264 {
265 m_interface->kodi_gui->control_spin->set_int_value(m_interface->kodiBase, m_controlHandle, value);
266 }
267 //--------------------------------------------------------------------------
268
269 //==========================================================================
270 ///
271 /// \ingroup cpp_kodi_gui_controls_CSpin
272 /// @brief To get the current position as integer value.
273 ///
274 /// @return The position as integer
275 ///
276 /// @note Percent, floating point or integer are alone possible. Combining
277 /// these different values can be not together and can, therefore, only
278 /// one each can be used and must be defined with \ref SetType before.
279 ///
280 int GetIntValue() const
281 {
282 return m_interface->kodi_gui->control_spin->get_int_value(m_interface->kodiBase, m_controlHandle);
283 }
284 //--------------------------------------------------------------------------
285
286 //==========================================================================
287 ///
288 /// \ingroup cpp_kodi_gui_controls_CSpin
289 /// @brief To set the the range as float of spin, e.g. -25.0 is the spin
290 /// start and e.g. +25.0 is the from here defined position where it reach
291 /// the end.
292 ///
293 /// As default is the range 0.0 to 1.0.
294 ///
295 /// The float interval is as default 0.1 and can be changed with
296 /// @ref SetFloatInterval.
297 ///
298 /// @param[in] start Integer start value
299 /// @param[in] end Integer end value
300 ///
301 /// @note Percent, floating point or integer are alone possible. Combining
302 /// these different values can be not together and can, therefore, only
303 /// one each can be used and must be defined with \ref SetType before.
304 ///
305 void SetFloatRange(float start, float end)
306 {
307 m_interface->kodi_gui->control_spin->set_float_range(m_interface->kodiBase, m_controlHandle, start, end);
308 }
309 //--------------------------------------------------------------------------
310
311 //==========================================================================
312 ///
313 /// \ingroup cpp_kodi_gui_controls_CSpin
314 /// @brief Set the spin position with the given float value. The Range
315 /// can be defined with a call from \ref SetIntRange before, as default it
316 /// is 0.0 to 1.0.
317 ///
318 /// @param[in] value Position in range to set with float
319 ///
320 /// @note Percent, floating point or integer are alone possible. Combining
321 /// these different values can be not together and can, therefore, only
322 /// one each can be used and must be defined with \ref SetType before.
323 ///
324 void SetFloatValue(float value)
325 {
326 m_interface->kodi_gui->control_spin->set_float_value(m_interface->kodiBase, m_controlHandle, value);
327 }
328 //--------------------------------------------------------------------------
329
330 //==========================================================================
331 ///
332 /// \ingroup cpp_kodi_gui_controls_CSpin
333 /// @brief To get the current position as float value.
334 ///
335 /// @return The position as float
336 ///
337 float GetFloatValue() const
338 {
339 return m_interface->kodi_gui->control_spin->get_float_value(m_interface->kodiBase, m_controlHandle);
340 }
341 //--------------------------------------------------------------------------
342
343 //==========================================================================
344 ///
345 /// \ingroup cpp_kodi_gui_controls_CSpin
346 /// @brief To set the interval steps of spin, as default is it 0.1 If it
347 /// becomes changed with this function will a step of the user with the
348 /// value fixed here be executed.
349 ///
350 /// @param[in] interval Intervall step to set.
351 ///
352 /// @note Percent, floating point or integer are alone possible. Combining
353 /// these different values can be not together and can, therefore, only
354 /// one each can be used and must be defined with \ref SetType before.
355 ///
356 void SetFloatInterval(float interval)
357 {
358 m_interface->kodi_gui->control_spin->set_float_interval(m_interface->kodiBase, m_controlHandle, interval);
359 }
360 //--------------------------------------------------------------------------
361 };
362
363} /* namespace controls */
364} /* namespace gui */
365} /* namespace kodi */