Widget Class Reference
[2D Graphical User Inteface]

Master Widget Class

This class is a virtual class. You need to use a class which inherit from it to do a widget. More...

#include <Widget.hh>

Inheritance diagram for Widget:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Widget (SDL_Surface *screen, Widget *father=NULL)
 Widget (const uint w, const uint h, SDL_Surface *screen, Widget *father=NULL)
 Widget (const uint x, const uint y, const uint w, const uint h, SDL_Surface *screen, Widget *father=NULL)
virtual ~Widget ()
virtual void draw ()=0
 virtual method to draw the widget.
virtual void refresh ()=0
 virtual method to refresh the widget
void erase ()
 Method to erase the widget.
virtual void mousemotion (const uint mousex, const uint mousey)=0
 virtual method to do something when the mouse is moved
ushort inside (const uint mousex, const uint mousey)
 method to test if the mouse pointer is inside the widget
virtual ushort mousebuttondown (const uint mousex, const uint mousey)
 virtual method to do something when a button of the mouse is pressed
virtual void keydown (const SDL_keysym *keysym)
 virtual method to do something when a key of the keyboard is pressed
virtual void gainfocus ()
 virtual method used when the widget gain the focus
virtual void losefocus ()
 virtual method used when the widget lose the focus
virtual bool hasfocus ()
 virtual method to test tha value of the focus variable
uint get_x ()
 Method to get the x coordinate of the widget in the father coordinate system.
uint get_wx ()
 Method to get the x coordinate of the widget in the window coordinate system.
void set_x (const uint x)
 Method to set the x coordinate of the widget in the father coordinate system.
uint get_y ()
 Method to get the y coordinate of the widget in the father coordinate system.
uint get_wy ()
 Method to get the y coordinate of the widget in the window coordinate system.
void set_y (const uint y)
 Method to set the y coordinate of the widget in the father coordinate system.
uint get_width ()
 Method to get the width of the widget.
void set_width (const uint width)
 Method to set the width of the widget.
uint get_height ()
 Method to get the height of the widget.
void set_height (const uint height)
 Method to set the heigth ot the widget.

Static Public Member Functions

static Focus & get_focus ()
 Method to return the globfocus.

Protected Attributes

SDL_Surface * screen
SDL_Surface * old_screen
SDL_Surface * widget
Widgetfather
uint x
uint y
uint w
uint h
bool visible
bool focus

Static Protected Attributes

static Focus globfocus

Detailed Description

Master Widget Class

This class is a virtual class. You need to use a class which inherit from it to do a widget.

Author:
poltuiu
Date:
2006-10-27


Constructor & Destructor Documentation

Widget::Widget ( SDL_Surface *  screen,
Widget father = NULL 
)

Constructor

Parameters:
screen is the SDL_Surface in which the widget will be printed
father is the widget father

Widget::Widget ( const uint  w,
const uint  h,
SDL_Surface *  screen,
Widget father = NULL 
)

Constructor

Parameters:
w is the width of the widget
h is the height of the widget
screen is the SDL_Surface in which the widget will be printed
father is the widget father

Widget::Widget ( const uint  x,
const uint  y,
const uint  w,
const uint  h,
SDL_Surface *  screen,
Widget father = NULL 
)

Constructor

Parameters:
x is the x coordinate of the widget
y is the y coordinate of the widget
w is the width of the widget
h is the height of the widget
screen is the SDL_Surface in which the widget will be printed
father is the widget father

Widget::~Widget (  )  [virtual]

Destructor


Member Function Documentation

void Widget::erase (  ) 

Method to erase the widget.

Replace the screen by the save screen.

Reimplemented in DialogBox, and Menu.

void Widget::gainfocus (  )  [virtual]

virtual method used when the widget gain the focus

The method set focus variable to true ..

Focus & Widget::get_focus (  )  [static]

Method to return the globfocus.

globfocus is a static variable which stores the reference of the widget which has focus

uint Widget::get_height (  ) 

Method to get the height of the widget.

Returns:
the height of the wdget

uint Widget::get_width (  ) 

Method to get the width of the widget.

Returns:
the width of the widget

uint Widget::get_wx (  ) 

Method to get the x coordinate of the widget in the window coordinate system.

Returns:
the x coordinate

uint Widget::get_wy (  ) 

Method to get the y coordinate of the widget in the window coordinate system.

Returns:
the y coordinate

uint Widget::get_x (  ) 

Method to get the x coordinate of the widget in the father coordinate system.

Returns:
the x coordinate

uint Widget::get_y (  ) 

Method to get the y coordinate of the widget in the father coordinate system.

Returns:
the y coordinate

bool Widget::hasfocus (  )  [virtual]

virtual method to test tha value of the focus variable

Returns:
the boolean value of the focus

ushort Widget::inside ( const uint  mousex,
const uint  mousey 
)

method to test if the mouse pointer is inside the widget

Parameters:
mousex is the mouse pointer x coordinate
mousey is the mouse pointer y coordinate
Returns:
0 or 1

virtual void Widget::keydown ( const SDL_keysym *  keysym  )  [inline, virtual]

virtual method to do something when a key of the keyboard is pressed

Note:
method for textuals widgets
Parameters:
keysym is the key pressed in Keysym structure

void Widget::losefocus (  )  [virtual]

virtual method used when the widget lose the focus

The method set focus variable to false ..

ushort Widget::mousebuttondown ( const uint  mousex,
const uint  mousey 
) [virtual]

virtual method to do something when a button of the mouse is pressed

Parameters:
mousex is the mouse pointer x coordinate
mousey is the mouse pointer y coordinate
Returns:
0 or 1

Reimplemented in ImageButton, TextButton, DialogBox, DInfo, and Menu.

virtual void Widget::mousemotion ( const uint  mousex,
const uint  mousey 
) [pure virtual]

virtual method to do something when the mouse is moved

Parameters:
mousex is the mouse pointer x coordinate
mousey is the mouse pointer y coordinate

Implemented in ImageButton, TextButton, DialogBox, and Menu.

void Widget::set_height ( const uint  height  ) 

Method to set the heigth ot the widget.

Parameters:
height is the value to set

void Widget::set_width ( const uint  width  ) 

Method to set the width of the widget.

Parameters:
width is the value to set

void Widget::set_x ( const uint  x  ) 

Method to set the x coordinate of the widget in the father coordinate system.

Parameters:
x is the value to set

void Widget::set_y ( const uint  y  ) 

Method to set the y coordinate of the widget in the father coordinate system.

Parameters:
y is the value to set


The documentation for this class was generated from the following files:
Generated on Sat Jun 23 16:15:10 2007 for Stechec/TBT by  doxygen 1.4.7