RadioButtonGroup
touchgfx/widgets/RadioButtonGroup.hpp
Class for handling a collection of RadioButton objects. The RadioButtonGroup handles the automatic deselection of other radio buttons when a new RadioButton is selected. A callback is executed when a new selection occurs reporting the newly selected RadioButton.
Template Parameters:
- CAPACITY The number of RadioButtons to store in the RadioButtonGroup.
See: RadioButton
Public Functions
virtual void | add(RadioButton & radioButton) |
Add the RadioButton to the RadioButtonGroup. | |
virtual bool | getDeselectionEnabled() const |
Gets the current deselectionEnabled state. | |
virtual RadioButton * | getRadioButton(uint16_t index) const |
Gets the RadioButton at the specified index. | |
virtual RadioButton * | getSelectedRadioButton() const |
Gets the currently selected RadioButton. | |
virtual int32_t | getSelectedRadioButtonIndex() const |
Gets the index of the currently selected RadioButton. | |
RadioButtonGroup() | |
Initializes a new instance of the RadioButtonGroup class. | |
virtual void | setDeselectionEnabled(bool deselectionEnabled) |
Sets whether or not it is possible to deselect RadioButtons by clicking them when they are selected. | |
void | setRadioButtonDeselectedHandler(GenericCallback< const AbstractButton & > & callback) |
Associates an action to be performed when a radio button belonging to this group transition from selected to unselected. | |
void | setRadioButtonSelectedHandler(GenericCallback< const AbstractButton & > & callback) |
Associates an action to be performed when a radio button belonging to this group is selected. | |
virtual void | setSelected(RadioButton & radioButton) |
Sets the specified RadioButton to be selected. | |
virtual | ~RadioButtonGroup() |
Finalizes an instance of the RadioButtonGroup class. | |
Protected Functions
virtual void | radioButtonClickedHandler(const AbstractButton & radioButton) |
Handles the event that a RadioButton has been selected. | |
virtual void | radioButtonDeselectedHandler(const AbstractButton & radioButton) |
Handles the event that a RadioButton has been deselected. | |
Protected Attributes
Callback< RadioButtonGroup, const AbstractButton & > | radioButtonClicked |
Callback that is attached to the RadioButtons. | |
GenericCallback< const AbstractButton & > * | radioButtonDeselectedCallback |
The callback to be executed when a radio button belonging to this group is deselected. | |
RadioButton * | radioButtons |
The list of added RadioButtons. | |
GenericCallback< const AbstractButton & > * | radioButtonSelectedCallback |
The callback to be executed when a radio button belonging to this group is selected. | |
Callback< RadioButtonGroup, const AbstractButton & > | radioButtonUnselected |
Callback that is attached to the RadioButtons. | |
uint16_t | size |
The current number of added RadioButtons. | |
Public Functions Documentation
add
virtual void add | ( | RadioButton & | radioButton | ) | |
Add the RadioButton to the RadioButtonGroup.
Adding more radio buttons than the CAPACITY of the RadioButtonGroup raises an assert.
radioButton | The RadioButton to add. |
getDeselectionEnabled
virtual bool getDeselectionEnabled | ( | ) | const |
Gets the current deselectionEnabled state.
The current deselectionEnabled state.
getRadioButton
virtual RadioButton * getRadioButton | ( | uint16_t | index | ) | |
Gets the RadioButton at the specified index.
index | the index of the RadioButton to return. |
the RadioButton at the specified index. Returns 0 if the index is illegal.
getSelectedRadioButton
virtual RadioButton * getSelectedRadioButton | ( | ) | const |
Gets the currently selected RadioButton.
a pointer to the selected RadioButton. Returns 0 if no RadioButton is selected.
getSelectedRadioButtonIndex
virtual int32_t getSelectedRadioButtonIndex | ( | ) | const |
Gets the index of the currently selected RadioButton.
the index of the selected RadioButton. Returns -1 if no RadioButton is selected.
RadioButtonGroup
Initializes a new instance of the RadioButtonGroup class.
setDeselectionEnabled
virtual void setDeselectionEnabled | ( | bool | deselectionEnabled | ) | |
Sets whether or not it is possible to deselect RadioButtons by clicking them when they are selected.
If deselection is enabled, it will be possible to select a RadioButton (and as a result deselect all other radio buttons) and the push the same RadioButton again to deselect it. The result is that no RadioButton is selected.
deselectionEnabled | true if it should be possible to deselect by click. |
setRadioButtonDeselectedHandler
void setRadioButtonDeselectedHandler | ( | GenericCallback< const AbstractButton & > & | callback | ) | |
Associates an action to be performed when a radio button belonging to this group transition from selected to unselected.
callback | The callback to be executed. The callback will be given a reference to the RadioButton that was selected. |
setRadioButtonSelectedHandler
void setRadioButtonSelectedHandler | ( | GenericCallback< const AbstractButton & > & | callback | ) | |
Associates an action to be performed when a radio button belonging to this group is selected.
callback | The callback to be executed. The callback will be given a reference to the RadioButton that was selected. |
setSelected
virtual void setSelected | ( | RadioButton & | radioButton | ) | |
Sets the specified RadioButton to be selected.
Sets the specified RadioButton to be selected and all other radio buttons to be deselected. Do not call this function before all RadioButton objects have been added to the RadioButtonGroup. Will call the radioButtonSelected callback.
radioButton | the RadioButton to be selected. |
~RadioButtonGroup
virtual ~RadioButtonGroup | ( | ) |
Finalizes an instance of the RadioButtonGroup class.
Protected Functions Documentation
radioButtonClickedHandler
virtual void radioButtonClickedHandler | ( | const AbstractButton & | radioButton | ) | |
Handles the event that a RadioButton has been selected.
deselects all other RadioButtons.
radioButton | the RadioButton that has been selected. |
radioButtonDeselectedHandler
virtual void radioButtonDeselectedHandler | ( | const AbstractButton & | radioButton | ) | |
Handles the event that a RadioButton has been deselected.
radioButton | the RadioButton that has been deselected. |
Protected Attributes Documentation
radioButtonClicked
Callback< RadioButtonGroup, const AbstractButton & > radioButtonClicked
Callback that is attached to the RadioButtons.
radioButtonDeselectedCallback
GenericCallback< const AbstractButton & > * radioButtonDeselectedCallback
The callback to be executed when a radio button belonging to this group is deselected.
radioButtons
RadioButton * radioButtons
The list of added RadioButtons.
radioButtonSelectedCallback
GenericCallback< const AbstractButton & > * radioButtonSelectedCallback
The callback to be executed when a radio button belonging to this group is selected.
radioButtonUnselected
Callback< RadioButtonGroup, const AbstractButton & > radioButtonUnselected
Callback that is attached to the RadioButtons.
size
uint16_t size
The current number of added RadioButtons.