WoopsiUI::TextBox Class Reference

#include <textbox.h>

Inheritance diagram for WoopsiUI::TextBox:
WoopsiUI::Label WoopsiUI::Gadget

List of all members.

Public Member Functions

 TextBox (s16 x, s16 y, u16 width, u16 height, const char *text, FontBase *font=NULL)
 TextBox (s16 x, s16 y, u16 width, u16 height, const char letter, FontBase *font=NULL)
virtual void draw (Rect clipRect)
virtual void showCursor ()
virtual void hideCursor ()
virtual void setText (const char *text)
virtual void setText (const char text)
virtual void appendText (const char *text)
virtual void appendText (const char text)
virtual void insertText (const char *text, const u32 index)
virtual void insertText (const char text, const u32 index)
virtual void insertTextAtCursor (const char *text)
virtual void insertTextAtCursor (const char text)
virtual void moveCursorToPosition (const u32 position)
virtual const u32 getCursorPosition () const
virtual void getClientRect (Rect &rect) const
virtual bool click (s16 x, s16 y)
virtual bool keyPress (KeyCode keyCode)

Protected Member Functions

virtual const u16 getCursorXPos () const
 TextBox (const TextBox &textbox)

Protected Attributes

u32 _cursorPos
bool _showCursor

Detailed Description

Single-line textbox gadget. Can align text both vertically and horizontally in different ways.


Constructor & Destructor Documentation

TextBox::TextBox ( s16  x,
s16  y,
u16  width,
u16  height,
const char *  text,
FontBase font = NULL 
)

Constructor for a textbox containing a string.

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.
font The font to use in this text box.
TextBox::TextBox ( s16  x,
s16  y,
u16  width,
u16  height,
const char  letter,
FontBase font = NULL 
)

Constructor for a textbox containing a single character.

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.
letter Single character to display in the textbox.
font The font to use in this text box.
WoopsiUI::TextBox::TextBox ( const TextBox textbox  )  [inline, protected]

Copy constructor is protected to prevent usage.


Member Function Documentation

void TextBox::appendText ( const char  text  )  [virtual]

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

Parameters:
text Char to append.

Reimplemented from WoopsiUI::Label.

void TextBox::appendText ( const char *  text  )  [virtual]

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

Parameters:
text String to append.

Reimplemented from WoopsiUI::Label.

bool TextBox::click ( s16  x,
s16  y 
) [virtual]

Click this gadget at the supplied co-ordinates.

Parameters:
x X co-ordinate of the click.
y Y co-ordinate of the click.
Returns:
True if the click was successful.

Reimplemented from WoopsiUI::Gadget.

void TextBox::draw ( Rect  clipRect  )  [virtual]

Draw the region of the textbox within the clipping rect. Should not be called directly.

Parameters:
clipRect The clipping rect to limit drawing to.

Reimplemented from WoopsiUI::Label.

void TextBox::getClientRect ( Rect rect  )  const [virtual]

Insert the properties of the space within this gadget that is available for children into the rect passed in as a parameter. All co-ordinates are relative to this gadget.

Parameters:
rect Reference to a rect to populate with data.

Reimplemented from WoopsiUI::Gadget.

virtual const u32 WoopsiUI::TextBox::getCursorPosition (  )  const [inline, virtual]

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

Returns:
position The cursor position.
const u16 TextBox::getCursorXPos (  )  const [protected, virtual]

Get the x co-ordinate of the cursor in pixels.

Returns:
The x co-ordinate of the cursor in pixels.
void TextBox::hideCursor (  )  [virtual]

Hides the cursor.

void TextBox::insertText ( const char  text,
const u32  index 
) [virtual]

Insert text at the specified index.

Parameters:
text Char to insert.
index Index at which to insert the char.

Reimplemented from WoopsiUI::Label.

void TextBox::insertText ( const char *  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.

Reimplemented from WoopsiUI::Label.

void TextBox::insertTextAtCursor ( const char  text  )  [virtual]

Insert text at the current cursor position.

Parameters:
text Char to insert.
void TextBox::insertTextAtCursor ( const char *  text  )  [virtual]

Insert text at the current cursor position.

Parameters:
text The text to insert.
bool TextBox::keyPress ( KeyCode  keyCode  )  [virtual]

Send a keypress to the gadget.

Parameters:
keyCode The keycode to send to the gadget.
Returns:
True if the keypress was processed.

Reimplemented from WoopsiUI::Gadget.

void TextBox::moveCursorToPosition ( const u32  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.
void TextBox::setText ( const char  text  )  [virtual]

Set the text displayed in the label.

Parameters:
text Character to display.

Reimplemented from WoopsiUI::Label.

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

Set the text displayed in the label.

Parameters:
text String to display.

Reimplemented from WoopsiUI::Label.

void TextBox::showCursor (  )  [virtual]

Shows the cursor.


Member Data Documentation

Position of the cursor within the string

Set to true to make cursor visible


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