# WoopsiUI::Button Class Reference

`#include <button.h>`

Inheritance diagram for WoopsiUI::Button:

List of all members.

## Public Member Functions
| Button (s16 x, s16 y, u16 width, u16 height, const WoopsiString &text, GadgetStyle *style=NULL)
## Protected Member Functions
virtual void | drawOutline (GraphicsPort *port)
virtual void | drawContents (GraphicsPort *port)
virtual void | drawBorder (GraphicsPort *port)
virtual void | onClick (s16 x, s16 y)
virtual void | onRelease (s16 x, s16 y)
virtual void | onReleaseOutside (s16 x, s16 y)
virtual | ~Button ()
| Button (const Button &button)

## Detailed Description

Clickable button gadget. Displays text within the button.

## Constructor & Destructor Documentation

WoopsiUI::Button::Button | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height,
|  | const WoopsiString & | text,
|  | GadgetStyle * | style = `NULL` |
| ) |  |  |

Constructor for buttons that display a string.

Parameters:

  | x | The x co-ordinate of the button, relative to its parent.
  | y | The y co-ordinate of the button, relative to its parent.
  | width | The width of the button.
  | height | The height of the button.
  | text | The text for the button to display.
  | style | The style that the button should use. If this is not specified, the button will use the values stored in the global defaultGadgetStyle object. The button will copy the properties of the style into its own internal style object.

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

Destructor.

WoopsiUI::Button::Button | ( | const Button & | button | ) | `[inline, protected]`

Copy constructor is protected to prevent usage.

## Member Function Documentation

virtual void WoopsiUI::Button::drawBorder | ( | 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::Label.

Reimplemented in WoopsiUI::CheckBox, WoopsiUI::CycleButton, WoopsiUI::DecorationGlyphButton, and WoopsiUI::WindowBorderButton.

virtual void WoopsiUI::Button::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::Label.

Reimplemented in WoopsiUI::CheckBox, WoopsiUI::CycleButton, WoopsiUI::DecorationGlyphButton, WoopsiUI::RadioButton, and WoopsiUI::WindowBorderButton.

virtual void WoopsiUI::Button::drawOutline | ( | GraphicsPort * | port | ) | `[protected, virtual]`

Draws the outline of the button.

Parameters:

  | port | Graphics port to draw to.

Reimplemented in WoopsiUI::CycleButton, WoopsiUI::DecorationGlyphButton, and WoopsiUI::StickyButton.

virtual void WoopsiUI::Button::onClick | ( | s16 | x,
|  | s16 | y |
| ) |  |  | `[protected, virtual]`

Redraws the button.

Parameters:

  | x | The x co-ordinate of the click.
  | y | The y co-ordinate of the click.

Reimplemented from WoopsiUI::Gadget.

Reimplemented in WoopsiUI::CheckBox, and WoopsiUI::RadioButton.

virtual void WoopsiUI::Button::onRelease | ( | s16 | x,
|  | s16 | y |
| ) |  |  | `[protected, virtual]`

Raises an action event and redraws the button.

Parameters:

  | x | The x co-ordinate of the stylus.
  | y | The y co-ordinate of the stylus.

Reimplemented from WoopsiUI::Gadget.

Reimplemented in WoopsiUI::CycleButton.

virtual void WoopsiUI::Button::onReleaseOutside | ( | s16 | x,
|  | s16 | y |
| ) |  |  | `[protected, virtual]`

Redraws the button.

Parameters:

  | x | The x co-ordinate of the stylus.
  | y | The y co-ordinate of the stylus.

Reimplemented from WoopsiUI::Gadget.

Reimplemented in WoopsiUI::CycleButton.

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

- button.h