GuiDynamicButton Class Reference
[2D graphical user interface]

A base class for buttons. More...

#include <guidynamicbutton.h>

Inheritance diagram for GuiDynamicButton:

Inheritance graph
[legend]
Collaboration diagram for GuiDynamicButton:

Collaboration graph
[legend]
List of all members.

Public Types

enum  DynamicState { ds_none, ds_fast }
enum  StateType { normal = 0, pressed = 1, mouseover = 2 }

Public Member Functions

DECLSPEC GuiDynamicButton (const SDL_Rect &r, GuiElement *p, const char *name, const char *t, SdlSurfaceContainer *b=0, SdlAudio *u=0, SdlAudio *d=0)
DECLSPEC GuiDynamicButton (TiXmlElement *el, GuiElement *p)
virtual const char * getClassName ()
StateType getState () const
DECLSPEC void setBorderVisible (bool show)
DECLSPEC void setSounds (SdlAudio *u, SdlAudio *d)
DECLSPEC void setButtonBmps (SdlSurfaceContainer *b=0)
DECLSPEC void setText (const char *t=0)

Static Public Member Functions

static void newguiobject (void *presult, BasicObject *o, void *xmldata)

Public Attributes

enum GuiDynamicButton::DynamicState eDynamic

Protected Member Functions

virtual DECLSPEC Uint32 onFrame (SdlSurface *dst)
virtual DECLSPEC Uint32 onButtonPress (Sint32 x, Sint32 y)
virtual DECLSPEC Uint32 onButtonRelease (bool bInClient)
virtual DECLSPEC Uint32 onThemeChanged (UiTheme *t)
virtual DECLSPEC void onInit ()
virtual DECLSPEC Uint32 changeTheme (UiTheme *t, const char *classname)
void setBtnState (StateType t)
StateType getBtnState ()
 
Returns:
the button's state


Detailed Description

A base class for buttons.


Constructor & Destructor Documentation

GuiDynamicButton::GuiDynamicButton ( TiXmlElement el,
GuiElement p 
)

Constructor. Uses XML data.

Parameters:
el the XML data for initialisation, attributes: Caption (string), ButtonBmps (name of surface), ButtonSoundUp (name of sound), ButtonSoundDown (name of sound)
p parent element (or NULL, to take GuiManager::the as parent)
See also:
GuiElement(TiXmlElement*,GuiElement*)


Member Function Documentation

virtual const char* GuiDynamicButton::getClassName (  )  [inline, virtual]

This function should be overriden in every sub-class of BasicObject!

Returns:
the name of the class.

Reimplemented from GuiBorder.

Reimplemented in GuiClickableBtn, GuiCheckableBtn, and GuiRadioBtn.

Uint32 GuiDynamicButton::onFrame ( SdlSurface dst  )  [protected, virtual]

This event is called, when a frame is drawn. If the object should be visible, is has to draw it's look to a valid surface. This method calls the children's function, if visible.

Returns:
zero, if no error occured; if not zero, drawing is stopped
Note:
if you derive the function, then call GuiElement::onFrame(SdlSurface*) after your class's drawing was done in the onFrame-event, otherwise you paint over the children elements

Reimplemented from GuiBorder.

Uint32 GuiDynamicButton::onThemeChanged ( UiTheme t  )  [protected, virtual]

This event is called, when the theme changes. Perform here the changes of the object's look and feel.

Parameters:
t pointer to the new used theme
Returns:
currently the result is not used; may be zero, if no error...

Reimplemented from GuiBorder.

Reimplemented in GuiClickableBtn, GuiCheckableBtn, and GuiRadioBtn.

void GuiDynamicButton::onInit (  )  [protected, virtual]

Initializes the object's variables by reading data from the XML element. If there were no XML data used for creation, nothing is done. This function calls onInit() of its children recursively (after it has inited itself). It is highly recommended to call BasicObject::onInit(), usually at the end of the onInit() method, when overwriting it in a derived class.

Reimplemented from GuiBorder.

Reimplemented in GuiClickableBtn, GuiCheckableBtn, and GuiRadioBtn.

void GuiDynamicButton::setBtnState ( StateType  t  )  [inline, protected]

Changes the button state and sets the redraw-state (only if t is not yet the state)

Parameters:
t the state to assign


The documentation for this class was generated from the following files:
Generated on Wed May 9 17:36:15 2007 for netrinjo by  doxygen 1.5.1