summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2017-07-23 16:59:43 +0200
committermanuel <manuel@mausz.at>2017-07-23 16:59:43 +0200
commit4c3251ec645c8b71820dab7e51e612e5919d4e75 (patch)
tree9533268a93e58fc2e16de1b8ee3fafe3784e5225 /xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h
parentf44ecaa4f27e7538ddcad66d40e543bffa2d2d86 (diff)
downloadkodi-pvr-build-4c3251ec645c8b71820dab7e51e612e5919d4e75.tar.gz
kodi-pvr-build-4c3251ec645c8b71820dab7e51e612e5919d4e75.tar.bz2
kodi-pvr-build-4c3251ec645c8b71820dab7e51e612e5919d4e75.zip
sync with upstream
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h')
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h323
1 files changed, 323 insertions, 0 deletions
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 */