Woopsi 1.3
Nintendo DS Gui Framework
Classes | Public Member Functions
WoopsiUI::Document Class Reference

#include <libwoopsi/include/document.h>

List of all members.

Classes

struct  LongestLine

Public Member Functions

 Document (FontBase *font, const WoopsiString &text, u16 width)
virtual ~Document ()
virtual void setText (const WoopsiString &text)
virtual void setText (const char *text)
virtual void setText (const u32 text)
virtual void append (const WoopsiString &text)
virtual void insert (const WoopsiString &text, const s32 index)
virtual void remove (const s32 startIndex)
virtual void remove (const s32 startIndex, const s32 count)
void setLineSpacing (u8 lineSpacing)
void setWidth (u16 width)
void setFont (FontBase *font)
const u8 getLineLength (const s32 lineNumber) const
const s16 getLineTrimmedLength (const s32 lineNumber) const
const s16 getLinePixelLength (const s32 lineNumber) const
const s16 getLineTrimmedPixelLength (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 (s32 charIndex)
const s32 getLineContainingCharIndex (const s32 index) const
const s32 getLineStartIndex (const s32 line) const
const WoopsiStringgetText () const

Detailed Description

Contains a WoopsiString and can wrap it to fit within a given width for a given font.


Constructor & Destructor Documentation

WoopsiUI::Document::Document ( FontBase font,
const WoopsiString text,
u16  width 
)

Constructor.

Parameters:
fontThe font to use for this object.
textA string that this object should wrap around.
widthThe pixel width at which the text should wrap.
virtual WoopsiUI::Document::~Document ( ) [inline, virtual]

Destructor.


Member Function Documentation

virtual void WoopsiUI::Document::append ( const WoopsiString text) [virtual]

Append text to the end of the string.

Parameters:
textString to append.
FontBase* WoopsiUI::Document::getFont ( ) const

Get a pointer to the Document object's font.

Returns:
Pointer to the font.
const s32 WoopsiUI::Document::getLineContainingCharIndex ( const s32  index) const

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

Parameters:
indexThe 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::Document::getLineCount ( ) const [inline]

Get the total number of lines in the text.

Returns:
The line count.
const u8 WoopsiUI::Document::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 WoopsiUI::Document::getLineLength ( const s32  lineNumber) const

Get the number of characters in the specified line number.

Parameters:
lineNumberThe line number to check.
Returns:
The number of characters in the line.
const s16 WoopsiUI::Document::getLinePixelLength ( const s32  lineNumber) const

Get the width in pixels of the specified line number.

Parameters:
lineNumberThe line number to check.
Returns:
The pixel width of the line.
const u8 WoopsiUI::Document::getLineSpacing ( ) const [inline]

Get the pixel spacing between each line of text.

Returns:
The line spacing.
const s32 WoopsiUI::Document::getLineStartIndex ( const s32  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:
lineThe line number to locate within the char array.
Returns:
The index within the char array of the start of the supplied line.
const s16 WoopsiUI::Document::getLineTrimmedLength ( const s32  lineNumber) const

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

Parameters:
lineNumberThe line number to check.
Returns:
The number of characters in the line.
const s16 WoopsiUI::Document::getLineTrimmedPixelLength ( const s32  lineNumber) const

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

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

Get the total height of the text in pixels.

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

Get the width of the longest line in pixels.

Returns:
The width of the longest line.
const WoopsiString& WoopsiUI::Document::getText ( ) const [inline]

Get a reference to the internal string. String is constant to prevent it being changed without notifying the document. Any change to a string should cause a re-wrap operation.

Returns:
The internal string.
virtual void WoopsiUI::Document::insert ( const WoopsiString text,
const s32  index 
) [virtual]

Insert text at the specified character index.

Parameters:
textThe text to insert.
indexThe char index to insert at.
virtual void WoopsiUI::Document::remove ( const s32  startIndex) [virtual]

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

Parameters:
startIndexThe char index to start removing from.
virtual void WoopsiUI::Document::remove ( const s32  startIndex,
const s32  count 
) [virtual]

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

Parameters:
startIndexThe char index to start removing from.
countThe number of chars to remove.
void WoopsiUI::Document::setFont ( FontBase font)

Set the font to use.

Parameters:
fontPointer to the new font.
void WoopsiUI::Document::setLineSpacing ( u8  lineSpacing)

Set the vertical spacing between rows of text.

Parameters:
lineSpacingThe line spacing.
virtual void WoopsiUI::Document::setText ( const u32  text) [virtual]

Set the text in the string.

Parameters:
textCharacter to to use as the new data for this string.
virtual void WoopsiUI::Document::setText ( const WoopsiString text) [virtual]

Set the text in the string.

Parameters:
textThe new string.
virtual void WoopsiUI::Document::setText ( const char *  text) [virtual]

Set the text in the string.

Parameters:
textChar array to use as the new data for this string.
void WoopsiUI::Document::setWidth ( u16  width)

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

Parameters:
widthMaximum pixel width of the text.
void WoopsiUI::Document::stripTopLines ( const s32  lines)

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

Parameters:
linesNumber of lines to remove
void WoopsiUI::Document::wrap ( s32  charIndex)

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

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

Wrap all of the text.


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