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

SDLDrawObject Class Reference

Base class of all objects (provides drawing functionality). More...

#include <sdldrawobject.h>

Inheritance diagram for SDLDrawObject

Inheritance graph
[legend]
Collaboration diagram for SDLDrawObject:

Collaboration graph
[legend]
List of all members.

Public Methods

 SDLDrawObject (int id, SDL_Rect& rect, bool visible, bool storeBackground, SDLDrawObject* objParent = NULL)
virtual ~SDLDrawObject ()
virtual bool Redraw (bool update = true)
 Redraw the surface of the widget. More...

virtual void Update (bool doBlit = true)
 Update the widgets screen area. More...

virtual void Blit ()
 Blit the surface of the object to the screen surface. More...

virtual bool MoveWindow (int x, int y)
 Move the object to a given screen-coordinate. More...

virtual bool SizeWindow (int w, int h)
 Resize the object. More...

bool SetVisible (bool visible)
 Make an object visible. More...

bool IsVisible ()
 Check if the object is visible. More...

void SetTransparency (Uint8 t)
Uint8 GetTransparency ()
bool RestoreBackground ()
bool StoreBackground ()
void SetStoreBackground (bool store)
bool GetStoreBackground ()
virtual void SetScreenUpdate (bool update)
bool GetScreenUpdate ()
void FadeOut ()
void FadeIn ()
void DrawHLine (int x, int y, int w, Uint8 r, Uint8 g, Uint8 b, SDL_Surface* surface)
void DrawVLine (int x, int y, int h, Uint8 r, Uint8 g, Uint8 b, SDL_Surface* surface)
void DrawRectWH (int x, int y, int w, int h, Uint8 r, Uint8 g, Uint8 b, SDL_Surface* surface)
void DrawBorder (SDL_Surface* surface, SDL_Rect* r, int size, bool up = true)
void DrawText (int x, int y, char* text, SDL_Color c, TTF_Font* textfont = NULL)
void DrawText (SDL_Rect* r, char* text, SDL_Color c, int align = SDL_TA_LEFT, TTF_Font* textfont = NULL)
void SetClipRect (int x, int y, int w, int h)
bool IsClippingEnabled ()
void GetClipRects (SDL_Rect& src, SDL_Rect& dst, SDL_Rect* displayrect = NULL)
SDL_Rect GetClipRect ()
virtual bool IsDisplayRectValid ()
void SetParent (SDLDrawObject* objParent)

Static Public Methods

void SetPixel (int x, int y, Uint8 r, Uint8 g, Uint8 b, SDL_Surface* surface)
SDL_Surface* CreateGradient (SDL_Rect& r, SDL_Gradient& gradient)
 Creates a surface filled with a gradient. More...

SDL_Surface* CreateGradient (SDL_Rect& r, SDL_Color& ul, SDL_Color& ur, SDL_Color& dl, SDL_Color& dr)
 Creates a surface filled with a gradient. More...

void DrawGradient (SDL_Surface* surface, SDL_Rect& r, SDL_Color& ul, SDL_Color& ur, SDL_Color& dl, SDL_Color& dr)
void DrawGradient (SDL_Surface* surface, SDL_Rect& r, SDL_Gradient& gradient)
void DrawThemedSurface (SDL_Surface* surface, SDL_Rect* r, SDL_Gradient* gradient, SDL_Surface* background, int bkmode, Uint8 blend)
 Draw a 'themed' surface. More...

SDL_Surface* CreateThemedSurface (SDL_Rect& r, SDL_Gradient* gradient, SDL_Surface* background, int bkmode, Uint8 blend)
 Create a 'themed' surface. More...

SDL_Rect IntersectRect (SDL_Rect p, SDL_Rect c)

Protected Methods

SDL_Surface* CreateSubSurface (SDL_Surface* surface, SDL_Rect* r)
virtual void eventDraw (SDL_Surface* surface, SDL_Rect* rect)
virtual void eventBlit (SDL_Surface* srf, SDL_Rect* src, SDL_Rect* dst)
virtual void eventSizeWindow (int w, int h)
virtual void eventMoveWindow (int x, int y)

Protected Attributes

int my_id
SDL_Rect my_rectDisplay
SDL_Rect my_rectClip
bool my_visible
bool my_storeBackground
Uint8 my_transparency
SDL_Surface* my_srfBackground
SDL_Surface* my_srfObject
SDL_Surface* my_srfScreen
SDL_Surface* my_srfDrag
SDLDrawObject* my_objParent
SDL_Point my_ptDragStart

Detailed Description

Base class of all objects (provides drawing functionality).

Author(s):
Alexander Pipelka

Provides a graphics context and basic drawing functionality.

Definition at line 50 of file sdldrawobject.h.


Constructor & Destructor Documentation

SDLDrawObject::SDLDrawObject ( int id,
SDL_Rect & rect,
bool visible,
bool storeBackground,
SDLDrawObject * objParent = NULL )
 

SDLDrawObject::~SDLDrawObject ( ) [virtual]
 


Member Function Documentation

void SDLDrawObject::Blit ( ) [virtual]
 

Blit the surface of the object to the screen surface.

SDL_Surface * SDLDrawObject::CreateGradient ( SDL_Rect & r,
SDL_Color & ul,
SDL_Color & ur,
SDL_Color & dl,
SDL_Color & dr ) [static]
 

Creates a surface filled with a gradient.

Parameters:
r   the dimensions of the surface to be created
ul   upper/left gradient color
ur   upper/right gradient color
dl   lower/left gradient color
dr   lower/right gradient color
Returns:
a SDL_Surface pointer to the new surface

This function creates a new surface filled with a given gradient defined by a set of colors

SDL_Surface * SDLDrawObject::CreateGradient ( SDL_Rect & r,
SDL_Gradient & gradient ) [static]
 

Creates a surface filled with a gradient.

Parameters:
r   the dimensions of the surface to be created
gradient   the gradient definition
Returns:
a SDL_Surface pointer to the new surface

This function creates a new surface filled with a given gradient

SDL_Surface * SDLDrawObject::CreateSubSurface ( SDL_Surface * surface,
SDL_Rect * r ) [protected]
 

SDL_Surface * SDLDrawObject::CreateThemedSurface ( SDL_Rect & r,
SDL_Gradient * gradient,
SDL_Surface * background,
int bkmode,
Uint8 blend ) [static]
 

Create a 'themed' surface.

Parameters:
r   the dimensions of the surface to create
gradient   pointer to a gradient structure (may be NULL)
background   pointer to a background surface (may be NULL)
bkmode   the mode how to fill in the background surface (BKMODE_TILE | BKMODE_STRETCH)
blend   the blend-level between gradient an background
Returns:
the newly created surface

void SDLDrawObject::DrawBorder ( SDL_Surface * surface,
SDL_Rect * r,
int size,
bool up = true )
 

void SDLDrawObject::DrawGradient ( SDL_Surface * surface,
SDL_Rect & r,
SDL_Gradient & gradient ) [static]
 

void SDLDrawObject::DrawGradient ( SDL_Surface * surface,
SDL_Rect & r,
SDL_Color & ul,
SDL_Color & ur,
SDL_Color & dl,
SDL_Color & dr ) [static]
 

void SDLDrawObject::DrawHLine ( int x,
int y,
int w,
Uint8 r,
Uint8 g,
Uint8 b,
SDL_Surface * surface )
 

void SDLDrawObject::DrawRectWH ( int x,
int y,
int w,
int h,
Uint8 r,
Uint8 g,
Uint8 b,
SDL_Surface * surface )
 

void SDLDrawObject::DrawText ( SDL_Rect * r,
char * text,
SDL_Color c,
int align = SDL_TA_LEFT,
TTF_Font * textfont = NULL )
 

void SDLDrawObject::DrawText ( int x,
int y,
char * text,
SDL_Color c,
TTF_Font * textfont = NULL )
 

void SDLDrawObject::DrawThemedSurface ( SDL_Surface * surface,
SDL_Rect * r,
SDL_Gradient * gradient,
SDL_Surface * background,
int bkmode,
Uint8 blend ) [static]
 

Draw a 'themed' surface.

Parameters:
surface   the surface to draw on
r   the rectangle of the surface to draw in
gradient   pointer to a gradient structure (may be NULL)
background   pointer to a background surface (may be NULL)
bkmode   the mode how to fill in the background surface (BKMODE_TILE | BKMODE_STRETCH)
blend   the blend-level between gradient an background

void SDLDrawObject::DrawVLine ( int x,
int y,
int h,
Uint8 r,
Uint8 g,
Uint8 b,
SDL_Surface * surface )
 

void SDLDrawObject::FadeIn ( )
 

void SDLDrawObject::FadeOut ( )
 

SDL_Rect SDLDrawObject::GetClipRect ( )
 

void SDLDrawObject::GetClipRects ( SDL_Rect & src,
SDL_Rect & dst,
SDL_Rect * displayrect = NULL )
 

bool SDLDrawObject::GetScreenUpdate ( )
 

bool SDLDrawObject::GetStoreBackground ( )
 

Uint8 SDLDrawObject::GetTransparency ( )
 

SDL_Rect SDLDrawObject::IntersectRect ( SDL_Rect p,
SDL_Rect c ) [static]
 

bool SDLDrawObject::IsClippingEnabled ( )
 

bool SDLDrawObject::IsDisplayRectValid ( ) [virtual]
 

Reimplemented in SDLWidget.

bool SDLDrawObject::IsVisible ( )
 

Check if the object is visible.

Returns:
true if object is visible

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

Move the object to a given screen-coordinate.

Parameters:
x   screen x-position
y   screen y-position
Returns:
move succeeded

Reimplemented in SDLWidget.

bool SDLDrawObject::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 in SDLWidget.

bool SDLDrawObject::RestoreBackground ( )
 

void SDLDrawObject::SetClipRect ( int x,
int y,
int w,
int h )
 

void SDLDrawObject::SetParent ( SDLDrawObject * objParent )
 

void SDLDrawObject::SetPixel ( int x,
int y,
Uint8 r,
Uint8 g,
Uint8 b,
SDL_Surface * surface ) [static]
 

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

Reimplemented in SDLWidget.

void SDLDrawObject::SetStoreBackground ( bool store )
 

void SDLDrawObject::SetTransparency ( Uint8 t )
 

bool SDLDrawObject::SetVisible ( bool visible )
 

Make an object visible.

Parameters:
visible   show / hide the object
Returns:
success

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

Resize the object.

Parameters:
w   new width in pixels
h   new height in pixels
Returns:
resize succeeded

Reimplemented in SDLWidget.

bool SDLDrawObject::StoreBackground ( )
 

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

Update the widgets screen area.

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

Reimplemented in SDLWidget.

void SDLDrawObject::eventBlit ( SDL_Surface * srf,
SDL_Rect * src,
SDL_Rect * dst ) [protected, virtual]
 

Reimplemented in SDLColumnItem, SDLLabel, and SDLListBoxItem.

void SDLDrawObject::eventDraw ( SDL_Surface * surface,
SDL_Rect * rect ) [protected, virtual]
 

Reimplemented in SDLUserButton, SDLColumnItem, SDLGradientWidget, SDLLabel, SDLLineEdit, SDLProgressBar, and SDLWindow.

void SDLDrawObject::eventMoveWindow ( int x,
int y ) [protected, virtual]
 

void SDLDrawObject::eventSizeWindow ( int w,
int h ) [protected, virtual]
 

Reimplemented in SDLUserButton, SDLScrollBar, SDLWidgetList, and SDLWindow.


Member Data Documentation

int SDLDrawObject::my_id [protected]
 

Definition at line 275 of file sdldrawobject.h.

SDLDrawObject * SDLDrawObject::my_objParent [protected]
 

Definition at line 290 of file sdldrawobject.h.

SDL_Point SDLDrawObject::my_ptDragStart [protected]
 

Definition at line 291 of file sdldrawobject.h.

SDL_Rect SDLDrawObject::my_rectClip [protected]
 

Definition at line 278 of file sdldrawobject.h.

SDL_Rect SDLDrawObject::my_rectDisplay [protected]
 

Definition at line 277 of file sdldrawobject.h.

SDL_Surface * SDLDrawObject::my_srfBackground [protected]
 

Definition at line 285 of file sdldrawobject.h.

SDL_Surface * SDLDrawObject::my_srfDrag [protected]
 

Definition at line 288 of file sdldrawobject.h.

SDL_Surface * SDLDrawObject::my_srfObject [protected]
 

Definition at line 286 of file sdldrawobject.h.

SDL_Surface * SDLDrawObject::my_srfScreen [protected]
 

Definition at line 287 of file sdldrawobject.h.

bool SDLDrawObject::my_storeBackground [protected]
 

Definition at line 281 of file sdldrawobject.h.

Uint8 SDLDrawObject::my_transparency [protected]
 

Definition at line 283 of file sdldrawobject.h.

bool SDLDrawObject::my_visible [protected]
 

Definition at line 280 of file sdldrawobject.h.


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