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

PG_RichEdit Class Reference

A optionay editable rich text flowing around child widgets. More...

#include <pgrichedit.h>

Inheritance diagram for PG_RichEdit:

Inheritance graph
[legend]
List of all members.

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 std::string &style="WidgetList")
 Constructor of the PG_WidgetListEx class.
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 std::string &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

Classes

struct  RichLine
struct  RichLinePart
struct  RichWordDescription

Detailed Description

A optionay editable rich text flowing around child widgets.

Author:
Jaroslav Vozab
Generally used to make a large 'pane' of widgets and rich text that can be scrolled through in a smaller 'portal' with scrollbars.

Definition at line 47 of file pgrichedit.h.


Member Typedef Documentation

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

Definition at line 165 of file pgrichedit.h.

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

Definition at line 153 of file pgrichedit.h.

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

Definition at line 125 of file pgrichedit.h.

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

Definition at line 129 of file pgrichedit.h.


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 

Definition at line 213 of file pgrichedit.h.


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 std::string &  style = "WidgetList"
 

Constructor of the PG_WidgetListEx class.

Definition at line 40 of file pgrichedit.cpp.

References PG_ScrollWidget::EnableScrollBar(), PG_ScrollBar::HORIZONTAL, my_AutoHorizontalResize, my_AutoVerticalResize, my_ChildsBorderWidth, my_LineWidth, PG_ScrollWidget::my_objHorizontalScrollbar, PG_ScrollWidget::my_objVerticalScrollbar, PG_ScrollWidget::my_scrollarea, my_TabSize, PG_Rect::my_width, PG_TEXT_LEFT, PG_ScrollArea::SetAreaWidth(), PG_ScrollBar::SetLineSize(), PG_ScrollBar::sigScrollPos, and PG_ScrollBar::sigScrollTrack.


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.

Definition at line 110 of file pgrichedit.cpp.

References PG_ScrollWidget::AddChild().

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.

Definition at line 79 of file pgrichedit.cpp.

References PG_ThemeWidget::eventBlit(), PG_Widget::GetFont(), PG_Application::GetScreen(), PG_ScrollArea::GetScrollPosX(), PG_ScrollArea::GetScrollPosY(), PG_Rect::Height(), PG_Widget::IsVisible(), line(), PG_ScrollWidget::my_objHorizontalScrollbar, PG_ScrollWidget::my_objVerticalScrollbar, my_ParsedWords, my_RichText, PG_ScrollWidget::my_scrollarea, PG_Rect::my_xpos, PG_Rect::my_ypos, and PG_FontEngine::RenderText().

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.

Definition at line 685 of file pgrichedit.cpp.

References PG_ScrollWidget::eventSizeWidget(), and SetLineWidth().

bool PG_RichEdit::LoadText const std::string &  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

Definition at line 654 of file pgrichedit.cpp.

References PG_DataContainer::data(), PG_FileArchive::ReadFile(), SetText(), and PG_DataContainer::size().

bool PG_RichEdit::RemoveChild PG_Widget child  )  [virtual]
 

Remove a widget from the list.

Parameters:
child pointer to a widget

Reimplemented from PG_Widget.

Definition at line 115 of file pgrichedit.cpp.

References PG_Widget::RemoveChild().

void PG_RichEdit::SetAlignment Uint8  align  ) 
 

Set default alignment.

Definition at line 62 of file pgrichedit.cpp.

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

Resize the widget automatically if there is not enough space.

Parameters:
bHorizontal resize horizontally
bVertical resize vertically

Reimplemented from PG_ScrollWidget.

Definition at line 66 of file pgrichedit.cpp.

References my_AutoHorizontalResize, and my_AutoVerticalResize.

void PG_RichEdit::SetLineWidth Uint16  lineWidth  ) 
 

Set line width.

Definition at line 680 of file pgrichedit.cpp.

References PG_Widget::GetText(), my_LineWidth, and SetText().

Referenced by eventSizeWidget().

void PG_RichEdit::SetTabSize Uint16  tabSize  ) 
 

Set tab size.

Definition at line 671 of file pgrichedit.cpp.

References my_TabSize.

void PG_RichEdit::SetText const std::string &  text  )  [virtual]
 

Sets rich text.

Parameters:
text rich text to set

Reimplemented from PG_Widget.

Definition at line 121 of file pgrichedit.cpp.

References my_LineWidth, PG_ScrollWidget::my_scrollarea, PG_Widget::my_text, PG_ScrollArea::SetAreaHeight(), and PG_ScrollArea::SetAreaWidth().

Referenced by IngameMessageViewer::IngameMessageViewer(), LoadText(), and SetLineWidth().


Member Data Documentation

bool PG_RichEdit::my_AutoHorizontalResize [protected]
 

Definition at line 112 of file pgrichedit.h.

Referenced by PG_RichEdit(), and SetAutoResize().

bool PG_RichEdit::my_AutoVerticalResize [protected]
 

Definition at line 111 of file pgrichedit.h.

Referenced by PG_RichEdit(), and SetAutoResize().

Uint32 PG_RichEdit::my_ChildsBorderWidth [protected]
 

Definition at line 169 of file pgrichedit.h.

Referenced by PG_RichEdit().

Uint16 PG_RichEdit::my_LineWidth [protected]
 

Definition at line 172 of file pgrichedit.h.

Referenced by PG_RichEdit(), SetLineWidth(), and SetText().

RichWordDescriptionArray PG_RichEdit::my_ParsedWords [protected]
 

Definition at line 127 of file pgrichedit.h.

Referenced by eventBlit().

RichLineArray PG_RichEdit::my_RichText [protected]
 

Definition at line 167 of file pgrichedit.h.

Referenced by eventBlit().

Uint16 PG_RichEdit::my_TabSize [protected]
 

Definition at line 171 of file pgrichedit.h.

Referenced by PG_RichEdit(), and SetTabSize().


The documentation for this class was generated from the following files:
Generated on Tue Jun 24 02:19:22 2008 for Advanced Strategic Command by  doxygen 1.4.2