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

Detailed Description

Class: kodi::gui::controls::CRadioButton

Window control for a radio button (as used for on/off settings)
The radio button control is used for creating push button on/off settings in Kodi.

You can choose the position, size, and look of the button. When the user clicks on the radio button, the state will change, toggling the extra textures (textureradioon and textureradiooff). Used for settings controls.

It has the header #include <kodi/gui/controls/RadioButton.h> be included to enjoy it.

Here you find the needed skin part for a radio button 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_RADIO_BUTTON_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_myRadioButtonControl;
};
CMyWindow::CMyWindow()
: kodi::gui::CWindow("my_skin.xml", "skin.estuary", true, false),
m_myRadioButtonControl(this, MY_RADIO_BUTTON_CONTROL)
{
}
void CMyWindow::ShowWindow()
{
}
bool CMyWindow::OnInit()
{
m_myRadioButtonControl.SetSelected(false); // can also on skin set to default
return true;
}
bool CMyWindow::OnClick(int controlId)
{
if (controlId == MY_RADIO_BUTTON_CONTROL)
{
bool selected = m_myRadioButtonControl.IsSelected();
...
}
return true;
}
return false;
}
Definition Window.h:110
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

Function Documentation

◆ CRadioButton()

CRadioButton ( CWindow * window,
int controlId )
inline

Construct a new control.

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

◆ ~CRadioButton()

~CRadioButton ( )
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

◆ SetLabel()

void SetLabel ( const std::string & label)
inline

To set the text string on radio button.

Parameters
[in]labelText to show

◆ GetLabel()

std::string GetLabel ( ) const
inline

Get the used text from control.

Returns
Text shown

◆ SetSelected()

void SetSelected ( bool selected)
inline

To set radio button condition to on or off.

Parameters
[in]selectedtrue set radio button to selection on, otherwise off

◆ IsSelected()

bool IsSelected ( ) const
inline

Get the current selected condition of radio button.

Returns
Selected condition