Woopsi 1.3
Nintendo DS Gui Framework
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
WoopsiUI::AnimButton Class Reference

#include <libwoopsi/include/animbutton.h>

Inheritance diagram for WoopsiUI::AnimButton:
WoopsiUI::Gadget WoopsiUI::GadgetEventHandler

List of all members.

Public Member Functions

 AnimButton (s16 x, s16 y, u16 width, u16 height, u16 animX, u16 animY)
virtual Animation *const getNormalAnimation ()
virtual Animation *const getClickedAnimation ()
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 void onDisable ()
virtual void onEnable ()
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

Static Protected Attributes

static const int ANIM_BUTTON_DEFAULT_WIDTH
static const int ANIM_BUTTON_DEFAULT_HEIGHT

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:
xThe x co-ordinate of the button.
yThe y co-ordinate of the button.
widthThe width of the button.
heightThe height of the button.
animXThe x co-ordinate at which the animation's bitmaps will be drawn.
animYThe 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

virtual void WoopsiUI::AnimButton::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:
portThe GraphicsPort to draw to.
See also:
redraw()

Reimplemented from WoopsiUI::Gadget.

virtual void WoopsiUI::AnimButton::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:
portThe GraphicsPort to draw to.
See also:
redraw()

Reimplemented from WoopsiUI::Gadget.

virtual void WoopsiUI::AnimButton::drawOutline ( GraphicsPort port) [protected, virtual]

Draws the outline of the button.

Parameters:
portGraphics port to draw to.
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.
virtual void WoopsiUI::AnimButton::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:
rectReference to a rect to populate with data.

Reimplemented from WoopsiUI::Gadget.

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

Handle any child events.

Parameters:
eEvent arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::AnimButton::onClick ( s16  x,
s16  y 
) [protected, virtual]

Swaps from playing the standard animation to the clicked animtion.

Parameters:
xThe x co-ordinate of the click.
yThe y co-ordinate of the click.

Reimplemented from WoopsiUI::Gadget.

virtual void WoopsiUI::AnimButton::onDisable ( ) [protected, virtual]

Pauses the current animation.

Reimplemented from WoopsiUI::Gadget.

virtual void WoopsiUI::AnimButton::onEnable ( ) [protected, virtual]

Starts the current animation.

Reimplemented from WoopsiUI::Gadget.

virtual void WoopsiUI::AnimButton::onRelease ( s16  x,
s16  y 
) [protected, virtual]

Swaps from playing the clicked animation to the standard animation.

Parameters:
xThe x co-ordinate of the click.
yThe y co-ordinate of the click.

Reimplemented from WoopsiUI::Gadget.

virtual void WoopsiUI::AnimButton::onReleaseOutside ( s16  x,
s16  y 
) [protected, virtual]

Swaps from playing the clicked animation to the standard animation.

Parameters:
xThe x co-ordinate of the click.
yThe y co-ordinate of the click.

Reimplemented from WoopsiUI::Gadget.


Member Data Documentation

Animation played when button is clicked

Animation played when button is not clicked

X co-ordinate of the animations

Y co-ordinate of the animations

Tracks if the animation has started or not

Controls animation timing and playback

const int WoopsiUI::AnimButton::ANIM_BUTTON_DEFAULT_HEIGHT [static, protected]

Default preferred height

const int WoopsiUI::AnimButton::ANIM_BUTTON_DEFAULT_WIDTH [static, protected]

Default preferred width


The documentation for this class was generated from the following file:
 All Classes Functions Variables Enumerations Enumerator