Public Member Functions | Private Types | Private Member Functions | Private Attributes

TextField Class Reference

A Basic Text Field. More...

#include <TextField.h>

Inheritance diagram for TextField:
Control Broadcaster Listener

List of all members.

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

Detailed Description

A Basic Text Field.

The Field Control is just a set of rendered text a user can enter.


Member Enumeration Documentation

enum TextField::ActionType [private]
Enumerator:
ACTION_NONE 
ACTION_INSERT 
ACTION_BACKSPACE 
ACTION_DELETE 
ACTION_MOVE_LEFT 
ACTION_MOVE_RIGHT 

Constructor & Destructor Documentation

TextField::TextField ( const std::string &  name,
const std::string &  text,
Uint  width,
Uint  height,
Uint  maxLen = 0 
)
TextField::~TextField (  )  [inline]

Member Function Documentation

void TextField::drawCursor (  )  [private]

Draws the insertion point cursor.

void TextField::drawPlain (  )  [private, virtual]

Draws a Control without a Skin.

Reimplemented from Control.

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::onClick ( Event event  )  [private, virtual]

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  ) 

Member Data Documentation

Tick that the last action occurred on.

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.

Last action involving insertion, deletion and moving the cursor.

Maximum number of characters that can be stored in the TextField.

Offset within the string to start drawing at. Used to determine which part of a string is visible.

Tick since the last repeat of the last action.

string TextField::mText [private]

Text to display in the text box.

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.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines