# WoopsiUI::AnimButton Class Reference

`#include <animbutton.h>`

Inheritance diagram for WoopsiUI::AnimButton:

List of all members.

## Public Member Functions
| AnimButton (s16 x, s16 y, u16 width, u16 height, u16 animX, u16 animY)
virtual void | draw (Rect clipRect)
virtual Animation *const | getNormalAnimation ()
virtual Animation *const | getClickedAnimation ()
bool | click (s16 x, s16 y)
bool | release (s16 x, s16 y)
## Protected Member Functions
virtual | ~AnimButton ()
| AnimButton (const AnimButton &animButton)
void | handleActionEvent (const GadgetEventArgs &e)
## Protected Attributes
Animation * | _animNormal
Animation * | _animClicked
u16 | _animX
u16 | _animY
bool | _initialised
WoopsiTimer * | _timer

## Detailed Description

Button class that has an animation running in its clickable area. Note that the bitmaps used in the animation should all be the same size.

## Constructor & Destructor Documentation

WoopsiUI::AnimButton::AnimButton | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height,
|  | u16 | animX,
|  | u16 | animY |
| ) |  |  |

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.
  | animX | The x co-ordinate at which the animation's bitmaps will be drawn.
  | animY | The y co-ordinate at which the animation's bitmaps will be drawn.

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

Destructor.

WoopsiUI::AnimButton::AnimButton | ( | const AnimButton & | animButton | ) | `[inline, protected]`

Copy constructor is protected to prevent usage.

## Member Function Documentation

bool WoopsiUI::AnimButton::click | ( | s16 | x,
|  | s16 | y |
| ) |  |  | `[virtual]`

Click the button at the specified co-ordinates.

Parameters:

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

Returns:
  True if the click was successful.

Reimplemented from WoopsiUI::Gadget.

virtual void WoopsiUI::AnimButton::draw | ( | Rect | clipRect | ) | `[virtual]`

Draw the region of the button that falls within the clipRect.

Parameters:

  | clipRect | The clipping region to draw within.

Reimplemented from WoopsiUI::Gadget.

virtual Animation* const WoopsiUI::AnimButton::getClickedAnimation | ( |  | ) | `[virtual]`

Get a pointer to the animation that plays when the button is clicked.

Returns:
  Pointer to the clicked animation.

virtual Animation* const WoopsiUI::AnimButton::getNormalAnimation | ( |  | ) | `[virtual]`

Get a pointer to the animation that plays when the button is not clicked.

Returns:
  Pointer to the normal animation.

void WoopsiUI::AnimButton::handleActionEvent | ( | const GadgetEventArgs & | e | ) | `[protected, virtual]`

Handle any child events.

Parameters:

  | e | Event arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

bool WoopsiUI::AnimButton::release | ( | s16 | x,
|  | s16 | y |
| ) |  |  | `[virtual]`

Click the button at the specified co-ordinates.

Parameters:

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

Returns:
  True if the click was successful.

Reimplemented from WoopsiUI::Gadget.

## Member Data Documentation

Animation* WoopsiUI::AnimButton::_animClicked`[protected]`

Animation played when button is clicked

Animation* WoopsiUI::AnimButton::_animNormal`[protected]`

Animation played when button is not clicked

u16 WoopsiUI::AnimButton::_animX`[protected]`

X co-ordinate of the animations

u16 WoopsiUI::AnimButton::_animY`[protected]`

Y co-ordinate of the animations

bool WoopsiUI::AnimButton::_initialised`[protected]`

Tracks if the animation has started or not

WoopsiTimer* WoopsiUI::AnimButton::_timer`[protected]`

Controls animation timing and playback

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

- C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.40/Woopsi/libwoopsi/include/animbutton.h