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

TextSelection.h

00001 00002 #ifndef MOD_TEXTSELECTION_H 00003 #define MOD_TEXTSELECTION_H 00004 00005 //Licence: LGPL 00006 //Copyright: Visti Andresen 00007 00008 #include "MenuItem.h" 00009 #include "Font.h" 00010 #include <string> 00011 #include <vector> 00012 00013 using namespace std; 00014 00015 /**A class that allows the user to select, a text string form a list of 00016 string.*/ 00017 class TextSelection : public MenuItem 00018 { 00019 public: 00020 /**lable is the name the user can see on screen. 00021 00022 choices is a vector containing the text strings the user can select. 00023 00024 name is the name of the TextEntry in the config file. 00025 00026 font is the Font to use when rendering. 00027 */ 00028 TextSelection(const string &label, const string &name, vector<string> &choices, Font *font); 00029 ~TextSelection(); 00030 void load(ifstream &file); 00031 void save(ofstream &file); 00032 void draw(float x, float y, float zoom); 00033 Type getType(){return CONTROL;} 00034 float getWidth(float zoom); 00035 float getHeight(float zoom); 00036 string &getName(){return name_;} 00037 /**Returns the number of the text string the user has selected. Index 0.*/ 00038 unsigned int getSelection(){return currentSelection_;} 00039 bool handleKeyEvent(SDL_Event *event); 00040 private: 00041 string label_; 00042 string name_; 00043 vector<string> choices_; 00044 Font *font_; 00045 unsigned int currentSelection_; 00046 }; 00047 00048 00049 #endif

Generated on Wed Sep 1 14:46:57 2004 by doxygen 1.3.7