A Basic Text Field. More...
#include <TextField.h>
Public Member Functions | |
| TextField (const std::string &name, const std::string &text, Uint width, Uint height, Uint maxLen=0) | |
| ~TextField () | |
| void | setText (const std::string &text) |
| void | setText (int value) |
| const std::string & | getText () const |
| void | isEditable (bool editable) |
| bool | isEditable () |
Private Types | |
| enum | ActionType { ACTION_NONE, ACTION_INSERT, ACTION_BACKSPACE, ACTION_DELETE, ACTION_MOVE_LEFT, ACTION_MOVE_RIGHT } |
Private Member Functions | |
| void | initialize () |
| void | drawSkin () |
| void | drawPlain () |
| void | drawCursor () |
| void | insertCharacter (const char *character) |
| void | onClick (Event *event) |
| void | onKeyDown (Event *event) |
| void | onKeyUp (Event *event) |
| void | onChanged (Event *event) |
| void | logic () |
| void | setAction (ActionType aType) |
Private Attributes | |
| Timer | mTimer |
| string | mText |
| string | mVisibleText |
| bool | mEditable |
| Uint | mCursorPosition |
| Uint | mMaxLength |
| Uint | mOffset |
| ActionType | mLastAction |
| Uint | mActionTick |
| Uint | mRepeatTick |
| string | mInsertChar |
A Basic Text Field.
The Field Control is just a set of rendered text a user can enter.
enum TextField::ActionType [private] |
| TextField::TextField | ( | const std::string & | name, | |
| const std::string & | text, | |||
| Uint | width, | |||
| Uint | height, | |||
| Uint | maxLen = 0 | |||
| ) |
| TextField::~TextField | ( | ) | [inline] |
| void TextField::drawCursor | ( | ) | [private] |
Draws the insertion point cursor.
| void TextField::drawPlain | ( | ) | [private, virtual] |
| void TextField::drawSkin | ( | ) | [private, virtual] |
Render this control.
Reimplemented from Control.
| const std::string & TextField::getText | ( | ) | const |
| void TextField::initialize | ( | ) | [private, virtual] |
Ensure that we're automatically setting our height/width parameters.
Reimplemented from Control.
| void TextField::insertCharacter | ( | const char * | character | ) | [private] |
| void TextField::isEditable | ( | bool | editable | ) |
| bool TextField::isEditable | ( | ) |
| void TextField::logic | ( | ) | [private, virtual] |
Reimplemented from Control.
| void TextField::onChanged | ( | Event * | event | ) | [private, virtual] |
Called whenever a Control's data changes.
Reimplemented from Control.
| void TextField::onKeyDown | ( | Event * | event | ) | [private, virtual] |
Called whenever an EVENT_KEYDOWN event is fired.
Reimplemented from Control.
| void TextField::onKeyUp | ( | Event * | event | ) | [private, virtual] |
Called whenever an EVENT_KEYUP event is fired.
Reimplemented from Control.
| void TextField::setAction | ( | ActionType | aType | ) | [private] |
| void TextField::setText | ( | const std::string & | text | ) |
| void TextField::setText | ( | int | value | ) |
Uint TextField::mActionTick [private] |
Tick that the last action occurred on.
Uint TextField::mCursorPosition [private] |
Position of the Insertion Cursor.
bool TextField::mEditable [private] |
Toggle editing of the field.
string TextField::mInsertChar [private] |
Character to insert when repeating character insertion.
ActionType TextField::mLastAction [private] |
Last action involving insertion, deletion and moving the cursor.
Uint TextField::mMaxLength [private] |
Maximum number of characters that can be stored in the TextField.
Uint TextField::mOffset [private] |
Offset within the string to start drawing at. Used to determine which part of a string is visible.
Uint TextField::mRepeatTick [private] |
Tick since the last repeat of the last action.
string TextField::mText [private] |
Text to display in the text box.
Timer TextField::mTimer [private] |
Internal timer used to slow down the progress of the thumb.
string TextField::mVisibleText [private] |
The text that's visible within the width of the TextField.
1.7.1