summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/SettingsSlider.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-dev-kit/include/kodi/gui/controls/SettingsSlider.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-dev-kit/include/kodi/gui/controls/SettingsSlider.h')
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/SettingsSlider.h314
1 files changed, 314 insertions, 0 deletions
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/SettingsSlider.h b/xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/SettingsSlider.h
new file mode 100644
index 0000000..5557fc4
--- /dev/null
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/gui/controls/SettingsSlider.h
@@ -0,0 +1,314 @@
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 "../../c-api/gui/controls/settings_slider.h"
12#include "../Window.h"
13
14#ifdef __cplusplus
15
16namespace kodi
17{
18namespace gui
19{
20namespace controls
21{
22
23//==============================================================================
24/// @defgroup cpp_kodi_gui_windows_controls_CSettingsSlider Control Settings Slider
25/// @ingroup cpp_kodi_gui_windows_controls
26/// @brief @cpp_class{ kodi::gui::controls::CSettingsSlider }
27/// **Window control for moveable slider with text name**\n
28/// The settings slider control is used in the settings screens for when an
29/// option is best specified on a sliding scale.
30///
31/// You can choose the position, size, and look of the slider control. It is
32/// basically a cross between the button control and a slider control. It has a
33/// label and focus and non focus textures, as well as a slider control on the
34/// right.
35///
36/// It has the header @ref SettingsSlider.h "#include <kodi/gui/controls/SettingsSlider.h>"
37/// be included to enjoy it.
38///
39/// Here you find the needed skin part for a @ref Settings_Slider_Control "settings slider control".
40///
41/// @note The call of the control is only possible from the corresponding
42/// window as its class and identification number is required.
43///
44class ATTRIBUTE_HIDDEN CSettingsSlider : public CAddonGUIControlBase
45{
46public:
47 //============================================================================
48 /// @ingroup cpp_kodi_gui_windows_controls_CSettingsSlider
49 /// @brief Construct a new control.
50 ///
51 /// @param[in] window Related window control class
52 /// @param[in] controlId Used skin xml control id
53 ///
54 CSettingsSlider(CWindow* window, int controlId) : CAddonGUIControlBase(window)
55 {
56 m_controlHandle = m_interface->kodi_gui->window->get_control_settings_slider(
57 m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
58 if (!m_controlHandle)
59 kodi::Log(ADDON_LOG_FATAL,
60 "kodi::gui::controls::CSettingsSlider can't create control class from Kodi !!!");
61 }
62 //----------------------------------------------------------------------------
63
64 //============================================================================
65 /// @ingroup cpp_kodi_gui_windows_controls_CSettingsSlider
66 /// @brief Destructor.
67 ///
68 ~CSettingsSlider() override = default;
69 //----------------------------------------------------------------------------
70
71 //============================================================================
72 /// @ingroup cpp_kodi_gui_windows_controls_CSettingsSlider
73 /// @brief Set the control on window to visible.
74 ///
75 /// @param[in] visible If true visible, otherwise hidden
76 ///
77 void SetVisible(bool visible)
78 {
79 m_interface->kodi_gui->control_settings_slider->set_visible(m_interface->kodiBase,
80 m_controlHandle, visible);
81 }
82 //----------------------------------------------------------------------------
83
84 //============================================================================
85 /// @ingroup cpp_kodi_gui_windows_controls_CSettingsSlider
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_settings_slider->set_enabled(m_interface->kodiBase,
93 m_controlHandle, enabled);
94 }
95 //----------------------------------------------------------------------------
96
97 //============================================================================
98 /// @ingroup cpp_kodi_gui_windows_controls_CSettingsSlider
99 /// @brief To set the text string on settings slider.
100 ///
101 /// @param[in] text Text to show
102 ///
103 void SetText(const std::string& text)
104 {
105 m_interface->kodi_gui->control_settings_slider->set_text(m_interface->kodiBase, m_controlHandle,
106 text.c_str());
107 }
108 //----------------------------------------------------------------------------
109
110 //============================================================================
111 /// @ingroup cpp_kodi_gui_windows_controls_CSettingsSlider
112 /// @brief To reset slider on defaults.
113 ///
114 void Reset()
115 {
116 m_interface->kodi_gui->control_settings_slider->reset(m_interface->kodiBase, m_controlHandle);
117 }
118 //----------------------------------------------------------------------------
119
120 //============================================================================
121 /// @ingroup cpp_kodi_gui_windows_controls_CSettingsSlider
122 /// @brief To set the the range as integer of slider, e.g. -10 is the slider
123 /// start and e.g. +10 is the from here defined position where it reach the
124 /// end.
125 ///
126 /// Ad default is the range from 0 to 100.
127 ///
128 /// The integer interval is as default 1 and can be changed with
129 /// @ref SetIntInterval.
130 ///
131 /// @param[in] start Integer start value
132 /// @param[in] end Integer end value
133 ///
134 /// @note Percent, floating point or integer are alone possible. Combining
135 /// these different values can be not together and can, therefore, only
136 /// one each can be used.
137 ///
138 void SetIntRange(int start, int end)
139 {
140 m_interface->kodi_gui->control_settings_slider->set_int_range(m_interface->kodiBase,
141 m_controlHandle, start, end);
142 }
143 //----------------------------------------------------------------------------
144
145 //============================================================================
146 /// @ingroup cpp_kodi_gui_windows_controls_CSettingsSlider
147 /// @brief Set the slider position with the given integer value. The Range
148 /// must be defined with a call from @ref SetIntRange before.
149 ///
150 /// @param[in] value Position in range to set with integer
151 ///
152 /// @note Percent, floating point or integer are alone possible. Combining
153 /// these different values can be not together and can, therefore, only
154 /// one each can be used.
155 ///
156 void SetIntValue(int value)
157 {
158 m_interface->kodi_gui->control_settings_slider->set_int_value(m_interface->kodiBase,
159 m_controlHandle, value);
160 }
161 //----------------------------------------------------------------------------
162
163 //============================================================================
164 /// @ingroup cpp_kodi_gui_windows_controls_CSettingsSlider
165 /// @brief To get the current position as integer value.
166 ///
167 /// @return The position as integer
168 ///
169 /// @note Percent, floating point or integer are alone possible. Combining
170 /// these different values can be not together and can, therefore, only
171 /// one each can be used.
172 ///
173 int GetIntValue() const
174 {
175 return m_interface->kodi_gui->control_settings_slider->get_int_value(m_interface->kodiBase,
176 m_controlHandle);
177 }
178 //----------------------------------------------------------------------------
179
180 //============================================================================
181 /// @ingroup cpp_kodi_gui_windows_controls_CSettingsSlider
182 /// @brief To set the interval steps of slider, as default is it 1. If it
183 /// becomes changed with this function will a step of the user with the
184 /// value fixed here be executed.
185 ///
186 /// @param[in] interval Intervall step to set.
187 ///
188 /// @note Percent, floating point or integer are alone possible. Combining
189 /// these different values can be not together and can, therefore, only
190 /// one each can be used.
191 ///
192 void SetIntInterval(int interval)
193 {
194 m_interface->kodi_gui->control_settings_slider->set_int_interval(m_interface->kodiBase,
195 m_controlHandle, interval);
196 }
197 //----------------------------------------------------------------------------
198
199 //============================================================================
200 /// @ingroup cpp_kodi_gui_windows_controls_CSettingsSlider
201 /// @brief Sets the percent of the slider.
202 ///
203 /// @param[in] percent float - Percent value of slide
204 ///
205 /// @note Percent, floating point or integer are alone possible. Combining
206 /// these different values can be not together and can, therefore, only
207 /// one each can be used.
208 ///
209 void SetPercentage(float percent)
210 {
211 m_interface->kodi_gui->control_settings_slider->set_percentage(m_interface->kodiBase,
212 m_controlHandle, percent);
213 }
214 //----------------------------------------------------------------------------
215
216 //============================================================================
217 /// @ingroup cpp_kodi_gui_windows_controls_CSettingsSlider
218 /// @brief Returns a float of the percent of the slider.
219 ///
220 /// @return float - Percent of slider
221 ///
222 /// @note Percent, floating point or integer are alone possible. Combining
223 /// these different values can be not together and can, therefore, only
224 /// one each can be used.
225 ///
226 float GetPercentage() const
227 {
228 return m_interface->kodi_gui->control_settings_slider->get_percentage(m_interface->kodiBase,
229 m_controlHandle);
230 }
231 //----------------------------------------------------------------------------
232
233 //============================================================================
234 /// @ingroup cpp_kodi_gui_windows_controls_CSettingsSlider
235 /// @brief To set the the range as float of slider, e.g. -25.0 is the slider
236 /// start and e.g. +25.0 is the from here defined position where it reach
237 /// the end.
238 ///
239 /// As default is the range 0.0 to 1.0.
240 ///
241 /// The float interval is as default 0.1 and can be changed with
242 /// @ref SetFloatInterval.
243 ///
244 /// @param[in] start Integer start value
245 /// @param[in] end Integer end value
246 ///
247 /// @note Percent, floating point or integer are alone possible. Combining
248 /// these different values can be not together and can, therefore, only
249 /// one each can be used.
250 ///
251 void SetFloatRange(float start, float end)
252 {
253 m_interface->kodi_gui->control_settings_slider->set_float_range(m_interface->kodiBase,
254 m_controlHandle, start, end);
255 }
256 //----------------------------------------------------------------------------
257
258 //============================================================================
259 /// @ingroup cpp_kodi_gui_windows_controls_CSettingsSlider
260 /// @brief Set the slider position with the given float value. The Range can
261 /// be defined with a call from @ref SetIntRange before, as default it
262 /// is 0.0 to 1.0.
263 ///
264 /// @param[in] value Position in range to set with float
265 ///
266 /// @note Percent, floating point or integer are alone possible. Combining
267 /// these different values can be not together and can, therefore, only
268 /// one each can be used.
269 ///
270 void SetFloatValue(float value)
271 {
272 m_interface->kodi_gui->control_settings_slider->set_float_value(m_interface->kodiBase,
273 m_controlHandle, value);
274 }
275 //----------------------------------------------------------------------------
276
277 //============================================================================
278 /// @ingroup cpp_kodi_gui_windows_controls_CSettingsSlider
279 /// @brief To get the current position as float value.
280 ///
281 /// @return The position as float
282 ///
283 float GetFloatValue() const
284 {
285 return m_interface->kodi_gui->control_settings_slider->get_float_value(m_interface->kodiBase,
286 m_controlHandle);
287 }
288 //----------------------------------------------------------------------------
289
290 //============================================================================
291 /// @ingroup cpp_kodi_gui_windows_controls_CSettingsSlider
292 /// @brief To set the interval steps of slider, as default is it 0.1 If it
293 /// becomes changed with this function will a step of the user with the
294 /// value fixed here be executed.
295 ///
296 /// @param[in] interval Intervall step to set.
297 ///
298 /// @note Percent, floating point or integer are alone possible. Combining
299 /// these different values can be not together and can, therefore, only
300 /// one each can be used.
301 ///
302 void SetFloatInterval(float interval)
303 {
304 m_interface->kodi_gui->control_settings_slider->set_float_interval(m_interface->kodiBase,
305 m_controlHandle, interval);
306 }
307 //----------------------------------------------------------------------------
308};
309
310} /* namespace controls */
311} /* namespace gui */
312} /* namespace kodi */
313
314#endif /* __cplusplus */