summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Slider.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/Slider.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/Slider.h')
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Slider.h339
1 files changed, 0 insertions, 339 deletions
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
deleted file mode 100644
index 715cc7d..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Slider.h
+++ /dev/null
@@ -1,339 +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_CSlider Control Slider
24/// \ingroup cpp_kodi_gui
25/// @brief \cpp_class{ kodi::gui::controls::CSlider }
26/// **Window control for moveable slider**
27///
28/// The slider control is used for things where a sliding bar best represents
29/// the operation at hand (such as a volume control or seek control). You can
30/// choose the position, size, and look of the slider control.
31///
32/// It has the header \ref Slider.h "#include <kodi/gui/controls/Slider.h>"
33/// be included to enjoy it.
34///
35/// Here you find the needed skin part for a \ref Slider_Control "slider control"
36///
37/// @note The call of the control is only possible from the corresponding
38/// window as its class and identification number is required.
39///
40class ATTRIBUTE_HIDDEN CSlider : public CAddonGUIControlBase
41{
42public:
43 //==========================================================================
44 ///
45 /// \ingroup cpp_kodi_gui_controls_CSlider
46 /// @brief Construct a new control
47 ///
48 /// @param[in] window related window control class
49 /// @param[in] controlId Used skin xml control id
50 ///
51 CSlider(CWindow* window, int controlId) : CAddonGUIControlBase(window)
52 {
53 m_controlHandle = m_interface->kodi_gui->window->get_control_slider(
54 m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
55 if (!m_controlHandle)
56 kodi::Log(ADDON_LOG_FATAL,
57 "kodi::gui::controls::CSlider can't create control class from Kodi !!!");
58 }
59 //--------------------------------------------------------------------------
60
61 //==========================================================================
62 ///
63 /// \ingroup cpp_kodi_gui_controls_CSlider
64 /// @brief Destructor
65 ///
66 ~CSlider() override = default;
67 //--------------------------------------------------------------------------
68
69 //==========================================================================
70 ///
71 /// \ingroup cpp_kodi_gui_controls_CSlider
72 /// @brief Set the control on window to visible
73 ///
74 /// @param[in] visible If true visible, otherwise hidden
75 ///
76 void SetVisible(bool visible)
77 {
78 m_interface->kodi_gui->control_slider->set_visible(m_interface->kodiBase, m_controlHandle,
79 visible);
80 }
81 //--------------------------------------------------------------------------
82
83 //==========================================================================
84 ///
85 /// \ingroup cpp_kodi_gui_controls_CSlider
86 /// @brief Set's the control's enabled/disabled state
87 ///
88 /// @param[in] enabled If true enabled, otherwise disabled
89 ///
90 void SetEnabled(bool enabled)
91 {
92 m_interface->kodi_gui->control_slider->set_enabled(m_interface->kodiBase, m_controlHandle,
93 enabled);
94 }
95 //--------------------------------------------------------------------------
96
97 //==========================================================================
98 ///
99 /// \ingroup cpp_kodi_gui_controls_CSlider
100 /// @brief To reset slider on defaults
101 ///
102 void Reset()
103 {
104 m_interface->kodi_gui->control_slider->reset(m_interface->kodiBase, m_controlHandle);
105 }
106 //--------------------------------------------------------------------------
107
108 //==========================================================================
109 ///
110 /// \ingroup cpp_kodi_gui_controls_CSlider
111 /// @brief With GetDescription becomes a string value of position returned.
112 ///
113 /// @return Text string about current slider position
114 ///
115 /// The following are the text definition returned from this:
116 /// | Value | Without range selection | With range selection |
117 /// |:---------:|:------------------------|:-------------------------------|
118 /// | float | <c>%2.2f</c> | <c>[%2.2f, %2.2f]</c> |
119 /// | integer | <c>%i</c> | <c>[%i, %i]</c> |
120 /// | percent | <c>%i%%</c> | <c>[%i%%, %i%%]</c> |
121 ///
122 std::string GetDescription() const
123 {
124 std::string text;
125 char* ret = m_interface->kodi_gui->control_slider->get_description(m_interface->kodiBase,
126 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_CSlider
140 /// @brief To set the the range as integer of slider, e.g. -10 is the slider
141 /// start and e.g. +10 is the from here defined position where it reach the
142 /// end.
143 ///
144 /// Ad default is the range from 0 to 100.
145 ///
146 /// The integer interval is as default 1 and can be changed with
147 /// @ref SetIntInterval.
148 ///
149 /// @param[in] start Integer start value
150 /// @param[in] end Integer end value
151 ///
152 /// @note Percent, floating point or integer are alone possible. Combining
153 /// these different values can be not together and can, therefore, only one
154 /// each can be used.
155 ///
156 void SetIntRange(int start, int end)
157 {
158 m_interface->kodi_gui->control_slider->set_int_range(m_interface->kodiBase, m_controlHandle,
159 start, end);
160 }
161 //--------------------------------------------------------------------------
162
163 //==========================================================================
164 ///
165 /// \ingroup CSlider
166 /// @brief Set the slider position with the given integer value. The Range
167 /// must be defined with a call from \ref SetIntRange before.
168 ///
169 /// @param[in] value Position in range to set with integer
170 ///
171 /// @note Percent, floating point or integer are alone possible. Combining
172 /// these different values can be not together and can, therefore, only one
173 /// each can be used.
174 ///
175 void SetIntValue(int value)
176 {
177 m_interface->kodi_gui->control_slider->set_int_value(m_interface->kodiBase, m_controlHandle,
178 value);
179 }
180 //--------------------------------------------------------------------------
181
182 //==========================================================================
183 ///
184 /// \ingroup cpp_kodi_gui_controls_CSlider
185 /// @brief To get the current position as integer value.
186 ///
187 /// @return The position as integer
188 ///
189 /// @note Percent, floating point or integer are alone possible. Combining
190 /// these different values can be not together and can, therefore, only
191 /// one each can be used.
192 ///
193 int GetIntValue() const
194 {
195 return m_interface->kodi_gui->control_slider->get_int_value(m_interface->kodiBase,
196 m_controlHandle);
197 }
198 //--------------------------------------------------------------------------
199
200 //==========================================================================
201 ///
202 /// \ingroup cpp_kodi_gui_controls_CSlider
203 /// @brief To set the interval steps of slider, as default is it 1. If it
204 /// becomes changed with this function will a step of the user with the
205 /// value fixed here be executed.
206 ///
207 /// @param[in] interval Intervall step to set.
208 ///
209 /// @note Percent, floating point or integer are alone possible. Combining
210 /// these different values can be not together and can, therefore, only one
211 /// each can be used.
212 ///
213 void SetIntInterval(int interval)
214 {
215 m_interface->kodi_gui->control_slider->set_int_interval(m_interface->kodiBase, m_controlHandle,
216 interval);
217 }
218 //--------------------------------------------------------------------------
219
220 //==========================================================================
221 ///
222 /// \ingroup cpp_kodi_gui_controls_CSlider
223 /// @brief Sets the percent of the slider.
224 ///
225 /// @param[in] percent float - Percent value of slide
226 ///
227 /// @note Percent, floating point or integer are alone possible. Combining
228 /// these different values can be not together and can, therefore, only one
229 /// each can be used.
230 ///
231 void SetPercentage(float percent)
232 {
233 m_interface->kodi_gui->control_slider->set_percentage(m_interface->kodiBase, m_controlHandle,
234 percent);
235 }
236 //--------------------------------------------------------------------------
237
238 //==========================================================================
239 ///
240 /// \ingroup cpp_kodi_gui_controls_CSlider
241 /// @brief Returns a float of the percent of the slider.
242 ///
243 /// @return float - Percent of slider
244 ///
245 /// @note Percent, floating point or integer are alone possible. Combining
246 /// these different values can be not together and can, therefore, only one
247 /// each can be used.
248 ///
249 float GetPercentage() const
250 {
251 return m_interface->kodi_gui->control_slider->get_percentage(m_interface->kodiBase,
252 m_controlHandle);
253 }
254 //--------------------------------------------------------------------------
255
256 //==========================================================================
257 ///
258 /// \ingroup cpp_kodi_gui_controls_CSlider
259 /// @brief To set the the range as float of slider, e.g. -25.0 is the slider
260 /// start and e.g. +25.0 is the from here defined position where it reach
261 /// the end.
262 ///
263 /// As default is the range 0.0 to 1.0.
264 ///
265 /// The float interval is as default 0.1 and can be changed with
266 /// @ref SetFloatInterval.
267 ///
268 /// @param[in] start Integer start value
269 /// @param[in] end Integer end value
270 ///
271 /// @note Percent, floating point or integer are alone possible. Combining
272 /// these different values can be not together and can, therefore, only
273 /// one each can be used.
274 ///
275 void SetFloatRange(float start, float end)
276 {
277 m_interface->kodi_gui->control_slider->set_float_range(m_interface->kodiBase, m_controlHandle,
278 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,
298 value);
299 }
300 //--------------------------------------------------------------------------
301
302 //==========================================================================
303 ///
304 /// \ingroup cpp_kodi_gui_controls_CSlider
305 /// @brief To get the current position as float value.
306 ///
307 /// @return The position as float
308 ///
309 float GetFloatValue() const
310 {
311 return m_interface->kodi_gui->control_slider->get_float_value(m_interface->kodiBase,
312 m_controlHandle);
313 }
314 //--------------------------------------------------------------------------
315
316 //==========================================================================
317 ///
318 /// \ingroup cpp_kodi_gui_controls_CSlider
319 /// @brief To set the interval steps of slider, as default is it 0.1 If it
320 /// becomes changed with this function will a step of the user with the
321 /// value fixed here be executed.
322 ///
323 /// @param[in] interval Intervall step to set.
324 ///
325 /// @note Percent, floating point or integer are alone possible. Combining
326 /// these different values can be not together and can, therefore, only
327 /// one each can be used.
328 ///
329 void SetFloatInterval(float interval)
330 {
331 m_interface->kodi_gui->control_slider->set_float_interval(m_interface->kodiBase,
332 m_controlHandle, interval);
333 }
334 //--------------------------------------------------------------------------
335};
336
337} /* namespace controls */
338} /* namespace gui */
339} /* namespace kodi */