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

PG_Label Class Reference

Inheritance diagram for PG_Label:

Inheritance graph
[legend]
Collaboration diagram for PG_Label:

Collaboration graph
[legend]
List of all members.

Detailed Description

Text label.

Author:
Alexander Pipelka

A text label (unmodifiable by end user). Has attributes for font style, alignment, etc.

Examples:

dblbuffer.cpp, paratest.cpp, and sigc.cpp.


Public Types

enum  TextAlign { LEFT, CENTER, RIGHT }

Public Member Functions

 PG_Label (PG_Widget *parent, const PG_Rect &r=PG_Rect::null, const char *text=NULL, const char *style="Label")
 Only constructor.

 ~PG_Label ()
 Only destructor.

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

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

void SetAlignment (TextAlign a)
 Sets text alignment.

SDL_Surface * SetIcon (const char *filename)
SDL_Surface * SetIcon (SDL_Surface *icon)
SDL_Surface * GetIcon ()
void SetIndent (Uint16 indent)
 Set the text indentation.

Uint16 GetIndent ()
 Returns the text indentation.


Protected Member Functions

void eventDraw (SDL_Surface *surface, const PG_Rect &rect)
 Draw event handler.

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_srfIcon


Member Enumeration Documentation

enum PG_Label::TextAlign
 

Enumeration values:
LEFT 
CENTER 
RIGHT 


Constructor & Destructor Documentation

PG_Label::PG_Label PG_Widget parent,
const PG_Rect r = PG_Rect::null,
const char *  text = NULL,
const char *  style = "Label"
 

Only constructor.

Parameters:
parent Parent widget.
r Rectangle to draw in, relative to parent.
text Text displayed by label.
style initial widget style (from xml theme)

PG_Label::~PG_Label  ) 
 

Only destructor.


Member Function Documentation

void PG_Label::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_Widget.

Reimplemented in PG_ColumnItem, and PG_ListBoxItem.

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

Draw event handler.

Parameters:
surface Surface to draw to.
rect Rectangle to draw in, relative to surface.

Reimplemented from PG_Widget.

SDL_Surface* PG_Label::GetIcon  ) 
 

Uint16 PG_Label::GetIndent  ) 
 

Returns the text indentation.

void PG_Label::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 from PG_Widget.

Reimplemented in PG_ListBoxItem.

void PG_Label::LoadThemeStyle const char *  widgettype  ) 
 

Load a style from the theme definition.

Parameters:
widgettype name of the widgettype
Loads the defined style for a given widgettype

Reimplemented from PG_Widget.

void PG_Label::SetAlignment TextAlign  a  ) 
 

Sets text alignment.

Examples:
paratest.cpp.

SDL_Surface* PG_Label::SetIcon SDL_Surface *  icon  ) 
 

SDL_Surface* PG_Label::SetIcon const char *  filename  ) 
 

void PG_Label::SetIndent Uint16  indent  ) 
 

Set the text indentation.

Parameters:
indent number of pixels for text indentation


Member Data Documentation

SDL_Surface* PG_Label::my_srfIcon [protected]
 



The ParaGUI Project - Alexander Pipelka