Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

TextEntry Class Reference

#include <TextEntry.h>

Inheritance diagram for TextEntry:

MenuItem List of all members.

Public Types

enum  TextEntryType { NORMAL, UPPERCASE, LOWERCASE }

Public Member Functions

 TextEntry (const string &label, const string &name, Font *font, TextEntryType type=NORMAL, const string &defaultValue="", int maxLength_=0)
void load (ifstream &file)
void save (ofstream &file)
void draw (float x, float y, float zoom)
Type getType ()
float getWidth (float zoom)
float getHeight (float zoom)
string & getName ()
string & getValue ()
bool handleKeyEvent (SDL_Event *event)

Detailed Description

A menu item that allows the user to enter a text string. The text value is saved along with the TextEntry when save is called.

Definition at line 15 of file TextEntry.h.


Member Enumeration Documentation

enum TextEntry::TextEntryType
 

Defines the type of TextEntry

Enumeration values:
NORMAL  Normal TextEntry with both uppercase and lowercase letters.
UPPERCASE  Uppercase only TextEntry.
LOWERCASE  Lowercase only TextEntry.

Definition at line 19 of file TextEntry.h.


Constructor & Destructor Documentation

TextEntry::TextEntry const string &  label,
const string &  name,
Font font,
TextEntryType  type = NORMAL,
const string &  defaultValue = "",
int  maxLength_ = 0
 

Constructor

lable is the name the user can see on screen.

name is the name of the TextEntry in the config file.

font is the Font to use when rendering.

type is the type of the TextEntry.

defaultValue is the value to use if no entry is found in the config file or the config file is't loaded.

maxLength is the maximal length of the text the user can enter, 0 for unlimited. Currently only 0 is implemented.

Definition at line 7 of file TextEntry.cpp.


Member Function Documentation

void TextEntry::draw float  x,
float  y,
float  zoom
[virtual]
 

Draws the MenuItem at x,y with a zoom factor of zoom (2 equals double size).

The MenuItem may decide not to apply the scale or to only support some zoom steps, always check getWidth and getHeight if you need the excact size.

Implements MenuItem.

Definition at line 53 of file TextEntry.cpp.

float TextEntry::getHeight float  zoom  )  [virtual]
 

Returns the height of this MenuItem at zoom factor zoom, must be excact

Implements MenuItem.

Definition at line 63 of file TextEntry.cpp.

string& TextEntry::getName  )  [inline, virtual]
 

Returns the name of the MenuItem used when save is called.

The name may not contain a =.

Implements MenuItem.

Definition at line 51 of file TextEntry.h.

Type TextEntry::getType  )  [inline, virtual]
 

Returns the Type of this control.

Implements MenuItem.

Definition at line 48 of file TextEntry.h.

string& TextEntry::getValue  )  [inline]
 

Returns the text string that the user has typed in the TextEntry.

Definition at line 53 of file TextEntry.h.

float TextEntry::getWidth float  zoom  )  [virtual]
 

Returns the width of this MenuItem at zoom factor zoom, must be excact

Implements MenuItem.

Definition at line 58 of file TextEntry.cpp.

bool TextEntry::handleKeyEvent SDL_Event *  event  )  [virtual]
 

Called when a key press/release event occurs, return true if the MenuItem has handled the event.

If true is returned the event handling will stop.

Implements MenuItem.

Definition at line 68 of file TextEntry.cpp.

void TextEntry::load ifstream &  file  )  [virtual]
 

Reads the configuration for the MenuItem from any position within the file

Hint: Use findLoadPosition to find you entry in the file

Reimplemented from MenuItem.

Definition at line 23 of file TextEntry.cpp.

void TextEntry::save ofstream &  file  )  [virtual]
 

Saves the MenuItem at the current position in the file.

Entrys must look like "name=value\n".

Reimplemented from MenuItem.

Definition at line 38 of file TextEntry.cpp.


The documentation for this class was generated from the following files:
Generated on Wed Sep 1 14:46:57 2004 by doxygen 1.3.7