Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

GUIButton Class Reference

#include <guibutton.h>

List of all members.

Public Methods

 GUIButton (Game *parentgame, Texture *icon, const char *tooltip, int x, int y, Vector &baseposition, SDLKey hotkey=SDLK_UNKNOWN, int modifier=KMOD_NONE)
 GUIButton (Game *parentgame, const char *text, int x, int y, Vector &baseposition, SDLKey hotkey=SDLK_UNKNOWN, int modifier=KMOD_NONE)
 ~GUIButton ()
void setAutoRefresh (bool enable)
void setCallback (void(*callback)())
bool clicked ()
void render ()
void refresh ()
void setFont (BFont *tipfont)

Private Attributes

int ismouseover
Texturetex
const char * tip
const char * buttontext
Vector pos
Vector size
Vectorbasepos
Gamegame
BFontfont
int buttontype
float normalcolor [4]
float hovercolor [4]
float activecolor [4]
float currentcolor [4]
void(* buttonCallback )()
bool click
bool autorefresh
SDLKey hotk
int modk


Detailed Description

A simple push button with icon and tooltip
Author:
T Kontkanen


Constructor & Destructor Documentation

GUIButton::GUIButton Game *   parentgame,
Texture *   icon,
const char *   tooltip,
int   x,
int   y,
Vector &   baseposition,
SDLKey   hotkey = SDLK_UNKNOWN,
int   modifier = KMOD_NONE
 

Create new button with icon and tooltip at specific position. Render() adds baseposition to x,y and it can be changed at any time. Optionally hotkey and key modifier (KMOD_ALT, KMOD_CTRL etc) can be set.

GUIButton::GUIButton Game *   parentgame,
const char *   text,
int   x,
int   y,
Vector &   baseposition,
SDLKey   hotkey = SDLK_UNKNOWN,
int   modifier = KMOD_NONE
 

Create new button with text at specific position. Other options are same with icon button.

GUIButton::~GUIButton  
 

Destructor.


Member Function Documentation

bool GUIButton::clicked   [inline]
 

Return true if button is clicked. Cliked status will be cleared in next refresh().

void GUIButton::refresh  
 

Check input and update state, call this every frame when button is visible.

void GUIButton::render  
 

Render a button.

void GUIButton::setAutoRefresh bool   enable [inline]
 

Set autorefresh mode, If enable is true refresh() will be called in render(), otherwise refresh() must be called separately. By default autorefresh is enabled.

void GUIButton::setCallback void(*   callback)() [inline]
 

Set a callback fuction for button press. Callback can't be a member of class, must be C-function like: void test().

void GUIButton::setFont BFont *   tipfont [inline]
 

Set tooltip font.


Member Data Documentation

float GUIButton::activecolor[4] [private]
 

bool GUIButton::autorefresh [private]
 

Vector * GUIButton::basepos [private]
 

void (* GUIButton::buttonCallback)() [private]
 

Call this function when pressed.

const char * GUIButton::buttontext [private]
 

int GUIButton::buttontype [private]
 

bool GUIButton::click [private]
 

float GUIButton::currentcolor[4] [private]
 

BFont* GUIButton::font [private]
 

Game* GUIButton::game [private]
 

SDLKey GUIButton::hotk [private]
 

float GUIButton::hovercolor[4] [private]
 

int GUIButton::ismouseover [private]
 

int GUIButton::modk [private]
 

float GUIButton::normalcolor[4] [private]
 

Vector GUIButton::pos [private]
 

Vector GUIButton::size [private]
 

Texture* GUIButton::tex [private]
 

const char* GUIButton::tip [private]
 


The documentation for this class was generated from the following file:
Generated at Fri Oct 5 20:23:53 2001 for Executor by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001