Woopsi 1.0 GUI Framework for Nintendo DS Homebrew

- Main Page
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Classes | Public Member Functions

# WoopsiUI::Document Class Reference

`#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
FontBase * | getFont () 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 WoopsiString & | getText () 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:

  font | The font to use for this object.
  text | A string that this object should wrap around.
  width | The 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:

  text | String 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:

  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::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:

  lineNumber | The 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:

  lineNumber | The 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:

  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 s16 WoopsiUI::Document::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 s16 WoopsiUI::Document::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::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:

  text | The text to insert.
  index | The 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:

  startIndex | The 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:

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

void WoopsiUI::Document::setFont | ( | FontBase * | font | ) |

Set the font to use.

Parameters:

  font | Pointer to the new font.

void WoopsiUI::Document::setLineSpacing | ( | u8 | lineSpacing | ) |

Set the vertical spacing between rows of text.

Parameters:

  lineSpacing | The line spacing.

virtual void WoopsiUI::Document::setText | ( | const u32 | text | ) | `[virtual]`

Set the text in the string.

Parameters:

  text | Character 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:

  text | The new string.

virtual void WoopsiUI::Document::setText | ( | const char * | text | ) | `[virtual]`

Set the text in the string.

Parameters:

  text | Char 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:

  width | Maximum pixel width of the text.

void WoopsiUI::Document::stripTopLines | ( | const s32 | lines | ) |

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

Parameters:

  lines | Number of lines to remove

void WoopsiUI::Document::wrap | ( | s32 | 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 WoopsiUI::Document::wrap | ( |  | ) |

Wrap all of the text.

The documentation for this class was generated from the following file:

- document.h