Public Member Functions | Private Member Functions | Private Attributes

Button Class Reference

A Button object derived from base class Control. More...

#include <Button.h>

Inheritance diagram for Button:
Control Broadcaster Listener CloseButton

List of all members.

Public Member Functions

 Button (const std::string &caption, const std::string &name, int width, int height)
 Button (Image *image, const std::string &name, int width, int height)
 ~Button ()

Private Member Functions

void logic ()
void drawSkin ()
void drawPlain ()
void initialize ()
void drawText ()
void onClick (Event *event)
void onPressed (Event *event)
void onMouseButtonUp (Event *event)
void onEnabled ()
void setDrawValues ()

Private Attributes

ImagemImage
ImagemDisabledImage
int mImgX
int mImgY
int mClampedWidth
int mTextCenterOffset

Detailed Description

A Button object derived from base class Control.

The Button class provides all basic functions of a button.

The Button should respond to all relevant input events coming downstream and send the appropriate response back upstream.

Todo:
Finish implementing broadcasting of events both upstream and downstream so that the button can respond appropriately.

Constructor & Destructor Documentation

Button::Button ( const std::string &  caption,
const std::string &  name,
int  width,
int  height 
)
Button::Button ( Image image,
const std::string &  name,
int  width,
int  height 
)
Button::~Button (  ) 

Destructor.

Frees Button::mImage if allocated.


Member Function Documentation

void Button::drawPlain (  )  [private, virtual]

Draws a Control without a Skin.

Reimplemented from Control.

Reimplemented in CloseButton.

void Button::drawSkin (  )  [private, virtual]

Draws a button skinned.

Todo:
This method only supports type SkinPartType::PART_ENNEAD. This should also support SkinPartType::PART_TRIAD.

Reimplemented from Control.

Reimplemented in CloseButton.

void Button::drawText (  )  [private]
void Button::initialize (  )  [private, virtual]

Initializes the Button.

Reimplemented from Control.

Reimplemented in CloseButton.

void Button::logic (  )  [private, virtual]

Reimplemented from Control.

void Button::onClick ( Event event  )  [private, virtual]

Button's onClick handler.

Notifies a click Listener and pushes a Click event to it.

Warning:
The event pushed into the click Listener is owned by the Button and as such is destroyed by Button. Do not store a direct pointer to the Event.

Reimplemented from Control.

Reimplemented in CloseButton.

void Button::onEnabled (  )  [private, virtual]

Called whenever a Control's setEnabled() function is called.

Reimplemented from Control.

void Button::onMouseButtonUp ( Event event  )  [private, virtual]

Reimplemented from Control.

Reimplemented in CloseButton.

void Button::onPressed ( Event event  )  [private, virtual]

Reimplemented from Control.

Reimplemented in CloseButton.

void Button::setDrawValues (  )  [private]

Member Data Documentation

int Button::mClampedWidth [private]

Actual area that text can be drawn in with side graphics accounted for.

Image* Button::mImage [private]
int Button::mImgX [private]
int Button::mImgY [private]

Center offset taking into account the clamped width area.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines