wGui::CRenderedString Class Reference

#include <wg_renderedstring.h>

Public Types

Public Member Functions

Protected Attributes


Detailed Description

For drawing a string to the screen Optimized for strings that don't often change

Definition at line 48 of file wg_renderedstring.h.


Member Enumeration Documentation

enum wGui::CRenderedString::EVAlign

The vertical alignment of the text.

Enumerator:
VALIGN_NORMAL  Align the text so that the baseline is the bottom.
VALIGN_CENTER  Align the text in the center of the drawing area.
VALIGN_TOP  Align the top of the tallest character with the top of the drawing area.
VALIGN_BOTTOM  Align the bottom of the lowest character with the bottom of the drawing area.

Definition at line 52 of file wg_renderedstring.h.

enum wGui::CRenderedString::EHAlign

The horizontal alignment of the text.

Enumerator:
HALIGN_LEFT  Align the text to the left of the drawing area.
HALIGN_CENTER  Align the text with the center of the drawing area.
HALIGN_RIGHT  Align the text with the right of the drawing area.

Definition at line 61 of file wg_renderedstring.h.


Constructor & Destructor Documentation

wGui::CRenderedString::CRenderedString ( CFontEngine pFontEngine,
const std::wstring &  sString,
EVAlign  eVertAlign = VALIGN_NORMAL,
EHAlign  eHorzAlign = HALIGN_LEFT 
)

Construct a new CRenderedString object

Parameters:
pFontEngine A pointer to a CFontEngine object which is used to render the string
sString The string to render
eVertAlign The vertical alignment
eHorzAlign The horizontal alignment

Definition at line 34 of file wg_renderedstring.cpp.

References m_pFontEngine.


Member Function Documentation

void wGui::CRenderedString::Draw ( SDL_Surface *  pSurface,
const CRect BoundingRect,
const CPoint OriginPoint,
const CRGBColor FontColor = DEFAULT_LINE_COLOR 
) const

Render the string onto the given surface

Parameters:
pSurface A pointer to the surface that will be drawn to
BoundingRect The CRect to clip the rendered string to
OriginPoint The origin of the string
FontColor The color to draw the string in

Definition at line 51 of file wg_renderedstring.cpp.

References wGui::CRGBColor::blue, wGui::CPainter::DrawPoint(), GetMetrics(), wGui::CRGBColor::green, wGui::CRect::HitTest(), m_MaskChar, m_pFontEngine, m_sString, wGui::CPainter::PAINT_NORMAL, wGui::CRGBColor::red, wGui::CRect::RELPOS_INSIDE, and wGui::CFontEngine::RenderGlyph().

void wGui::CRenderedString::GetMetrics ( CPoint pBoundedDimensions = 0,
CPoint pOriginOffset = 0,
std::vector< CRect > *  pCharacterRects = 0 
) const

Get some metrics for the rendered string

Parameters:
pBoundedDimensions A pointer to a CPoint object that will receive the width and height of the rendered string
pOriginOffset A pointer to a CPoint object that will receive the offset of the top left corner of the rendered string from the origin of the string
pCharacterRects A pointer to a CRect vector that will receive CRects that contain each character. The corrdinates are in reference to the top left corner of the string as a whole

Definition at line 128 of file wg_renderedstring.cpp.

References wGui::CFontEngine::GetMetrics(), HALIGN_CENTER, HALIGN_LEFT, HALIGN_RIGHT, m_MaskChar, m_pFontEngine, m_sString, wGui::CPoint::SetX(), wGui::CPoint::SetY(), VALIGN_BOTTOM, VALIGN_CENTER, VALIGN_NORMAL, and VALIGN_TOP.

Referenced by Draw(), and wGui::CMessageBox::FitToText().

unsigned int wGui::CRenderedString::GetLength ( void   )  const [inline]

Get the length of the rendered string in characters

Returns:
The length of the string

Definition at line 90 of file wg_renderedstring.h.

References m_sString.

unsigned int wGui::CRenderedString::GetMaxFontHeight ( void   ) 

Get the maximum height of the font, ASCII characters 0-255

Returns:
The max height of the font

Definition at line 88 of file wg_renderedstring.cpp.

References wGui::CFontEngine::GetMetrics(), and m_pFontEngine.

unsigned int wGui::CRenderedString::GetMaxFontWidth ( void   ) 

Get the maximum width of the font, ASCII characters 0-255

Returns:
The max width of the font

Definition at line 108 of file wg_renderedstring.cpp.

References wGui::CFontEngine::GetMetrics(), and m_pFontEngine.

void wGui::CRenderedString::SetMaskChar ( wchar_t  MaskChar  )  [inline]

Set the mask character

Parameters:
MaskChar Character to use as the mask

Definition at line 102 of file wg_renderedstring.h.

References m_MaskChar.

wchar_t wGui::CRenderedString::GetMaskChar ( void   )  const [inline]

Return the mask character

Returns:
Character to use as the mask

Definition at line 106 of file wg_renderedstring.h.

References m_MaskChar.


The documentation for this class was generated from the following files:
Generated on Wed May 16 23:11:28 2007 for wGui by  doxygen 1.5.1