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

PG_RichEdit Class Reference

Inheritance diagram for PG_RichEdit:

Inheritance graph
[legend]
Collaboration diagram for PG_RichEdit:

Collaboration graph
[legend]
List of all members.

Detailed Description

A optionay editable rich text flowing around child widgets. Generally used to make a large 'pane' of widgets and rich text that can be scrolled through in a smaller 'portal' with scrollbars.

Author:
Jaroslav Vozab


Public Types

enum  {
  PG_TEXT_LEFT = MARK_TEXT_LEFT, PG_TEXT_CENTER = MARK_TEXT_CENTER, PG_TEXT_RIGHT = MARK_TEXT_RIGHT, PG_TEXT_BLOCK = MARK_TEXT_BLOCK,
  PG_ALL_LEFT = MARK_ALL_LEFT, PG_ALL_CENTER = MARK_ALL_CENTER, PG_ALL_RIGHT = MARK_ALL_RIGHT
}

Public Member Functions

 PG_RichEdit (PG_Widget *parent, const PG_Rect &r=PG_Rect::null, bool autoVerticalResize=false, Uint32 linewidth=0, Uint32 tabSize=30, Uint32 childsborderwidth=8, const char *style="WidgetList")
 Constructor of the PG_WidgetListEx class.

void SetText (const char *text)
 Sets rich text.

void SetText (const std::string &text)
 Sets rich text.

void AddChild (PG_Widget *child)
 Add a widget to the list.

bool RemoveChild (PG_Widget *child)
 Remove a widget from the list.

bool LoadText (const char *textfile)
 Load the content of the widget from a text file.

void SetAutoResize (bool bHorizontal=true, bool bVertical=true)
 Resize the widget automatically if there is not enough space.

void SetAlignment (Uint8 align)
 Set default alignment.

void SetTabSize (Uint16 tabSize)
 Set tab size.

void SetLineWidth (Uint16 lineWidth)
 Set line width.


Protected Types

typedef std::vector< RichWordDescriptionRichWordDescriptionArray
typedef std::vector< size_t > Size_tArray
typedef std::vector< RichLinePartRichLinePartArray
typedef std::vector< RichLineRichLineArray

Protected Member Functions

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

void eventSizeWidget (Uint16 w, Uint16 h)
 Callback for the SizeWidget event.


Protected Attributes

bool my_AutoVerticalResize
bool my_AutoHorizontalResize
RichWordDescriptionArray my_ParsedWords
RichLineArray my_RichText
Uint32 my_ChildsBorderWidth
Uint16 my_TabSize
Uint16 my_LineWidth


Member Typedef Documentation

typedef std::vector<RichLine> PG_RichEdit::RichLineArray [protected]
 

typedef std::vector<RichLinePart> PG_RichEdit::RichLinePartArray [protected]
 

typedef std::vector<RichWordDescription> PG_RichEdit::RichWordDescriptionArray [protected]
 

typedef std::vector<size_t> PG_RichEdit::Size_tArray [protected]
 


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
PG_TEXT_LEFT 
PG_TEXT_CENTER 
PG_TEXT_RIGHT 
PG_TEXT_BLOCK 
PG_ALL_LEFT 
PG_ALL_CENTER 
PG_ALL_RIGHT 


Constructor & Destructor Documentation

PG_RichEdit::PG_RichEdit PG_Widget parent,
const PG_Rect r = PG_Rect::null,
bool  autoVerticalResize = false,
Uint32  linewidth = 0,
Uint32  tabSize = 30,
Uint32  childsborderwidth = 8,
const char *  style = "WidgetList"
 

Constructor of the PG_WidgetListEx class.


Member Function Documentation

void PG_RichEdit::AddChild PG_Widget child  )  [virtual]
 

Add a widget to the list.

Parameters:
child pointer to a widget

Reimplemented from PG_ScrollWidget.

void PG_RichEdit::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_RichEdit::eventSizeWidget Uint16  w,
Uint16  h
[protected, virtual]
 

Callback for the SizeWidget event.

Parameters:
w new width
h new height This virtual function can be used to implement custom behavior for SizeWidget events.

Reimplemented from PG_ScrollWidget.

bool PG_RichEdit::LoadText const char *  textfile  ) 
 

Load the content of the widget from a text file.

This function loads the text of the widget from a file. As ever this file operation is done transparently through PhysFS so you can place any text files into your theme and or file archives.

Parameters:
textfile relative path to the text file

bool PG_RichEdit::RemoveChild PG_Widget child  )  [virtual]
 

Remove a widget from the list.

Parameters:
child pointer to a widget

Reimplemented from PG_Widget.

void PG_RichEdit::SetAlignment Uint8  align  ) 
 

Set default alignment.

void PG_RichEdit::SetAutoResize bool  bHorizontal = true,
bool  bVertical = true
 

Resize the widget automatically if there is not enough space.

Parameters:
resize horizontally
resize vertically

Reimplemented from PG_ScrollWidget.

void PG_RichEdit::SetLineWidth Uint16  lineWidth  ) 
 

Set line width.

void PG_RichEdit::SetTabSize Uint16  tabSize  ) 
 

Set tab size.

void PG_RichEdit::SetText const std::string &  text  ) 
 

Sets rich text.

Parameters:
text rich text to set

void PG_RichEdit::SetText const char *  text  )  [virtual]
 

Sets rich text.

Parameters:
text rich text to set

Reimplemented from PG_Widget.


Member Data Documentation

bool PG_RichEdit::my_AutoHorizontalResize [protected]
 

bool PG_RichEdit::my_AutoVerticalResize [protected]
 

Uint32 PG_RichEdit::my_ChildsBorderWidth [protected]
 

Uint16 PG_RichEdit::my_LineWidth [protected]
 

RichWordDescriptionArray PG_RichEdit::my_ParsedWords [protected]
 

RichLineArray PG_RichEdit::my_RichText [protected]
 

Uint16 PG_RichEdit::my_TabSize [protected]
 



The ParaGUI Project - Alexander Pipelka