source:
molecuilder/src/Menu/TextMenu.hpp@
795b4d
| Last change on this file since 795b4d was aa117c, checked in by , 16 years ago | |
|---|---|
|
|
| File size: 1.1 KB | |
| Rev | Line | |
|---|---|---|
| [d20ed5] | 1 | /* |
| 2 | * TextMenu.h | |
| 3 | * | |
| 4 | * Created on: Dec 10, 2009 | |
| 5 | * Author: crueger | |
| 6 | */ | |
| 7 | ||
| 8 | #ifndef TEXTMENU_H_ | |
| 9 | #define TEXTMENU_H_ | |
| 10 | ||
| 11 | #include <list> | |
| 12 | #include <ostream> | |
| 13 | #include <string> | |
| 14 | ||
| 15 | #include "Menu/Menu.hpp" | |
| [da09909] | 16 | #include "defs.hpp" |
| [d20ed5] | 17 | |
| 18 | class MenuItem; | |
| 19 | ||
| [da09909] | 20 | /** |
| 21 | * Used to produce any kind of text menu | |
| 22 | * | |
| 23 | * All Items are displayed and user is prompted for a key. The item corresponding to that key is then activated. | |
| 24 | */ | |
| [d20ed5] | 25 | class TextMenu : public Menu |
| 26 | { | |
| 27 | public: | |
| [da09909] | 28 | TextMenu(ostream& _outputter, string _title, char _spacer=STD_MENU_TITLE_SPACER,int _length=STD_MENU_LENGTH); |
| [d20ed5] | 29 | virtual ~TextMenu(); |
| 30 | ||
| 31 | virtual void addItem(MenuItem*); | |
| 32 | virtual void removeItem(MenuItem*); | |
| 33 | virtual void display(); | |
| 34 | ||
| [da09909] | 35 | /** |
| 36 | * Call doQuit if you want to return from this menu. | |
| 37 | */ | |
| [d20ed5] | 38 | virtual void doQuit(); |
| [da09909] | 39 | /** |
| [aa117c] | 40 | * Check whether someone has chosen to quit |
| [da09909] | 41 | */ |
| [d20ed5] | 42 | virtual bool hasQuit(); |
| 43 | ||
| [aa117c] | 44 | virtual void addDefault(MenuItem*); |
| 45 | ||
| [d20ed5] | 46 | protected: |
| 47 | virtual void showEntry(MenuItem*); | |
| 48 | ||
| 49 | private: | |
| 50 | list<MenuItem*> items; | |
| [aa117c] | 51 | |
| 52 | MenuItem* defaultItem; | |
| 53 | ||
| [d20ed5] | 54 | ostream& outputter; |
| 55 | string title; | |
| [7cb300] | 56 | char spacer; |
| 57 | int length; | |
| 58 | ||
| [d20ed5] | 59 | bool quit; |
| 60 | }; | |
| 61 | ||
| 62 | #endif /* TEXTMENU_H_ */ |
Note:
See TracBrowser
for help on using the repository browser.
