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

Gewi::GWidget Class Reference

#include <GewiWidget.h>

Inherited by Gewi::GButton, Gewi::GContainer, Gewi::GSlider, Gewi::GStaticText, and Gewi::GTextField.

List of all members.


Detailed Description

Basic widget class, framework and base class for all other widgets.


Public Member Functions

 GWidget (GContainer *parent=NULL)
 Simple constructor for GWidget.

virtual ~GWidget ()
 Simple destructor.

void ToggleVisible ()
 Toggle the visible flag.

void FitParent ()
 Reposition widget within parent.

virtual void Create (float x, float y, float width, float height)
 Sets position and dimensions of widget.

virtual void Move (float x, float y)
 Change relative position.

virtual void Message (SDL_Event *rawEvent, GewiEvent event, Uint16 mouseX, Uint16 mouseY, char ch)=0
 Important function used to recieve messages.

virtual void Show ()=0
 Draws this button to the screen.

float X ()
 Get X position of widget.

float Y ()
 Get Y position of widget.

bool Visible ()
 Get visible state of widget.

bool MouseInWidget ()
 Check if mouse is in widget.

bool Contains (Sint16 x, Sint16 y)
 Check if the widget contains a point.


Protected Attributes

GewiEnginerGewi
 Pointer to GewiEngine instance.

ZE::ZEngine * rZE
 Pointer to ZEngine instance.

ZE::ZRect rBoundRect
 Rectangle describing area of widget.

GContainerrParent
 Pointer to parent container. (NULL means it lays in the global setting).

float rRelX
 Relative X position, relative to parent, or top corner of screen if in global setting.

float rRelY
 Relative Y position, relative to parent, or top corner of screen if in global setting.

bool rVisible
 Stores if widget is currently visible.


Constructor & Destructor Documentation

Gewi::GWidget::GWidget GContainer parent = NULL  ) 
 

Constructor for GWidget, like all widgets this must initialize private data and can take a parent.

Parameters:
parent Pointer to GContainer derived class to be the parent. Default value is NULL which means no parent.

Gewi::GWidget::~GWidget  )  [virtual]
 

Must be virtual so that each derived class can free it's members.


Member Function Documentation

void Gewi::GWidget::ToggleVisible  ) 
 

Toggles the visible flag, only visible widgets are drawn.

void Gewi::GWidget::FitParent  ) 
 

Adjust this widget to be in the correct position in relationship to it's parent. Only containers call this on their children, it generally shouldn't be called.

void Gewi::GWidget::Create float  x,
float  y,
float  width,
float  height
[virtual]
 

Sets up widget rectangle, most widgets must override this to include their specific settings.

Parameters:
x X position of widget within it's container (entire screen if no parent)
y Y position of widget within it's container (entire screen if no parent)
width Width of widget.
height Height of widget.

void Gewi::GWidget::Move float  x,
float  y
[virtual]
 

Set new relative position for widget.

Parameters:
x New relative x position.
y New relative y position.

Reimplemented in Gewi::GContainer.

virtual void Gewi::GWidget::Message SDL_Event *  rawEvent,
GewiEvent  event,
Uint16  mouseX,
Uint16  mouseY,
char  ch
[pure virtual]
 

Recieves and processes a message, required overload for all widgets.

Parameters:
rawEvent SDL_Event of original message, may be needed if more information is available on event. (May be NULL).
event GewiEvent enum, description of event recieved.
mouseX Mouse x position in event, if not mouse event may be incorrect.
mouseY Mouse y position in event, if not mouse event may be incorrect.
ch Character pressed in event, may be 0 if not a keypress event.

Implemented in Gewi::GButton, Gewi::GContainer, Gewi::GHorizSlider, Gewi::GVertSlider, Gewi::GStaticText, Gewi::GTextField, and Gewi::GWindow.

virtual void Gewi::GWidget::Show  )  [pure virtual]
 

Draws widget to the screen, required overload for all widgets.

Implemented in Gewi::GButton, Gewi::GContainer, Gewi::GHorizSlider, Gewi::GVertSlider, Gewi::GStaticText, Gewi::GTextButton, Gewi::GTextField, and Gewi::GWindow.

float Gewi::GWidget::X  ) 
 

Get actual (not relative) X position of top left corner of widget.

Returns:
Actual x position of widget.

float Gewi::GWidget::Y  ) 
 

Get actual (not relative) Y position of top left corner of widget.

Returns:
Actual y position of widget.

bool Gewi::GWidget::Visible  ) 
 

Returns status of internal visible flag.

Returns:
true if visible, false otherwise.

bool Gewi::GWidget::MouseInWidget  ) 
 

Returns status of mouse inside widget.

Returns:
true if mouse pointer inside widget, false otherwise.

bool Gewi::GWidget::Contains Sint16  x,
Sint16  y
 

Check if the widget contains the point specified.

Parameters:
x X value of point to check.
y Y value of point to check.


The documentation for this class was generated from the following files:
Generated on Fri Aug 1 17:17:30 2003 for Gewi by doxygen1.3