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