Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

Button Class Reference

#include <Button.h>

Inheritance diagram for Button:

MenuItem BackButton List of all members.

Public Member Functions

 Button (const string &label, const string &name, Font *font)
 ~Button ()
void draw (float x, float y, float zoom)
Type getType ()
float getWidth (float zoom)
float getHeight (float zoom)
string & getName ()
bool handleKeyEvent (SDL_Event *event)
bool wasClicked ()

Detailed Description

A calls for button controls, a control that you can push to get some action "Start game" or similar

Definition at line 13 of file Button.h.


Constructor & Destructor Documentation

Button::Button const string &  label,
const string &  name,
Font font
 

Constructor that takes

label as the text to display to the user

name the save name of button (soon to be removed)

font the font to render the button with

Definition at line 6 of file Button.cpp.

Button::~Button  ) 
 

Destuctor

Definition at line 14 of file Button.cpp.


Member Function Documentation

void Button::draw float  x,
float  y,
float  zoom
[virtual]
 

Draws the MenuItem at x,y with a zoom factor of zoom (2 equals double size).

The MenuItem may decide not to apply the scale or to only support some zoom steps, always check getWidth and getHeight if you need the excact size.

Implements MenuItem.

Definition at line 18 of file Button.cpp.

float Button::getHeight float  zoom  )  [virtual]
 

Returns the height of this MenuItem at zoom factor zoom, must be excact

Implements MenuItem.

Definition at line 28 of file Button.cpp.

string& Button::getName  )  [inline, virtual]
 

Returns the name of the MenuItem used when save is called.

The name may not contain a =.

Implements MenuItem.

Definition at line 32 of file Button.h.

Type Button::getType  )  [inline, virtual]
 

Returns the Type of this control.

Implements MenuItem.

Reimplemented in BackButton.

Definition at line 29 of file Button.h.

float Button::getWidth float  zoom  )  [virtual]
 

Returns the width of this MenuItem at zoom factor zoom, must be excact

Implements MenuItem.

Definition at line 23 of file Button.cpp.

bool Button::handleKeyEvent SDL_Event *  event  )  [virtual]
 

Called when a key press/release event occurs, return true if the MenuItem has handled the event.

If true is returned the event handling will stop.

Implements MenuItem.

Definition at line 33 of file Button.cpp.

bool Button::wasClicked  ) 
 

Returns true if the button has been clicked since last time it was checked.

Definition at line 42 of file Button.cpp.


The documentation for this class was generated from the following files:
Generated on Wed Sep 1 14:46:57 2004 by doxygen 1.3.7