メイン・コンテンツまでスキップ

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:

See: RadioButton

Public Functions

virtual voidadd(RadioButton & radioButton)
Add the RadioButton to the RadioButtonGroup.
virtual boolgetDeselectionEnabled() 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_tgetSelectedRadioButtonIndex() const
Gets the index of the currently selected RadioButton.
RadioButtonGroup()
Initializes a new instance of the RadioButtonGroup class.
virtual voidsetDeselectionEnabled(bool deselectionEnabled)
Sets whether or not it is possible to deselect RadioButtons by clicking them when they are selected.
voidsetRadioButtonDeselectedHandler(GenericCallback< const AbstractButton & > & callback)
Associates an action to be performed when a radio button belonging to this group transition from selected to unselected.
voidsetRadioButtonSelectedHandler(GenericCallback< const AbstractButton & > & callback)
Associates an action to be performed when a radio button belonging to this group is selected.
virtual voidsetSelected(RadioButton & radioButton)
Sets the specified RadioButton to be selected.
virtual ~RadioButtonGroup()
Finalizes an instance of the RadioButtonGroup class.

Protected Functions

virtual voidradioButtonClickedHandler(const AbstractButton & radioButton)
Handles the event that a RadioButton has been selected.
virtual voidradioButtonDeselectedHandler(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_tsize
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.

Parameters:
radioButtonThe RadioButton to add.

getDeselectionEnabled

virtual bool getDeselectionEnabled()const

Gets the current deselectionEnabled state.

Returns:

The current deselectionEnabled state.

See also:

getRadioButton

virtual RadioButton * getRadioButton(uint16_tindex)

Gets the RadioButton at the specified index.

Parameters:
indexthe index of the RadioButton to return.
Returns:

the RadioButton at the specified index. Returns 0 if the index is illegal.

getSelectedRadioButton

virtual RadioButton * getSelectedRadioButton()const

Gets the currently selected RadioButton.

Returns:

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.

Returns:

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(booldeselectionEnabled)

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.

Parameters:
deselectionEnabledtrue if it should be possible to deselect by click.
See also:

setRadioButtonDeselectedHandler

Associates an action to be performed when a radio button belonging to this group transition from selected to unselected.

Parameters:
callbackThe callback to be executed. The callback will be given a reference to the RadioButton that was selected.
See also:

setRadioButtonSelectedHandler

Associates an action to be performed when a radio button belonging to this group is selected.

Parameters:
callbackThe callback to be executed. The callback will be given a reference to the RadioButton that was selected.
See also:

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.

Parameters:
radioButtonthe RadioButton to be selected.

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

Parameters:
radioButtonthe RadioButton that has been selected.

radioButtonDeselectedHandler

virtual void radioButtonDeselectedHandler(const AbstractButton &radioButton)

Handles the event that a RadioButton has been deselected.

Parameters:
radioButtonthe 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.