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

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 std::string &filename, PG_Draw::BkMode drawmode=PG_Draw::TILE, const std::string &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, PG_Draw::BkMode drawmode=PG_Draw::TILE, const std::string &style="ThemeWidget")
 Contructor of the PG_Image class (image from surface).
 PG_Image (PG_Widget *parent, const PG_Point &p, const std::string &filename, Uint32 colorkey, PG_Draw::BkMode drawmode=PG_Draw::TILE, const std::string &style="ThemeWidget")
 Contructor of the PG_Image class (loading from file).
void SetColorKey (const PG_Color &key)
 Set the colorkey of the image.
void SetDrawMode (PG_Draw::BkMode mode)
 @ Set mode of drawing (BKMODE_TILE | BKMODE_STRETCH | BKMODE_3TILEH | BKMODE_3TILEV | BKMODE_9TILE)
Uint8 GetDrawMode ()
bool LoadImage (const std::string &filename)
 Display an image in the widget.
bool LoadImage (const std::string &filename, const PG_Color &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

SDL_Surface * my_cachedSrf
PG_Draw::BkMode my_DrawMode


Constructor & Destructor Documentation

PG_Image::PG_Image PG_Widget parent,
const PG_Point p,
const std::string &  filename,
PG_Draw::BkMode  drawmode = PG_Draw::TILE,
const std::string &  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
drawmode Image drawmode (see PG_Draw::BkMode)
style widgetstyle to use

PG_Image::PG_Image PG_Widget parent,
const PG_Point p,
SDL_Surface *  image,
bool  freeimage = true,
PG_Draw::BkMode  drawmode = PG_Draw::TILE,
const std::string &  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
drawmode Image drawmode (see PG_Draw::BkMode)
style widgetstyle to use

PG_Image::PG_Image PG_Widget parent,
const PG_Point p,
const std::string &  filename,
Uint32  colorkey,
PG_Draw::BkMode  drawmode = PG_Draw::TILE,
const std::string &  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)
drawmode Image drawmode (see PG_Draw::BkMode)
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 std::string &  filename,
const PG_Color 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 std::string &  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 const PG_Color key  ) 
 

Set the colorkey of the image.

Parameters:
key colorkey (0xRRGGBB);

void PG_Image::SetDrawMode PG_Draw::BkMode  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]
 

PG_Draw::BkMode PG_Image::my_DrawMode [protected]
 


Generated on Tue Jun 24 02:25:41 2008 for ParaGUI by  doxygen 1.4.2