# WoopsiUI::RadioButtonGroup Class Reference

`#include <radiobuttongroup.h>`

Inheritance diagram for WoopsiUI::RadioButtonGroup:

List of all members.

## Public Member Functions
| RadioButtonGroup (s16 x, s16 y, GadgetStyle *style=NULL)
RadioButton * | newRadioButton (s16 x, s16 y, u16 width, u16 height)
virtual const RadioButton * | getSelectedGadget () const
virtual const s32 | getSelectedIndex () const
virtual void | setSelectedGadget (RadioButton *gadget)
virtual void | setSelectedIndex (s32 index)
virtual void | getPreferredDimensions (Rect &rect) const
virtual void | handleClickEvent (const GadgetEventArgs &e)
virtual void | handleDoubleClickEvent (const GadgetEventArgs &e)
virtual void | handleReleaseEvent (const GadgetEventArgs &e)
virtual void | handleReleaseOutsideEvent (const GadgetEventArgs &e)
## Protected Member Functions
virtual void | drawContents (GraphicsPort *port)
virtual | ~RadioButtonGroup ()
| RadioButtonGroup (const RadioButtonGroup &radioButtonGroup)
## Protected Attributes
RadioButton * | _selectedGadget

## Detailed Description

Container class that holds radio button gadgets and tracks their status. The group provides an easy way to determine which radio button is selected. Note that, in order to set the "mu" state for a radio button, it is necessary to set the state via the radio button, not the group.

## Constructor & Destructor Documentation

WoopsiUI::RadioButtonGroup::RadioButtonGroup | ( | s16 | x,
|  | s16 | y,
|  | GadgetStyle * | style = `NULL` |
| ) |  |  |

Constructor. Note that the group determines its width and height from the position and dimensions of its children.

Parameters:

  | x | The x co-ordinate of the group.
  | y | The y co-ordinate of the group.
  | style | The style that the gadget should use. If this is not specified, the gadget will use the values stored in the global defaultGadgetStyle object. The gadget will copy the properties of the style into its own internal style object.

virtual WoopsiUI::RadioButtonGroup::~RadioButtonGroup | ( |  | ) | `[inline, protected, virtual]`

Destructor.

WoopsiUI::RadioButtonGroup::RadioButtonGroup | ( | const RadioButtonGroup & | radioButtonGroup | ) | `[inline, protected]`

Copy constructor is protected to prevent usage.

## Member Function Documentation

virtual void WoopsiUI::RadioButtonGroup::drawContents | ( | GraphicsPort * | port | ) | `[protected, virtual]`

Draw the area of this gadget that falls within the clipping region. Called by the redraw() function to draw all visible regions.

Parameters:

  | port | The GraphicsPort to draw to.

See also:
  redraw()

Reimplemented from WoopsiUI::Gadget.

virtual void WoopsiUI::RadioButtonGroup::getPreferredDimensions | ( | Rect & | rect | ) | const`[virtual]`

Insert the dimensions that this gadget wants to have into the rect passed in as a parameter. All co-ordinates are relative to the gadget's parent. Value is based on the length of the largest string in the set of options.

Parameters:

  | rect | Reference to a rect to populate with data.

Reimplemented from WoopsiUI::Gadget.

virtual const RadioButton* WoopsiUI::RadioButtonGroup::getSelectedGadget | ( |  | ) | const`[virtual]`

Gets a pointer to the selected gadget.

Returns:
  Pointer to the selected gadget.

virtual const s32 WoopsiUI::RadioButtonGroup::getSelectedIndex | ( |  | ) | const`[virtual]`

Gets the index of the selected gadget.

Returns:
  The index of the selected gadget.

virtual void WoopsiUI::RadioButtonGroup::handleClickEvent | ( | const GadgetEventArgs & | e | ) | `[virtual]`

Handle a stylus click event.

Parameters:

  | e | The event data.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::RadioButtonGroup::handleDoubleClickEvent | ( | const GadgetEventArgs & | e | ) | `[virtual]`

Handle a gadget double-click event.

Parameters:

  | e | The event data.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::RadioButtonGroup::handleReleaseEvent | ( | const GadgetEventArgs & | e | ) | `[virtual]`

Handle a stylus release event that occurred within the bounds of the source gadget.

Parameters:

  | e | The event data.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::RadioButtonGroup::handleReleaseOutsideEvent | ( | const GadgetEventArgs & | e | ) | `[virtual]`

Handle a stylus release event that occurred outside the bounds of the source gadget.

Parameters:

  | e | The event data.

Reimplemented from WoopsiUI::GadgetEventHandler.

RadioButton* WoopsiUI::RadioButtonGroup::newRadioButton | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height |
| ) |  |  |

Simple method for adding a new radio button to the group. This should be used in preference to the usual addGadget() method, as this method automatically resizes the group.

Parameters:

  | x | The x co-ordinate of the new button, relative to this gadget.
  | y | The y co-ordinate of the new button, relative to this gadget.
  | width | The width of the new button.
  | height | The height of the new button.

virtual void WoopsiUI::RadioButtonGroup::setSelectedGadget | ( | RadioButton * | gadget | ) | `[virtual]`

Sets the selected radio button to the supplied gadget.

Parameters:

  | gadget | The radio button to select.

virtual void WoopsiUI::RadioButtonGroup::setSelectedIndex | ( | s32 | index | ) | `[virtual]`

Selects the gadget at the specified index.

Parameters:

  | index | The index of the gadget to select.

## Member Data Documentation

RadioButton* WoopsiUI::RadioButtonGroup::_selectedGadget`[protected]`

Pointer to the currently selected radio button

The documentation for this class was generated from the following file:

- radiobuttongroup.h