Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches

Detailed Description

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:

#include <kodi/gui/Window.h>
#define MY_SPIN_CONTROL 1
class CMyWindow : public kodi::gui::CWindow
{
public:
CMyWindow()
void ShowWindow();
bool OnInit() override;
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;
}
Definition Window.h:110
@ ADDON_SPIN_CONTROL_TYPE_INT
One spin step interpreted as integer.
Definition Spin.h:106
virtual bool OnInit()
OnInit method.
Definition Window.h:661
virtual bool OnClick(int controlId)
OnClick method.
Definition Window.h:685
void DoModal()
Display this window until close() is called.
Definition Window.h:190

Enumeration Type Documentation

◆ 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.

Function Documentation

◆ CSpin()

CSpin ( CWindow * window,
int controlId )
inline

Construct a new control.

Parameters
[in]windowRelated window control class
[in]controlIdUsed skin xml control id

◆ ~CSpin()

~CSpin ( )
overridedefault

Destructor.

◆ SetVisible()

void SetVisible ( bool visible)
inline

Set the control on window to visible.

Parameters
[in]visibleIf true visible, otherwise hidden

◆ SetEnabled()

void SetEnabled ( bool enabled)
inline

Set's the control's enabled/disabled state.

Parameters
[in]enabledIf true enabled, otherwise disabled

◆ SetText()

void SetText ( const std::string & text)
inline

To set the text string on spin control.

Parameters
[in]textText to show as name for spin

◆ Reset()

void Reset ( )
inline

To reset spin control to defaults.

◆ SetType()

void SetType ( AddonGUISpinControlType type)
inline

To set the with SpinControlType defined types of spin.

Parameters
[in]typeThe type to use
Note
See description of AddonGUISpinControlType for available types.

◆ AddLabel() [1/2]

void 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]labelLabel string to view on skin
[in]valueString value to use for selection of them

◆ AddLabel() [2/2]

void 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]labelLabel string to view on skin
[in]valueInteger value to use for selection of them.

◆ SetStringValue()

void 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]valueString value to change to

◆ GetStringValue()

std::string 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

◆ SetIntRange()

void 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]startInteger start value
[in]endInteger 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 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]valuePosition 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.

◆ GetIntValue()

int 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.

◆ SetFloatRange()

void 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]startInteger start value
[in]endInteger 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 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]valuePosition 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.

◆ GetFloatValue()

float GetFloatValue ( ) const
inline

To get the current position as float value.

Returns
The position as float

◆ SetFloatInterval()

void 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]intervalIntervall 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.