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

CUI_MultipleStateButton Class Reference

A button with one or more states. More...

#include <CUI_MultipleStateButton.h>

Inheritance diagram for CUI_MultipleStateButton:

CUI_Button CUI_Widget CUI_Frame List of all members.

Public Member Functions

 CUI_MultipleStateButton (CUI_UI *ui=NULL, float x=0, float y=0, float x2=1, float y2=1, CUI_Frame *parent=NULL, IUI_Shader *shader=NULL, IUI_Shader *cursor=NULL, CUI_CoordSys *coordsys=NULL, char *text=NULL, IUI_Font *font=NULL, float textscale=0.8, IUI_Border *border=NULL, IUI_Shader *hover=NULL, IUI_Shader *disable=NULL, IUI_Shader *click=NULL, int numberofstates=1, int initialstate=0, actionfunc_state stateaction=NULL)
 constructor

virtual ~CUI_MultipleStateButton ()
 destructor

virtual bool Render (double dtime, IUI_Renderer *renderer)
 overloaded render

virtual unsigned int AddState (IUI_Shader *shader=NULL, IUI_Shader *hover=NULL, IUI_Shader *disable=NULL, IUI_Shader *click=NULL)
 Add a new state to this button.

virtual unsigned int GetState (void)
 get the current state

virtual bool SetShader (IUI_Shader *shader, int state=0)
 set the shader for a certain state of this button

virtual bool SetHoverShader (IUI_Shader *shader, int state=0)
 set the shader for a certain state to be used when this button is being hovered over

virtual bool SetDisableShader (IUI_Shader *shader, int state=0)
 set the shader for a certain state to be used when this button is disabled

virtual bool SetClickShader (IUI_Shader *shader, int state=0)
 set the shader for a certain state to be used when this button is clicked

virtual bool Click (int &id, int &numparam, void **param)
 Call the click action function.

virtual void DeleteParam (void *param)
 Delete a parameter allocated by this frame.

virtual bool Reset ()
 reset to state 0

virtual bool SetState (unsigned short state)
 jump to a state

virtual unsigned short GetNumStates ()
 get the number of states this button has


Protected Attributes

unsigned short m_numstates
 Number of states this button has.

unsigned int m_currentstate
 current state this button is in

IUI_Shader ** m_defaultShaders
 the default shaders (organized by state)

IUI_Shader ** m_hoverShaders
 the hover shader (organized by state)

IUI_Shader ** m_disableShaders
 the disabled shader (organized by state)

IUI_Shader ** m_clickShaders
 the clicked shader (organized by state)


Detailed Description

A button with one or more states.

Normally used for checkboxes, but also allows for more complex controls.

Recognized flags:
[system]
UI_CLICKED
UI_HOVER
UI_SELECTED

UI_DISABLED
UI_INACTIVE


Constructor & Destructor Documentation

CUI_MultipleStateButton::~CUI_MultipleStateButton  )  [virtual]
 

destructor

Free the arrays of pointers


Member Function Documentation

unsigned int CUI_MultipleStateButton::AddState IUI_Shader shader = NULL,
IUI_Shader hover = NULL,
IUI_Shader disable = NULL,
IUI_Shader click = NULL
[virtual]
 

Add a new state to this button.

Reallocates enough memory every single call. If anyone thinks this is a problem (it should only be happening during init), feel free to rewrite it.

Returns:
the state id

bool CUI_MultipleStateButton::Click int &  id,
int &  numparam,
void **  param
[virtual]
 

Call the click action function.

The UI will only call this function when the button is let up while over the same button it was clicked on

Reimplemented from CUI_Button.

virtual void CUI_MultipleStateButton::DeleteParam void *  param  )  [inline, virtual]
 

Delete a parameter allocated by this frame.

MultipleStateButtons return 1 int

Reimplemented from CUI_Button.

bool CUI_MultipleStateButton::SetClickShader IUI_Shader shader,
int  state = 0
[virtual]
 

set the shader for a certain state to be used when this button is clicked

See also:
SetShader

bool CUI_MultipleStateButton::SetDisableShader IUI_Shader shader,
int  state = 0
[virtual]
 

set the shader for a certain state to be used when this button is disabled

See also:
SetShader

bool CUI_MultipleStateButton::SetHoverShader IUI_Shader shader,
int  state = 0
[virtual]
 

set the shader for a certain state to be used when this button is being hovered over

See also:
SetShader

bool CUI_MultipleStateButton::SetShader IUI_Shader shader,
int  state = 0
[virtual]
 

set the shader for a certain state of this button

this is the default shader

See also:
SetHoverShader

SetDisableShader

SetClickShader


The documentation for this class was generated from the following files:
Generated on Mon Sep 29 23:07:04 2003 for glGUI by doxygen 1.3.4