Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
SettingsSlider.h
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//==============================================================================
44class ATTR_DLL_LOCAL CSettingsSlider : public CAddonGUIControlBase
45{
46public:
47 //============================================================================
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)
60 "kodi::gui::controls::CSettingsSlider can't create control class from Kodi !!!");
61 }
62 //----------------------------------------------------------------------------
63
64 //============================================================================
68 ~CSettingsSlider() override = default;
69 //----------------------------------------------------------------------------
70
71 //============================================================================
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 //============================================================================
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 //============================================================================
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 //============================================================================
114 void Reset()
115 {
116 m_interface->kodi_gui->control_settings_slider->reset(m_interface->kodiBase, m_controlHandle);
117 }
118 //----------------------------------------------------------------------------
119
120 //============================================================================
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 //============================================================================
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 //============================================================================
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 //============================================================================
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 //============================================================================
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 //============================================================================
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 //============================================================================
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 //============================================================================
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 //============================================================================
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 //============================================================================
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 */
Definition ListItem.h:26
Definition Window.h:110
Definition SettingsSlider.h:45
@ ADDON_LOG_FATAL
4 : To notify fatal unrecoverable errors, which can may also indicate upcoming crashes.
Definition addon_base.h:197
void SetIntInterval(int interval)
To set the interval steps of slider, as default is it 1. If it becomes changed with this function wil...
Definition SettingsSlider.h:192
void SetPercentage(float percent)
Sets the percent of the slider.
Definition SettingsSlider.h:209
void SetFloatInterval(float interval)
To set the interval steps of slider, as default is it 0.1 If it becomes changed with this function wi...
Definition SettingsSlider.h:302
void SetIntRange(int start, int end)
To set the the range as integer of slider, e.g. -10 is the slider start and e.g. +10 is the from here...
Definition SettingsSlider.h:138
void SetIntValue(int value)
Set the slider position with the given integer value. The Range must be defined with a call from SetI...
Definition SettingsSlider.h:156
void Reset()
To reset slider on defaults.
Definition SettingsSlider.h:114
float GetFloatValue() const
To get the current position as float value.
Definition SettingsSlider.h:283
void SetVisible(bool visible)
Set the control on window to visible.
Definition SettingsSlider.h:77
void SetText(const std::string &text)
To set the text string on settings slider.
Definition SettingsSlider.h:103
CSettingsSlider(CWindow *window, int controlId)
Construct a new control.
Definition SettingsSlider.h:54
float GetPercentage() const
Returns a float of the percent of the slider.
Definition SettingsSlider.h:226
~CSettingsSlider() override=default
Destructor.
void SetEnabled(bool enabled)
Set's the control's enabled/disabled state.
Definition SettingsSlider.h:90
void SetFloatValue(float value)
Set the slider position with the given float value. The Range can be defined with a call from SetIntR...
Definition SettingsSlider.h:270
int GetIntValue() const
To get the current position as integer value.
Definition SettingsSlider.h:173
void SetFloatRange(float start, float end)
To set the the range as float of slider, e.g. -25.0 is the slider start and e.g. +25....
Definition SettingsSlider.h:251
void ATTR_DLL_LOCAL Log(const ADDON_LOG loglevel, const char *format,...)
Add a message to Kodi's log.
Definition AddonBase.h:1938