# WoopsiUI::BitmapButton Class Reference

`#include <bitmapbutton.h>`

Inheritance diagram for WoopsiUI::BitmapButton:

List of all members.

## Public Member Functions
| BitmapButton (s16 x, s16 y, u16 width, u16 height, u16 bitmapX, u16 bitmapY, const BitmapBase *bitmapNormal, const BitmapBase *bitmapClicked)
virtual void | getPreferredDimensions (Rect &rect) const
## Protected Member Functions
virtual void | drawContents (GraphicsPort *port)
virtual void | drawBorder (GraphicsPort *port)
virtual void | drawOutline (GraphicsPort *port)
virtual void | onClick (s16 x, s16 y)
virtual void | onRelease (s16 x, s16 y)
virtual void | onReleaseOutside (s16 x, s16 y)
virtual | ~BitmapButton ()
| BitmapButton (const BitmapButton &bitmapButton)
## Protected Attributes
const BitmapBase * | _bitmapNormal
const BitmapBase * | _bitmapClicked
u16 | _bitmapX
u16 | _bitmapY

## Detailed Description

Class representing a clickable button that contains a bitmap image instead of text. Displays two bitmaps, one when the button is clicked, and one when it isn't. The bitmaps should be the same size.

## Constructor & Destructor Documentation

WoopsiUI::BitmapButton::BitmapButton | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height,
|  | u16 | bitmapX,
|  | u16 | bitmapY,
|  | const BitmapBase * | bitmapNormal,
|  | const BitmapBase * | bitmapClicked |
| ) |  |  |

Constructor.

Parameters:

  | x | The x co-ordinate of the button.
  | y | The y co-ordinate of the button.
  | width | The width of the button.
  | height | The height of the button.
  | bitmapX | The x co-ordinate at which the bitmaps will be drawn.
  | bitmapY | The y co-ordinate at which the bitmaps will be drawn.
  | bitmapNormal | Pointer to the unclicked bitmap.
  | bitmapClicked | Pointer to the clicked bitmap.

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

Destructor.

WoopsiUI::BitmapButton::BitmapButton | ( | const BitmapButton & | bitmapButton | ) | `[inline, protected]`

Copy constructor is protected to prevent usage.

## Member Function Documentation

virtual void WoopsiUI::BitmapButton::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::Gadget.

virtual void WoopsiUI::BitmapButton::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::BitmapButton::drawOutline | ( | GraphicsPort * | port | ) | `[protected, virtual]`

Draws the outline of the button.

Parameters:

  | port | Graphics port to draw to.

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

Parameters:

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

Reimplemented from WoopsiUI::Gadget.

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

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

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

## Member Data Documentation

const BitmapBase* WoopsiUI::BitmapButton::_bitmapClicked`[protected]`

Bitmap to display when button is clicked

const BitmapBase* WoopsiUI::BitmapButton::_bitmapNormal`[protected]`

Bitmap to display when button is not clicked

u16 WoopsiUI::BitmapButton::_bitmapX`[protected]`

X co-ordinate of the bitmaps

u16 WoopsiUI::BitmapButton::_bitmapY`[protected]`

Y co-ordinate of the bitmaps

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

- bitmapbutton.h