WoopsiUI::Text Class Reference

#include <text.h>

Inheritance diagram for WoopsiUI::Text:
WoopsiUI::WoopsiString

List of all members.

Classes

struct  LongestLine

Public Member Functions

 Text (FontBase *font, const char *text, u16 width)
virtual void setText (const char *text)
virtual void setText (const char text)
virtual void append (const char *text)
virtual void append (const char text)
virtual void insert (const char *text, const u32 index)
virtual void insert (const char text, const u32 index)
virtual void remove (const u32 startIndex)
virtual void remove (const u32 startIndex, const u32 count)
void setLineSpacing (u8 lineSpacing)
void setWidth (u16 width)
void setFont (FontBase *font)
const u8 getLineLength (const s32 lineNumber) const
const u8 getLineTrimmedLength (const s32 lineNumber) const
const u8 getLinePixelLength (const s32 lineNumber) const
const u8 getLineTrimmedPixelLength (const s32 lineNumber) const
const char * getLinePointer (const s32 lineNumber) const
const s32 getPixelHeight () const
const u8 getPixelWidth () const
const u8 getLineSpacing () const
const u8 getLineHeight () const
const s32 getLineCount () const
FontBasegetFont () const
void stripTopLines (const s32 lines)
void wrap ()
void wrap (u32 charIndex)
const u32 getLineContainingCharIndex (const u32 index) const
const u32 getLineStartIndex (const u32 line) const

Detailed Description

This class functions as a wrapper around a char array offering more advanced functionality - it can wrap text, calculate its height in pixels, calculate the width of a row, etc.


Constructor & Destructor Documentation

Text::Text ( FontBase font,
const char *  text,
u16  width 
)

Constructor.

Parameters:
font The font to use for this text object.
text A string that this text object should wrap around.
width The pixel width at which the text should wrap.

Member Function Documentation

void Text::append ( const char  text  )  [virtual]

Append text to the end of the string.

Parameters:
text Char to append.

Reimplemented from WoopsiUI::WoopsiString.

void Text::append ( const char *  text  )  [virtual]

Append text to the end of the string.

Parameters:
text String to append.

Reimplemented from WoopsiUI::WoopsiString.

FontBase * Text::getFont (  )  const

Get a pointer to the Text object's font.

Returns:
Pointer to the font.
const u32 Text::getLineContainingCharIndex ( const u32  index  )  const

Get the index of the line of text that contains the specified index within the raw char array.

Parameters:
index The index to locate within the wrapped lines of text.
Returns:
The number of the line of wrapped text that contains the specified index.
const s32 WoopsiUI::Text::getLineCount (  )  const [inline]

Get the total number of lines in the text.

Returns:
The line count.
const u8 WoopsiUI::Text::getLineHeight (  )  const [inline]

Get the height in pixels of a line, given as the height of the font plus the line spacing.

Returns:
The height of a line.
const u8 Text::getLineLength ( const s32  lineNumber  )  const

Get the number of characters in the specified line number.

Parameters:
lineNumber The line number to check.
Returns:
The number of characters in the line.
const u8 Text::getLinePixelLength ( const s32  lineNumber  )  const

Get the width in pixels of the specified line number.

Parameters:
lineNumber The line number to check.
Returns:
The pixel width of the line.
const char* WoopsiUI::Text::getLinePointer ( const s32  lineNumber  )  const [inline]

Get a pointer to the specified line.

Parameters:
lineNumber The line to get a pointer to.
Returns:
A pointer to the line.
const u8 WoopsiUI::Text::getLineSpacing (  )  const [inline]

Get the pixel spacing between each line of text.

Returns:
The line spacing.
const u32 WoopsiUI::Text::getLineStartIndex ( const u32  line  )  const [inline]

Gets the index within the char array that represents the start of the line of text indicated by the line parameter.

Parameters:
line The line number to locate within the char array.
Returns:
The index within the char array of the start of the supplied line.
const u8 Text::getLineTrimmedLength ( const s32  lineNumber  )  const

Get the number of characters in the specified line number, ignoring any trailing blank characters.

Parameters:
lineNumber The line number to check.
Returns:
The number of characters in the line.
const u8 Text::getLineTrimmedPixelLength ( const s32  lineNumber  )  const

Get the width in pixels of the specified line number, ignoring any trailing blank characters.

Parameters:
lineNumber The line number to check.
Returns:
The pixel width of the line.
const s32 WoopsiUI::Text::getPixelHeight (  )  const [inline]

Get the total height of the text in pixels.

Returns:
The total height of the text.
const u8 WoopsiUI::Text::getPixelWidth (  )  const [inline]

Get the width of the longest line in pixels.

Returns:
The width of the longest line.
void Text::insert ( const char  text,
const u32  index 
) [virtual]

Insert text at the specified character index.

Parameters:
text Char to insert.
index The char index to insert at.

Reimplemented from WoopsiUI::WoopsiString.

void Text::insert ( const char *  text,
const u32  index 
) [virtual]

Insert text at the specified character index.

Parameters:
text The text to insert.
index The char index to insert at.

Reimplemented from WoopsiUI::WoopsiString.

void Text::remove ( const u32  startIndex,
const u32  count 
) [virtual]

Remove all characters from the string from the start index onwards.

Parameters:
startIndex The char index to start removing from.
count The number of chars to remove.

Reimplemented from WoopsiUI::WoopsiString.

void Text::remove ( const u32  startIndex  )  [virtual]

Remove all characters from the string from the start index onwards.

Parameters:
startIndex The char index to start removing from.

Reimplemented from WoopsiUI::WoopsiString.

void Text::setFont ( FontBase font  ) 

Set the font to use.

Parameters:
font Pointer to the new font.
void Text::setLineSpacing ( u8  lineSpacing  ) 

Set the vertical spacing between rows of text.

Parameters:
lineSpacing The line spacing.
void Text::setText ( const char  text  )  [virtual]

Set the text in the string.

Parameters:
text Character to to use as the new data for this string.

Reimplemented from WoopsiUI::WoopsiString.

void Text::setText ( const char *  text  )  [virtual]

Set the text in the string.

Parameters:
text Char array to use as the new data for this string.

Reimplemented from WoopsiUI::WoopsiString.

void Text::setWidth ( u16  width  ) 

Sets the pixel width of the text; text wider than this will automatically wrap.

Parameters:
width Maximum pixel width of the text.
void Text::stripTopLines ( const s32  lines  ) 

Removes lines of text from the start of the text buffer.

Parameters:
lines Number of lines to remove
void Text::wrap ( u32  charIndex  ) 

Wrap the text from the line containing the specified char index onwards.

Parameters:
charIndex The index of the char to start wrapping from; note that the wrapping function will re-wrap that entire line of text.
void Text::wrap (  ) 

Wrap all of the text.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations Enumerator

Generated on Sat Oct 24 14:33:12 2009 for Woopsi by  doxygen 1.6.1