Button Class Reference

Puts a button on the screen. More...

#include <Button.h>

Inheritance diagram for Button:

Object2d MouseAdapterLeft ViewObject MouseListener Object Object

List of all members.

Public Member Functions

 Button ()
 Standard Constructor.
 Button (const Button &src)
 Copy Constructor.
 Button (const Label &label, const float &width, const float &height, const Texture &sTexture, const Texture &hTexture, const Texture &pTexture)
 Constructor for Initialization by value.
 ~Button ()
 Destructor.
void registerListener (ButtonListener *listener)
 Register a new listener.
void unregisterListener (ButtonListener *listener)
 Unregister a new listener.
void pressLeft (const GLuint &id, const GLuint &x, const GLuint &y, const GLint &xRel, const GLint &yRel)
 Action to be performed if left click occurs.
void releaseLeft (const GLuint &id, const GLuint &x, const GLuint &y, const GLint &xRel, const GLint &yRel)
 Action to be performed if left click occurs.
void move (const GLuint &id, const GLuint &x, const GLuint &y, const GLint &xRel, const GLint &yRel)
 Action to be performed if mouse motion occurs.
void renderGl ()
 The rendering function to be used with OpenGL.
void selectGl ()
 The selection mode rendering function for OpenGL.
LabelgetLabel ()
GLfloat & getWidth ()
GLfloat & getHeight ()
TexturegetSTexture ()
TexturegetHTexture ()
TexturegetPTexture ()
void setLabel (const Label &label)
void setWidth (const GLfloat &width)
void setHeight (const GLfloat &height)
void setSTexture (const Texture &texture)
void setHTexture (const Texture &texture)
void setPTexture (const Texture &texture)
virtual string toString () const
 Returns a textual representation.
virtual string className () const
 Returns the class name of the object.
virtual enum classId classId () const
 Returns the class id of the object.

Private Attributes

vector< ButtonListener * > listeners
 The list of ActionListeners.
Label label
 The Label that is written on the button.
Color color
 The Color of the button.
GLfloat width
 The width of the button.
GLfloat height
 The height of the button.
bool active
 Indicates the state of the button.
Texture sTexture
 The standard texture.
Texture hTexture
 The hover texture.
Texture pTexture
 The pressed texture.
enum mouseState state
 The state of the mouse.
struct buttonState buttons
 the state of the mouse buttons


Detailed Description

Puts a button on the screen.

This class creates a button.


Constructor & Destructor Documentation

Button::Button (  ) 

Standard Constructor.

The Standard Constructor

Button::Button ( const Button src  ) 

Copy Constructor.

Button::Button ( const Label label,
const float &  width,
const float &  height,
const Texture sTexture,
const Texture hTexture,
const Texture pTexture 
)

Constructor for Initialization by value.

Button::~Button (  ) 

Destructor.

The Destructor


Member Function Documentation

void Button::registerListener ( ButtonListener listener  ) 

Register a new listener.

void Button::unregisterListener ( ButtonListener listener  ) 

Unregister a new listener.

void Button::pressLeft ( const GLuint &  id,
const GLuint &  x,
const GLuint &  y,
const GLint &  xRel,
const GLint &  yRel 
) [virtual]

Action to be performed if left click occurs.

Implements MouseAdapterLeft.

void Button::releaseLeft ( const GLuint &  id,
const GLuint &  x,
const GLuint &  y,
const GLint &  xRel,
const GLint &  yRel 
) [virtual]

Action to be performed if left click occurs.

Implements MouseAdapterLeft.

void Button::move ( const GLuint &  id,
const GLuint &  x,
const GLuint &  y,
const GLint &  xRel,
const GLint &  yRel 
) [virtual]

Action to be performed if mouse motion occurs.

Implements MouseAdapterLeft.

void Button::renderGl (  )  [virtual]

The rendering function to be used with OpenGL.

Implements Object2d.

void Button::selectGl (  )  [virtual]

The selection mode rendering function for OpenGL.

Implements Object2d.

Label & Button::getLabel (  ) 

GLfloat & Button::getWidth (  ) 

GLfloat & Button::getHeight (  ) 

Texture & Button::getSTexture (  ) 

Texture & Button::getHTexture (  ) 

Texture & Button::getPTexture (  ) 

void Button::setLabel ( const Label label  ) 

void Button::setWidth ( const GLfloat &  width  ) 

void Button::setHeight ( const GLfloat &  height  ) 

void Button::setSTexture ( const Texture texture  ) 

void Button::setHTexture ( const Texture texture  ) 

void Button::setPTexture ( const Texture texture  ) 

string Button::toString (  )  const [virtual]

Returns a textual representation.

Returns:
a string descriping the run-time object

Reimplemented from MouseAdapterLeft.

string Button::className (  )  const [virtual]

Returns the class name of the object.

Returns:
a string with the name of the object's class

Reimplemented from MouseAdapterLeft.

enum classId Button::classId (  )  const [virtual]

Returns the class id of the object.

Returns:
an id of the object's class

Reimplemented from MouseAdapterLeft.


Member Data Documentation

vector<ButtonListener*> Button::listeners [private]

The list of ActionListeners.

Label Button::label [private]

The Label that is written on the button.

Color Button::color [private]

The Color of the button.

GLfloat Button::width [private]

The width of the button.

GLfloat Button::height [private]

The height of the button.

bool Button::active [private]

Indicates the state of the button.

The standard texture.

The hover texture.

The pressed texture.

enum mouseState Button::state [private]

The state of the mouse.

struct buttonState Button::buttons [read, private]

the state of the mouse buttons


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

Generated on Mon Jul 7 13:30:33 2008 for Firefly by  doxygen 1.5.6