Class: kodi::gui::controls::CSpin
Window control used for cycling up/down controls
The settings spin control is used in the settings screens for when a list of options can be chosen from using up/down arrows.
More...
Class: kodi::gui::controls::CSpin
Window control used for cycling up/down controls
The settings spin control is used in the settings screens for when a list of options can be chosen from using up/down arrows.
You can choose the position, size, and look of the spin control. It is basically a cross between the button control and a spin control. It has a label and focus and non focus textures, as well as a spin control on the right.
It has the header #include <kodi/gui/controls/Spin.h> be included to enjoy it.
Here you find the needed skin part for a spin control.
- Note
- The call of the control is only possible from the corresponding window as its class and identification number is required.
Example:
#define MY_SPIN_CONTROL 1
{
public:
CMyWindow()
bool OnClick(
int controlId) override;
private:
kodi::gui::controls::CSpin m_mySpinControl;
};
CMyWindow::CMyWindow()
:
kodi::gui::
CWindow("my_skin.xml", "skin.estuary", true, false),
m_mySpinControl(this, MY_SPIN_CONTROL)
{
}
void CMyWindow::ShowWindow()
{
}
bool CMyWindow::OnInit()
{
m_mySpinControl.SetIntRange(1, 80);
return true;
}
bool CMyWindow::OnClick(int controlId)
{
if (controlId == MY_SPIN_CONTROL)
{
int value = m_mySpinControl.GetIntValue();
...
}
return true;
}
return false;
}
enum const char const char * value
Definition addon_base.h:203
friend class CWindow
Definition addons/kodi-dev-kit/include/kodi/gui/ListItem.h:40
Definition addons/kodi-dev-kit/include/kodi/gui/window.h:110
@ ADDON_SPIN_CONTROL_TYPE_INT
One spin step interpreted as integer.
Definition kodi-dev-kit/include/kodi/gui/controls/spin.h:106
virtual bool OnClick(int controlId)
OnClick method.
Definition addons/kodi-dev-kit/include/kodi/gui/window.h:685
virtual bool OnInit()
OnInit method.
Definition addons/kodi-dev-kit/include/kodi/gui/window.h:661
void DoModal()
Display this window until close() is called.
Definition addons/kodi-dev-kit/include/kodi/gui/window.h:190
typedef void(ATTR_APIENTRYP PFN_KODI_ADDON_SCREENSAVER_STOP_V1)(const KODI_ADDON_SCREENSAVER_HDL hdl)
Definition addons/kodi-dev-kit/include/kodi/addon-instance/AudioDecoder.h:21
◆ AddonGUISpinControlType
The values here defines the used value format for steps on spin control.
◆ AddonGUISpinControlType
The values here defines the used value format for steps on spin control.
Enumerator |
---|
ADDON_SPIN_CONTROL_TYPE_INT | One spin step interpreted as integer.
|
ADDON_SPIN_CONTROL_TYPE_FLOAT | One spin step interpreted as floating point value.
|
ADDON_SPIN_CONTROL_TYPE_TEXT | One spin step interpreted as text string.
|
ADDON_SPIN_CONTROL_TYPE_PAGE | One spin step interpreted as a page change value.
|
◆ AddLabel() [1/2]
void kodi::gui::controls::CSpin::AddLabel |
( |
const std::string & | label, |
|
|
const std::string & | value ) |
|
inline |
To add a label entry in spin defined with a value as string.
Format must be set to ADDON_SPIN_CONTROL_TYPE_TEXT to use this function.
- Parameters
-
[in] | label | Label string to view on skin |
[in] | value | String value to use for selection of them |
◆ AddLabel() [2/2]
void kodi::gui::controls::CSpin::AddLabel |
( |
const std::string & | label, |
|
|
int | value ) |
|
inline |
To add a label entry in spin defined with a value as integer.
Format must be set to ADDON_SPIN_CONTROL_TYPE_INT to use this function.
- Parameters
-
[in] | label | Label string to view on skin |
[in] | value | Integer value to use for selection of them. |
◆ CSpin()
kodi::gui::controls::CSpin::CSpin |
( |
CWindow * | window, |
|
|
int | controlId ) |
|
inline |
Construct a new control.
- Parameters
-
[in] | window | Related window control class |
[in] | controlId | Used skin xml control id |
◆ GetFloatValue()
float kodi::gui::controls::CSpin::GetFloatValue |
( |
| ) |
const |
|
inline |
To get the current position as float value.
- Returns
- The position as float
◆ GetIntValue()
int kodi::gui::controls::CSpin::GetIntValue |
( |
| ) |
const |
|
inline |
To get the current position as integer value.
- Returns
- The position as integer
- Note
- Percent, floating point or integer are alone possible. Combining these different values can be not together and can, therefore, only one each can be used and must be defined with SetType before.
◆ GetStringValue()
std::string kodi::gui::controls::CSpin::GetStringValue |
( |
| ) |
const |
|
inline |
To get the current spin control position with text string value.
Format must be set to ADDON_SPIN_CONTROL_TYPE_TEXT to use this function.
- Returns
- Currently selected string value
◆ Reset()
void kodi::gui::controls::CSpin::Reset |
( |
| ) |
|
|
inline |
To reset spin control to defaults.
◆ SetEnabled()
void kodi::gui::controls::CSpin::SetEnabled |
( |
bool | enabled | ) |
|
|
inline |
Set's the control's enabled/disabled state.
- Parameters
-
[in] | enabled | If true enabled, otherwise disabled |
◆ SetFloatInterval()
void kodi::gui::controls::CSpin::SetFloatInterval |
( |
float | interval | ) |
|
|
inline |
To set the interval steps of spin, as default is it 0.1 If it becomes changed with this function will a step of the user with the value fixed here be executed.
- Parameters
-
[in] | interval | Intervall step to set. |
- Note
- Percent, floating point or integer are alone possible. Combining these different values can be not together and can, therefore, only one each can be used and must be defined with SetType before.
◆ SetFloatRange()
void kodi::gui::controls::CSpin::SetFloatRange |
( |
float | start, |
|
|
float | end ) |
|
inline |
To set the the range as float of spin, e.g. -25.0 is the spin start and e.g. +25.0 is the from here defined position where it reach the end.
As default is the range 0.0 to 1.0.
The float interval is as default 0.1 and can be changed with SetFloatInterval.
- Parameters
-
[in] | start | Integer start value |
[in] | end | Integer end value |
- Note
- Percent, floating point or integer are alone possible. Combining these different values can be not together and can, therefore, only one each can be used and must be defined with SetType before.
◆ SetFloatValue()
void kodi::gui::controls::CSpin::SetFloatValue |
( |
float | value | ) |
|
|
inline |
Set the spin position with the given float value. The Range can be defined with a call from SetIntRange before, as default it is 0.0 to 1.0.
- Parameters
-
[in] | value | Position in range to set with float |
- Note
- Percent, floating point or integer are alone possible. Combining these different values can be not together and can, therefore, only one each can be used and must be defined with SetType before.
◆ SetIntRange()
void kodi::gui::controls::CSpin::SetIntRange |
( |
int | start, |
|
|
int | end ) |
|
inline |
To set the the range as integer of slider, e.g. -10 is the slider start and e.g. +10 is the from here defined position where it reach the end.
Ad default is the range from 0 to 100.
- Parameters
-
[in] | start | Integer start value |
[in] | end | Integer end value |
- Note
- Percent, floating point or integer are alone possible. Combining these different values can be not together and can, therefore, only one each can be used and must be defined with SetType before.
◆ SetIntValue()
void kodi::gui::controls::CSpin::SetIntValue |
( |
int | value | ) |
|
|
inline |
Set the slider position with the given integer value. The Range must be defined with a call from SetIntRange before.
- Parameters
-
[in] | value | Position in range to set with integer |
- Note
- Percent, floating point or integer are alone possible. Combining these different values can be not together and can, therefore, only one each can be used and must be defined with SetType before.
◆ SetStringValue()
void kodi::gui::controls::CSpin::SetStringValue |
( |
const std::string & | value | ) |
|
|
inline |
To change the spin to position with them string as value.
Format must be set to ADDON_SPIN_CONTROL_TYPE_TEXT to use this function.
- Parameters
-
[in] | value | String value to change to |
◆ SetText()
void kodi::gui::controls::CSpin::SetText |
( |
const std::string & | text | ) |
|
|
inline |
To set the text string on spin control.
- Parameters
-
[in] | text | Text to show as name for spin |
◆ SetType()
To set the with SpinControlType defined types of spin.
- Parameters
-
- Note
- See description of AddonGUISpinControlType for available types.
◆ SetVisible()
void kodi::gui::controls::CSpin::SetVisible |
( |
bool | visible | ) |
|
|
inline |
Set the control on window to visible.
- Parameters
-
[in] | visible | If true visible, otherwise hidden |
◆ ~CSpin()
kodi::gui::controls::CSpin::~CSpin |
( |
| ) |
|
|
overridedefault |