Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

menu.h

Go to the documentation of this file.
00001 /***************************************************************************************************
00002 *****           Copyright (C) 2005  John Schneiderman <JohnMS@member.fsf.org>                  *****
00003 *****                                                                                          *****
00004 *****           This program is free software; you can redistribute it and/or modify           *****
00005 *****           it under the terms of the GNU General Public License as published by           *****
00006 *****           the Free Software Foundation; either version 2 of the License, or              *****
00007 *****           (at your option) any later version.                                            *****
00008 *****                                                                                          *****
00009 *****           This program is distributed in the hope that it will be useful,                *****
00010 *****           but WITHOUT ANY WARRANTY; without even the implied warranty of                 *****
00011 *****           MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                  *****
00012 *****           GNU General Public License for more details.                                   *****
00013 *****                                                                                          *****
00014 *****           You should have received a copy of the GNU General Public License              *****
00015 *****           along with this program; if not, write to the Free Software                    *****
00016 *****           Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA     *****
00017 ***************************************************************************************************/
00018 #ifndef MENU_H
00019 #define MENU_H
00020 
00021 #include <string>
00022 using std::string;
00023 #include <vector>
00024 using std::vector;
00025 
00031 class Menu
00032 {
00033 public:
00035     static const int MENU_EXIT=-100;
00036 
00043     Menu(const string &title, const string &prompt);
00048     void addMenuItem(const string &menuItem);
00054     int menuItem(const string &menuItem) const;
00059     void setFeedback(const string &feedback);
00064     void draw() const;
00069     int selectMenuItem() const;
00070 
00071 private:
00073     static const int MAX_WIDTH=80;
00075     static const int MENU_ITEM_SPACERS=5;
00077     static const string DEFAULT_MESSAGE;
00078 
00080     string m_title;
00082     string m_prompt;
00084     string m_clearScreen;
00086     mutable string m_feedback;
00088     char m_menuChar;
00090     vector<string> m_menuItems;
00091 };
00092 #endif

Generated on Tue Mar 28 23:28:03 2006 for ClusterSim by  doxygen 1.4.4