Woopsi 1.0 GUI Framework for Nintendo DS Homebrew

- Main Page
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes

# WoopsiUI::ScrollingTextBox Class Reference

`#include <scrollingtextbox.h>`

Inheritance diagram for WoopsiUI::ScrollingTextBox:

List of all members.

## Public Member Functions
| ScrollingTextBox (s16 x, s16 y, u16 width, u16 height, const WoopsiString &text, u32 flags, s16 maxRows=0, GadgetStyle *style=NULL)
virtual void | setTextAlignmentHoriz (MultiLineTextBox::TextAlignmentHoriz alignment)
virtual void | setTextAlignmentVert (MultiLineTextBox::TextAlignmentVert alignment)
virtual const u16 | getPageCount () const
virtual const u16 | getCurrentPage () const
virtual const Document * | getDocument () const
virtual void | setText (const WoopsiString &text)
virtual void | appendText (const WoopsiString &text)
virtual void | removeText (const u32 startIndex)
virtual void | removeText (const u32 startIndex, const u32 count)
virtual void | setFont (FontBase *font)
virtual const u32 | getTextLength () const
virtual void | showCursor ()
virtual void | hideCursor ()
virtual void | moveCursorToPosition (const s32 position)
virtual const s32 | getCursorPosition () const
virtual void | insertText (const WoopsiString &text, const u32 index)
virtual void | insertTextAtCursor (const WoopsiString &text)
virtual void | handleValueChangeEvent (const GadgetEventArgs &e)
virtual void | handleScrollEvent (const GadgetEventArgs &e)
bool | opensKeyboard () const
void | disableKeyboardPopup ()
void | enableKeyboardPopup ()
virtual const s32 | getCanvasX () const
virtual const s32 | getCanvasY () const
virtual const s32 | getCanvasWidth () const
virtual const s32 | getCanvasHeight () const
virtual void | scroll (s32 dx, s32 dy)
virtual void | jump (s32 x, s32 y)
virtual void | setAllowsVerticalScroll (bool allow)
virtual void | setAllowsHorizontalScroll (bool allow)
virtual void | setCanvasWidth (const s32 width)
virtual void | setCanvasHeight (const s32 height)
virtual bool | allowsVerticalScroll () const
virtual bool | allowsHorizontalScroll () const
## Protected Member Functions
void | updateScrollbar ()
virtual void | drawContents (GraphicsPort *port)
virtual void | onResize (u16 width, u16 height)
virtual | ~ScrollingTextBox ()
| ScrollingTextBox (const ScrollingTextBox &scrollingTextBox)
## Protected Attributes
MultiLineTextBox * | _textbox
ScrollbarVertical * | _scrollbar
u8 | _scrollbarWidth

## Detailed Description

Gadget containing a MultiLineTextBox and a vertical scrollbar. Exposed methods are more or less identical to the methods exposed by the MultiLineTextBox to ensure that the two are interchangeable.

## Constructor & Destructor Documentation

WoopsiUI::ScrollingTextBox::ScrollingTextBox | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height,
|  | const WoopsiString & | text,
|  | u32 | flags,
|  | s16 | maxRows = `0`,
|  | GadgetStyle * | style = `NULL`
| ) |  |

Constructor.

Parameters:

  x | The x co-ordinate of the text box, relative to its parent.
  y | The y co-ordinate of the text box, relative to its parent.
  width | The width of the textbox.
  height | The height of the textbox.
  text | Pointer to a string to display in the textbox.
  flags | Standard gadget flag options.
  maxRows | The maximum number of rows the textbox can track. Adding text beyond this number will cause rows at the start of the text to be forgotten; text is essentially stored as a queue, and adding to the back of a full queue causes the front items to be popped off. Setting this to 0 will make the textbox track only the visible rows.
  style | The style that the gadget should use. If this is not specified, the gadget will use the values stored in the global defaultGadgetStyle object. The gadget will copy the properties of the style into its own internal style object.

virtual WoopsiUI::ScrollingTextBox::~ScrollingTextBox | ( |  | ) | `[inline, protected, virtual]`

Destructor.

WoopsiUI::ScrollingTextBox::ScrollingTextBox | ( | const ScrollingTextBox & | scrollingTextBox | ) | `[inline, protected]`

Copy constructor is protected to prevent usage.

## Member Function Documentation

virtual bool WoopsiUI::ScrollingTextBox::allowsHorizontalScroll | ( |  | ) | const`[virtual]`

Returns true if horizontal scrolling is allowed.

Returns:
  True if horizontal scrolling is allowed.

Implements WoopsiUI::ScrollableBase.

virtual bool WoopsiUI::ScrollingTextBox::allowsVerticalScroll | ( |  | ) | const`[virtual]`

Returns true if vertical scrolling is allowed.

Returns:
  True if vertical scrolling is allowed.

Implements WoopsiUI::ScrollableBase.

virtual void WoopsiUI::ScrollingTextBox::appendText | ( | const WoopsiString & | text | ) | `[virtual]`

Append new text to the end of the current text displayed in the textbox.

Parameters:

  text | String to append.

Implements WoopsiUI::TextBoxBase.

void WoopsiUI::ScrollingTextBox::disableKeyboardPopup | ( |  | ) | `[inline, virtual]`

Disables the keyboard popup when double-clicked.

Implements WoopsiUI::TextBoxBase.

virtual void WoopsiUI::ScrollingTextBox::drawContents | ( | GraphicsPort * | port | ) | `[protected, virtual]`

Draw the area of this gadget that falls within the clipping region. Called by the redraw() function to draw all visible regions.

Parameters:

  port | The GraphicsPort to draw to.

See also:
  redraw()

Reimplemented from WoopsiUI::Gadget.

void WoopsiUI::ScrollingTextBox::enableKeyboardPopup | ( |  | ) | `[inline, virtual]`

Enables the keyboard popup when double-clicked.

Implements WoopsiUI::TextBoxBase.

virtual const s32 WoopsiUI::ScrollingTextBox::getCanvasHeight | ( |  | ) | const`[virtual]`

Gets the height of the virtual canvas.

Returns:
  The height of the virtual canvas.

Implements WoopsiUI::ScrollableBase.

virtual const s32 WoopsiUI::ScrollingTextBox::getCanvasWidth | ( |  | ) | const`[virtual]`

Gets the width of the virtual canvas.

Returns:
  The width of the virtual canvas.

Implements WoopsiUI::ScrollableBase.

virtual const s32 WoopsiUI::ScrollingTextBox::getCanvasX | ( |  | ) | const`[virtual]`

Gets the x co-ordinate of the virtual canvas.

Returns:
  The x co-ordinate of the virtual canvas.

Implements WoopsiUI::ScrollableBase.

virtual const s32 WoopsiUI::ScrollingTextBox::getCanvasY | ( |  | ) | const`[virtual]`

Gets the y co-ordinate of the virtual canvas.

Returns:
  The y co-ordinate of the virtual canvas.

Implements WoopsiUI::ScrollableBase.

virtual const u16 WoopsiUI::ScrollingTextBox::getCurrentPage | ( |  | ) | const`[virtual]`

Returns the current page.

Returns:
  The current page.

See also:
  getPageCount().

virtual const s32 WoopsiUI::ScrollingTextBox::getCursorPosition | ( |  | ) | const`[virtual]`

Get the cursor position. This is the index within the string that the cursor is currently positioned over.

Returns:
  position The cursor position.

Implements WoopsiUI::TextBoxBase.

virtual const Document* WoopsiUI::ScrollingTextBox::getDocument | ( |  | ) | const`[virtual]`

Returns a pointer to the Document object that contains the wrapped text used in the textbox. It is used as the pre-processed data source for the textbox, and should not be altered.

Returns:
  Pointer to the Text object.

virtual const u16 WoopsiUI::ScrollingTextBox::getPageCount | ( |  | ) | const`[virtual]`

Returns the number of "pages" that the text spans. A page is defined as the amount of text that can be displayed within the textbox at one time.

Returns:
  The page count.

virtual const u32 WoopsiUI::ScrollingTextBox::getTextLength | ( |  | ) | const`[virtual]`

Get the length of the text string.

Returns:
  The length of the text string.

virtual void WoopsiUI::ScrollingTextBox::handleScrollEvent | ( | const GadgetEventArgs & | e | ) | `[virtual]`

Handles events raised by its sub-gadgets.

Parameters:

  e | Event arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::ScrollingTextBox::handleValueChangeEvent | ( | const GadgetEventArgs & | e | ) | `[virtual]`

Handles events raised by its sub-gadgets.

Parameters:

  e | Event arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::ScrollingTextBox::hideCursor | ( |  | ) | `[virtual]`

Hides the cursor.

Implements WoopsiUI::TextBoxBase.

virtual void WoopsiUI::ScrollingTextBox::insertText | ( | const WoopsiString & | text,
|  | const u32 | index
| ) |  | `[virtual]`

Insert text at the specified index.

Parameters:

  text | The text to insert.
  index | Index at which to insert the text.

Implements WoopsiUI::TextBoxBase.

virtual void WoopsiUI::ScrollingTextBox::insertTextAtCursor | ( | const WoopsiString & | text | ) | `[virtual]`

Insert text at the current cursor position.

Parameters:

  text | The text to insert.

Implements WoopsiUI::TextBoxBase.

virtual void WoopsiUI::ScrollingTextBox::jump | ( | s32 | x,
|  | s32 | y
| ) |  | `[virtual]`

Reposition the panel's scrolling region to the specified co-ordinates.

Parameters:

  x | The new x co-ordinate of the scrolling region.
  y | The new y co-ordinate of the scrolling region.

Implements WoopsiUI::ScrollableBase.

virtual void WoopsiUI::ScrollingTextBox::moveCursorToPosition | ( | const s32 | position | ) | `[virtual]`

Move the cursor to the text position specified. 0 indicates the start of the string. If position is greater than the length of the string, the cursor is moved to the end of the string.

Parameters:

  position | The new cursor position.

Implements WoopsiUI::TextBoxBase.

virtual void WoopsiUI::ScrollingTextBox::onResize | ( | u16 | width,
|  | u16 | height
| ) |  | `[protected, virtual]`

Resize the textbox to the new dimensions.

Parameters:

  width | The new width.
  height | The new height.

Reimplemented from WoopsiUI::Gadget.

bool WoopsiUI::ScrollingTextBox::opensKeyboard | ( |  | ) | const`[inline, virtual]`

Check if the textbox opens the keyboard popup when double-clicked.

Returns:
  True if the keyboard pops up; false if not.

Implements WoopsiUI::TextBoxBase.

virtual void WoopsiUI::ScrollingTextBox::removeText | ( | const u32 | startIndex,
|  | const u32 | count
| ) |  | `[virtual]`

Remove specified number of characters from the string from the start index onwards.

Parameters:

  startIndex | Index to remove from.
  count | Number of characters to remove.

Implements WoopsiUI::TextBoxBase.

virtual void WoopsiUI::ScrollingTextBox::removeText | ( | const u32 | startIndex | ) | `[virtual]`

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

Parameters:

  startIndex | Index to remove from.

Implements WoopsiUI::TextBoxBase.

virtual void WoopsiUI::ScrollingTextBox::scroll | ( | s32 | dx,
|  | s32 | dy
| ) |  | `[virtual]`

Scroll the panel by the specified amounts.

Parameters:

  dx | The horizontal distance to scroll.
  dy | The vertical distance to scroll.

Implements WoopsiUI::ScrollableBase.

virtual void WoopsiUI::ScrollingTextBox::setAllowsHorizontalScroll | ( | bool | allow | ) | `[virtual]`

Set whether or not horizontal scrolling is allowed.

Parameters:

  allow | True to allow horizontal scrolling; false to deny it.

Implements WoopsiUI::ScrollableBase.

virtual void WoopsiUI::ScrollingTextBox::setAllowsVerticalScroll | ( | bool | allow | ) | `[virtual]`

Set whether or not horizontal scrolling is allowed.

Parameters:

  allow | True to allow horizontal scrolling; false to deny it.

Implements WoopsiUI::ScrollableBase.

virtual void WoopsiUI::ScrollingTextBox::setCanvasHeight | ( | const s32 | height | ) | `[virtual]`

Sets the height of the virtual canvas.

Parameters:

  height | The height of the virtual canvas.

Implements WoopsiUI::ScrollableBase.

virtual void WoopsiUI::ScrollingTextBox::setCanvasWidth | ( | const s32 | width | ) | `[virtual]`

Sets the width of the virtual canvas.

Parameters:

  width | The width of the virtual canvas.

Implements WoopsiUI::ScrollableBase.

virtual void WoopsiUI::ScrollingTextBox::setFont | ( | FontBase * | font | ) | `[virtual]`

Set the font used in the textbox.

Parameters:

  font | Pointer to the new font.

Reimplemented from WoopsiUI::Gadget.

virtual void WoopsiUI::ScrollingTextBox::setText | ( | const WoopsiString & | text | ) | `[virtual]`

Set the text displayed in the textbox.

Parameters:

  text | String to display.

Implements WoopsiUI::TextBoxBase.

virtual void WoopsiUI::ScrollingTextBox::setTextAlignmentHoriz | ( | MultiLineTextBox::TextAlignmentHoriz | alignment | ) | `[virtual]`

Set the horizontal alignment of text within the textbox.

Parameters:

  alignment | The horizontal position of the text.

virtual void WoopsiUI::ScrollingTextBox::setTextAlignmentVert | ( | MultiLineTextBox::TextAlignmentVert | alignment | ) | `[virtual]`

Set the vertical alignment of text within the textbox.

Parameters:

  alignment | The vertical position of the text.

virtual void WoopsiUI::ScrollingTextBox::showCursor | ( |  | ) | `[virtual]`

Shows the cursor.

Implements WoopsiUI::TextBoxBase.

void WoopsiUI::ScrollingTextBox::updateScrollbar | ( |  | ) | `[protected]`

Updates all scrollbar properties; called when textbox changes.

## Member Data Documentation

ScrollbarVertical* WoopsiUI::ScrollingTextBox::_scrollbar`[protected]`

Pointer to the scrollbar

u8 WoopsiUI::ScrollingTextBox::_scrollbarWidth`[protected]`

Width of the scrollbar

MultiLineTextBox* WoopsiUI::ScrollingTextBox::_textbox`[protected]`

Pointer to the textbox

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

- scrollingtextbox.h