Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches

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

Functions

 kodi::gui::controls::CRadioButton::CRadioButton (CWindow *window, int controlId)
 Construct a new control.
 
 kodi::gui::controls::CRadioButton::~CRadioButton () override=default
 Destructor.
 
void kodi::gui::controls::CRadioButton::SetVisible (bool visible)
 Set the control on window to visible.
 
void kodi::gui::controls::CRadioButton::SetEnabled (bool enabled)
 Set's the control's enabled/disabled state.
 
void kodi::gui::controls::CRadioButton::SetLabel (const std::string &label)
 To set the text string on radio button.
 
std::string kodi::gui::controls::CRadioButton::GetLabel () const
 Get the used text from control.
 
void kodi::gui::controls::CRadioButton::SetSelected (bool selected)
 To set radio button condition to on or off.
 
bool kodi::gui::controls::CRadioButton::IsSelected () const
 Get the current selected condition of radio button.
 

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:

#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;
}
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
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

Function Documentation

◆ CRadioButton()

kodi::gui::controls::CRadioButton::CRadioButton ( CWindow * window,
int controlId )
inline

Construct a new control.

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

◆ GetLabel()

std::string kodi::gui::controls::CRadioButton::GetLabel ( ) const
inline

Get the used text from control.

Returns
Text shown

◆ IsSelected()

bool kodi::gui::controls::CRadioButton::IsSelected ( ) const
inline

Get the current selected condition of radio button.

Returns
Selected condition

◆ SetEnabled()

void kodi::gui::controls::CRadioButton::SetEnabled ( bool enabled)
inline

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

Parameters
[in]enabledIf true enabled, otherwise disabled

◆ SetLabel()

void kodi::gui::controls::CRadioButton::SetLabel ( const std::string & label)
inline

To set the text string on radio button.

Parameters
[in]labelText to show

◆ SetSelected()

void kodi::gui::controls::CRadioButton::SetSelected ( bool selected)
inline

To set radio button condition to on or off.

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

◆ SetVisible()

void kodi::gui::controls::CRadioButton::SetVisible ( bool visible)
inline

Set the control on window to visible.

Parameters
[in]visibleIf true visible, otherwise hidden

◆ ~CRadioButton()

kodi::gui::controls::CRadioButton::~CRadioButton ( )
overridedefault

Destructor.