Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

SDLWidget Class Reference

Base class of all widgets. More...

#include <sdlwidget.h>

Inheritance diagram for SDLWidget

Inheritance graph
[legend]
Collaboration diagram for SDLWidget:

Collaboration graph
[legend]
List of all members.

Public Methods

 SDLWidget (SDLWidget* parent, SDL_Rect& rect, bool storeBackground = false)
 Creates a SDLWidget. More...

 ~SDLWidget ()
 Destroys a SDLWidget. More...

virtual void LoadThemeStyle (const char* widgettype)
 Load a style from the theme definition. More...

virtual void LoadThemeStyle (const char* widgettype, const char* objectname)
 Load a style from the theme definition. More...

void StartWidgetDrag ()
 Start to drag a widget. More...

void WidgetDrag (int x, int y)
void EndWidgetDrag (int x, int y)
bool MoveWindow (int x, int y)
 Move a widget. More...

bool SizeWindow (int w, int h)
 Resize a widget. More...

SDL_Point ClientToScreen (int sx, int sy)
SDL_Point ScreenToClient (int x, int y)
int Width ()
int Height ()
SDL_Surface* GetWidgetSurface ()
SDL_Rect GetWidgetRect ()
SDL_Surface* GetScreenSurface ()
SDLWidget* GetParent ()
 Get the parentwidget of a widget. More...

void AddChild (SDLWidget* child)
bool ProcessEvent (const SDL_Event* event)
 Process a native SDL event. More...

void SetID (int id)
int GetID ()
bool IsInside (SDL_Point p, SDL_Rect* r = NULL)
bool IsMouseInside ()
bool IsDisplayRectValid ()
bool Redraw (bool update = true)
 Redraw the surface of the widget. More...

void Hide (bool fade = false)
void Show (bool fade = false)
void Update (bool doBlit = true)
 Update the widgets screen area. More...

void Blit (bool recursive = true)
void SetChildTransparency (Uint8 t)
int GetChildCount ()
 Get the number of childwidgets. More...

void SetFont (TTF_Font* newfont)
 Set the font. More...

TTF_Font* GetFont ()
 Returns the current font. More...

void SetScreenUpdate (bool update)
 OBSOLETE. More...

void MoveRect (int x, int y)
void RecalcClipRect ()
void SetTextColor (Uint32 color)
void SetTextColor (SDL_Color c)
SDL_Color GetTextColor ()

Static Public Methods

SDL_Rect& mkrect (int x, int y, int w, int h)
void BulkUpdate ()

Protected Methods

virtual void eventMouseLeave ()
virtual void eventMouseEnter ()
virtual void eventShow ()
virtual void eventHide ()
bool AcceptEvent (const SDL_Event* event)
 Overridable message filter function. More...

void RemoveChild (SDLWidget* child)

Protected Attributes

bool bSetCaptureOnShow
SDLWidget* my_widgetListNext
SDLWidget* my_widgetListPrev

Static Protected Attributes

SDLWidget* widgetList

Detailed Description

Base class of all widgets.

Author(s):
Alexander Pipelka

Provides graphics context and message handling functionality.

Examples:

tut4.cpp.

Definition at line 51 of file sdlwidget.h.


Constructor & Destructor Documentation

SDLWidget::SDLWidget ( SDLWidget * parent,
SDL_Rect & rect,
bool storeBackground = false )
 

Creates a SDLWidget.

Parameters:
parent   the parentobject for the new widget or NULL if it is a toplevel widget
rect   initial position for the widget
storebackground   flag for backing store

This is the constructor for the SDLWidget class (really!)

SDLWidget::~SDLWidget ( )
 

Destroys a SDLWidget.

This is the destructor for the SDLWidget class


Member Function Documentation

bool SDLWidget::AcceptEvent ( const SDL_Event * event ) [protected, virtual]
 

Overridable message filter function.

Derivated classes can filter special events. The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
event   SDL_Event message

Returns:
Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.

Reimplemented from SDLMessageObject.

void SDLWidget::AddChild ( SDLWidget * child )
 

void SDLWidget::Blit ( bool recursive = true )
 

void SDLWidget::BulkUpdate ( ) [static]
 

SDL_Point SDLWidget::ClientToScreen ( int sx,
int sy )
 

void SDLWidget::EndWidgetDrag ( int x,
int y )
 

int SDLWidget::GetChildCount ( )
 

Get the number of childwidgets.

Returns:
number of childwidgets

TTF_Font * SDLWidget::GetFont ( )
 

Returns the current font.

int SDLWidget::GetID ( )
 

SDLWidget * SDLWidget::GetParent ( )
 

Get the parentwidget of a widget.

Returns:
a pointer to the parentwidget or NULL if there is no parentwidget

Reimplemented in SDLListBoxBaseItem, and SDLScrollBar::ScrollButton.

SDL_Surface * SDLWidget::GetScreenSurface ( )
 

SDL_Color SDLWidget::GetTextColor ( )
 

SDL_Rect SDLWidget::GetWidgetRect ( )
 

SDL_Surface * SDLWidget::GetWidgetSurface ( )
 

int SDLWidget::Height ( )
 

Reimplemented in SDLListBoxBaseItem.

void SDLWidget::Hide ( bool fade = false )
 

bool SDLWidget::IsDisplayRectValid ( ) [virtual]
 

Reimplemented from SDLDrawObject.

bool SDLWidget::IsInside ( SDL_Point p,
SDL_Rect * r = NULL )
 

bool SDLWidget::IsMouseInside ( )
 

void SDLWidget::LoadThemeStyle ( const char * widgettype,
const char * objectname ) [virtual]
 

Load a style from the theme definition.

Parameters:
widgettype   name of the widgettype
objectname   name of the object

Loads the defined style of a given widgettype and objectname.

Reimplemented in SDLButton, SDLGradientWidget, SDLLineEdit, and SDLListBoxItem.

void SDLWidget::LoadThemeStyle ( const char * widgettype ) [virtual]
 

Load a style from the theme definition.

Parameters:
widgettype   name of the widgettype
objectname   name of the object

Loads the defined style for a given widgettype

Reimplemented in SDLButton, SDLGradientWidget, SDLLineEdit, SDLProgressBar, SDLRadioButton, SDLScrollBar, SDLSlider, and SDLWindow.

void SDLWidget::MoveRect ( int x,
int y )
 

bool SDLWidget::MoveWindow ( int x,
int y ) [virtual]
 

Move a widget.

Parameters:
x   new x-position (in parent context)
y   new y-position (in parent context)
Returns:
function succeeded

This function moves the widget

Reimplemented from SDLDrawObject.

bool SDLWidget::ProcessEvent ( const SDL_Event * event ) [virtual]
 

Process a native SDL event.

Parameters:
event   SDL event to process
Returns:
true if the event was sucessfully processed

ProcessEvent asks the widget to process a given event.

Reimplemented from SDLMessageObject.

void SDLWidget::RecalcClipRect ( )
 

bool SDLWidget::Redraw ( bool update = true ) [virtual]
 

Redraw the surface of the widget.

Parameters:
update   if true SDLDrawObject::Update(true) is called after the redraw
Returns:
redraw succeeded

Reimplemented from SDLDrawObject.

void SDLWidget::RemoveChild ( SDLWidget * child ) [protected]
 

SDL_Point SDLWidget::ScreenToClient ( int x,
int y )
 

void SDLWidget::SetChildTransparency ( Uint8 t )
 

void SDLWidget::SetFont ( TTF_Font * newfont )
 

Set the font.

Parameters:
newfont   the widget's new font

This function sets the font of the widget

void SDLWidget::SetID ( int id )
 

void SDLWidget::SetScreenUpdate ( bool update ) [virtual]
 

OBSOLETE.

Reimplemented from SDLDrawObject.

void SDLWidget::SetTextColor ( SDL_Color c )
 

void SDLWidget::SetTextColor ( Uint32 color )
 

void SDLWidget::Show ( bool fade = false )
 

Examples:
tut2.cpp, tut3.cpp, and tut4.cpp.

bool SDLWidget::SizeWindow ( int w,
int h ) [virtual]
 

Resize a widget.

Parameters:
w   new widget-width
w   new widget-height
Returns:
function succeeded

This function resizes the widget

Reimplemented from SDLDrawObject.

void SDLWidget::StartWidgetDrag ( )
 

Start to drag a widget.

StartWidgetDrag prepares to widget to be dragged.

void SDLWidget::Update ( bool doBlit = true ) [virtual]
 

Update the widgets screen area.

Parameters:
doBlit   if true SDLDrawObject::Blit() is called before the update

Reimplemented from SDLDrawObject.

void SDLWidget::WidgetDrag ( int x,
int y )
 

int SDLWidget::Width ( )
 

void SDLWidget::eventHide ( ) [protected, virtual]
 

void SDLWidget::eventMouseEnter ( ) [protected, virtual]
 

Reimplemented in SDLUserButton, SDLListBoxBaseItem, and SDLRadioButton.

void SDLWidget::eventMouseLeave ( ) [protected, virtual]
 

Reimplemented in SDLUserButton, SDLListBoxBaseItem, and SDLRadioButton.

void SDLWidget::eventShow ( ) [protected, virtual]
 

Reimplemented in SDLWidgetList.

SDL_Rect & SDLWidget::mkrect ( int x,
int y,
int w,
int h ) [static]
 


Member Data Documentation

bool SDLWidget::bSetCaptureOnShow [protected]
 

Definition at line 270 of file sdlwidget.h.

SDLWidget * SDLWidget::my_widgetListNext [protected]
 

Definition at line 273 of file sdlwidget.h.

SDLWidget * SDLWidget::my_widgetListPrev [protected]
 

Definition at line 274 of file sdlwidget.h.

SDLWidget * SDLWidget::widgetList [static, protected]
 

Definition at line 272 of file sdlwidget.h.


The documentation for this class was generated from the following file: