source: molecuilder/src/Menu/TextMenu.hpp@ a5471c

Last change on this file since a5471c was aa117c, checked in by Tillmann Crueger <crueger@…>, 16 years ago

Added possibility to add default Items to textMenus

  • Property mode set to 100644
File size: 1.1 KB
Line 
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"
16#include "defs.hpp"
17
18class MenuItem;
19
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 */
25class TextMenu : public Menu
26{
27public:
28 TextMenu(ostream& _outputter, string _title, char _spacer=STD_MENU_TITLE_SPACER,int _length=STD_MENU_LENGTH);
29 virtual ~TextMenu();
30
31 virtual void addItem(MenuItem*);
32 virtual void removeItem(MenuItem*);
33 virtual void display();
34
35 /**
36 * Call doQuit if you want to return from this menu.
37 */
38 virtual void doQuit();
39 /**
40 * Check whether someone has chosen to quit
41 */
42 virtual bool hasQuit();
43
44 virtual void addDefault(MenuItem*);
45
46protected:
47 virtual void showEntry(MenuItem*);
48
49private:
50 list<MenuItem*> items;
51
52 MenuItem* defaultItem;
53
54 ostream& outputter;
55 string title;
56 char spacer;
57 int length;
58
59 bool quit;
60};
61
62#endif /* TEXTMENU_H_ */
Note: See TracBrowser for help on using the repository browser.