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

TextSelection Class Reference

#include <TextSelection.h>

Inheritance diagram for TextSelection:

MenuItem List of all members.

Public Member Functions

 TextSelection (const string &label, const string &name, vector< string > &choices, Font *font)
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 ()
unsigned int getSelection ()
bool handleKeyEvent (SDL_Event *event)

Detailed Description

A class that allows the user to select, a text string form a list of string.

Definition at line 17 of file TextSelection.h.


Constructor & Destructor Documentation

TextSelection::TextSelection const string &  label,
const string &  name,
vector< string > &  choices,
Font font
 

lable is the name the user can see on screen.

choices is a vector containing the text strings the user can select.

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

font is the Font to use when rendering.

Definition at line 6 of file TextSelection.cpp.


Member Function Documentation

void TextSelection::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 31 of file TextSelection.cpp.

float TextSelection::getHeight float  zoom  )  [virtual]
 

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

Implements MenuItem.

Definition at line 41 of file TextSelection.cpp.

string& TextSelection::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 36 of file TextSelection.h.

unsigned int TextSelection::getSelection  )  [inline]
 

Returns the number of the text string the user has selected. Index 0.

Definition at line 38 of file TextSelection.h.

Type TextSelection::getType  )  [inline, virtual]
 

Returns the Type of this control.

Implements MenuItem.

Definition at line 33 of file TextSelection.h.

float TextSelection::getWidth float  zoom  )  [virtual]
 

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

Implements MenuItem.

Definition at line 36 of file TextSelection.cpp.

bool TextSelection::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 46 of file TextSelection.cpp.

void TextSelection::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 19 of file TextSelection.cpp.

void TextSelection::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 26 of file TextSelection.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