Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

PG_Image Class Reference

Inheritance diagram for PG_Image:

Inheritance graph
[legend]
Collaboration diagram for PG_Image:

Collaboration graph
[legend]
List of all members.

Detailed Description

A static (non-resizeable by the end user) frame with image.

Author:
Jaroslav Vozab


Public Member Functions

 PG_Image (PG_Widget *parent, const PG_Point &p, const char *filename, Uint8 drawmode=BKMODE_TILE, const char *style="ThemeWidget")
 Contructor of the PG_Image class (loading from file).

 PG_Image (PG_Widget *parent, const PG_Point &p, SDL_Surface *image, bool freeimage=true, Uint8 drawmode=BKMODE_TILE, const char *style="ThemeWidget")
 Contructor of the PG_Image class (image from surface).

 PG_Image (PG_Widget *parent, const PG_Point &p, const char *filename, Uint32 colorkey, Uint8 drawmode=BKMODE_TILE, const char *style="ThemeWidget")
 Contructor of the PG_Image class (loading from file).

void SetColorKey (Uint32 key)
 Set the colorkey of the image.

void SetDrawMode (Uint8 mode)
 @ Set mode of drawing (BKMODE_TILE | BKMODE_STRETCH | BKMODE_3TILEH | BKMODE_3TILEV | BKMODE_9TILE)

Uint8 GetDrawMode ()
bool LoadImage (const char *filename)
 Display an image in the widget.

bool LoadImage (const char *filename, Uint32 key)
 Display an image in the widget using a colorkey.

bool SetImage (SDL_Surface *image, bool bFreeImage=true)
 Display an image in the widget.

 ~PG_Image ()

Protected Member Functions

void eventDraw (SDL_Surface *surface, const PG_Rect &rect)
 overridable eventhandler to draw the object surface

void eventBlit (SDL_Surface *surface, const PG_Rect &src, const PG_Rect &dst)
 overridable eventhandler to blit the widget contents to the screen


Protected Attributes

Uint8 my_DrawMode
SDL_Surface * my_cachedSrf


Constructor & Destructor Documentation

PG_Image::PG_Image PG_Widget parent,
const PG_Point p,
const char *  filename,
Uint8  drawmode = BKMODE_TILE,
const char *  style = "ThemeWidget"
 

Contructor of the PG_Image class (loading from file).

Creates the widget and loads the image from a file

Parameters:
parent pointer to the parent widget or NULL
p position of the PG_Image widget
filename image-file to load
style widgetstyle to use

PG_Image::PG_Image PG_Widget parent,
const PG_Point p,
SDL_Surface *  image,
bool  freeimage = true,
Uint8  drawmode = BKMODE_TILE,
const char *  style = "ThemeWidget"
 

Contructor of the PG_Image class (image from surface).

Creates the widget and loads the image from an SDL_Surface

Parameters:
parent pointer to the parent widget or NULL
p position of the PG_Image widget
image pointer to imagedata (SDL_Surface)
freeimage if true the imagedata is handled by the widget
style widgetstyle to use

PG_Image::PG_Image PG_Widget parent,
const PG_Point p,
const char *  filename,
Uint32  colorkey,
Uint8  drawmode = BKMODE_TILE,
const char *  style = "ThemeWidget"
 

Contructor of the PG_Image class (loading from file).

Creates the widget and loads the image from a file using a colorkey

Parameters:
parent pointer to the parent widget or NULL
p position of the PG_Image widget
filename image-file to load
colorkey colorkey (0xRRGGBB)
style widgetstyle to use

PG_Image::~PG_Image  ) 
 


Member Function Documentation

void PG_Image::eventBlit SDL_Surface *  surface,
const PG_Rect src,
const PG_Rect dst
[protected, virtual]
 

overridable eventhandler to blit the widget contents to the screen

Parameters:
surface pointer to SDL_Surface to be blitted
src source rectangle (client coordinates)
dst destination rectangle (screen coordinates) Override this eventhandler to perform custom blitting behaviour (without drawing onto the widget surface).

Reimplemented from PG_ThemeWidget.

void PG_Image::eventDraw SDL_Surface *  surface,
const PG_Rect rect
[protected, virtual]
 

overridable eventhandler to draw the object surface

Parameters:
surface the widgets drawing surface.
rect rectangle to draw within. This eventhandler is called whenevener the widget contents should be redrawn.
Note:
Only widgets with drawing surfaces (see the constructor) will call this eventhandler.

Reimplemented from PG_ThemeWidget.

Uint8 PG_Image::GetDrawMode  )  [inline]
 

bool PG_Image::LoadImage const char *  filename,
Uint32  key
 

Display an image in the widget using a colorkey.

Parameters:
filename name of the image file to load
key the colorkey (0xRRGGBB)
Returns:
true on success With this function you can define an image with a colorkey to be displayed at the upper left corner of the widget. Image data will be erased when deleting the widget or loading / setting a new image.

Reimplemented from PG_ThemeWidget.

bool PG_Image::LoadImage const char *  filename  ) 
 

Display an image in the widget.

Parameters:
filename name of the image file to load
Returns:
true on success With this function you can define an image to be displayed at the upper left corner of the widget. Image data will be erased when deleting the widget or loading / setting a new image.

Reimplemented from PG_ThemeWidget.

void PG_Image::SetColorKey Uint32  key  ) 
 

Set the colorkey of the image.

Parameters:
key colorkey (0xRRGGBB);

void PG_Image::SetDrawMode Uint8  mode  ) 
 

@ Set mode of drawing (BKMODE_TILE | BKMODE_STRETCH | BKMODE_3TILEH | BKMODE_3TILEV | BKMODE_9TILE)

bool PG_Image::SetImage SDL_Surface *  image,
bool  bFreeImage = true
 

Display an image in the widget.

Parameters:
image pointer to surface to display
bFreeImage true if the image should be freed by the widget (default = true)
Returns:
true on success With this function you can define an image to be displayed at the upper left corner of the widget.

Reimplemented from PG_ThemeWidget.


Member Data Documentation

SDL_Surface* PG_Image::my_cachedSrf [protected]
 

Uint8 PG_Image::my_DrawMode [protected]
 



The ParaGUI Project - Alexander Pipelka