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
{
public:
CMyWindow()
void ShowWindow();
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);
return true;
}
bool CMyWindow::OnClick(int controlId)
{
if (controlId == MY_RADIO_BUTTON_CONTROL)
{
bool selected = m_myRadioButtonControl.IsSelected();
...
}
return true;
}
return false;
}
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
◆ CRadioButton()
Construct a new control.
- Parameters
-
[in] | window | Related window control class |
[in] | controlId | Used skin xml control id |
◆ ~CRadioButton()
◆ SetVisible()
void SetVisible |
( |
bool | visible | ) |
|
|
inline |
Set the control on window to visible.
- Parameters
-
[in] | visible | If true visible, otherwise hidden |
◆ SetEnabled()
void SetEnabled |
( |
bool | enabled | ) |
|
|
inline |
Set's the control's enabled/disabled state.
- Parameters
-
[in] | enabled | If true enabled, otherwise disabled |
◆ SetLabel()
void SetLabel |
( |
const std::string & | label | ) |
|
|
inline |
To set the text string on radio button.
- Parameters
-
◆ 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] | selected | true set radio button to selection on, otherwise off |
◆ IsSelected()
bool IsSelected |
( |
| ) |
const |
|
inline |
Get the current selected condition of radio button.
- Returns
- Selected condition