Diffpack Documentation


Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

MenuLists.h

Go to the documentation of this file.
00001 
00005 class MenuLists : public virtual HandleId
00006 
00007 {
00008   friend class MenuSub;
00009   friend class MenuSystem;
00010   friend class PromptBase;
00011 
00012 private:
00013   String description;   
00014   String prompttext;    
00015 
00016   enum InputSource  input_source; 
00017 
00018   static int logfileSet;
00019   static Os logfile;    
00020 
00021   Handle(MenuItemBase) itemlist;  
00022   Handle(MenuItemBase) lastitem;  
00023   Handle(MenuItemBase) virtual_first; 
00024                                       
00025 public:
00026   MenuLists ();
00027 
00028   
00029 
00030   MenuLists
00031     (
00032      const String& description,
00033      const String& prompt
00034     );
00035 
00036   virtual ~MenuLists ();
00037 
00038   void initCommandLine();
00039 
00040   void setDescription (const String& description_, const String& label);
00041 
00042   
00043   bool ok () const   { return (itemlist.ok());         }
00044   bool empty() const { return getbool(!itemlist.ok()); }
00045 
00046 
00047   void        setInputSource (InputSource source) { input_source = source; }
00048   InputSource getInputSource()                    { return input_source;   }
00049 
00050   MenuItemBase* addItem
00051     (
00052      const String&       command,
00053      const String&       cl_option_string,
00054      const String&       description,
00055      const String&       default_answer,
00056      const String&       valid_answer,
00057            char          hot_key,
00058            char          cl_option_char,
00059            MenuCallBack* func = NULL
00060     );
00061 
00062   bool addSubMenu
00063     (
00064      const String&    command,
00065      const String&    description,
00066      const char       hot_key,
00067            MenuLists* menu
00068     );
00069 
00070   bool addSubMenu(MenuLists* menu);
00071 
00072 
00073   
00074 
00075   MenuItemBase* getItemPtr
00076     (
00077      const String& in_command,
00078            char    inkey,
00079            bool sublevels = true
00080     );
00081 
00082   MenuItemBase* getItemPtr
00083     (
00084      const char* cl_arg,
00085            char  cl_char = '\0'
00086     );
00087 
00088   String get (const String& in_command, bool sublevels = true);
00089   void   set (const String& in_command, const String& value,
00090               bool sublevels = true);
00091 
00092   void print4awk (Os os);
00093   void search4multipleAnswers (MenuAnswerTable& table);
00094 
00095   String getDescription() const { return description; }
00096 
00097   String getPrompt() const      { return prompttext;  }
00098 
00099 
00100   
00101   void prompt (Is in);
00102   void printCommandList (Os out, bool sublevels = true );
00103 
00104   void forget() { virtual_first.rebind(NULL); }
00105 
00106 #if defined(WIN32) && defined(MFCDP_MENUS)
00107   bool MFC_itemlist_OK()          { return itemlist.ok(); }
00108   MenuItemBase* getMFCItemList()  { return itemlist.getPtr(); }
00109 #endif
00110 
00111 
00112 private:
00113   void help (const String& input);
00114   void file (const char* filename);
00115   void log (const String& filename); 
00116   void quit (Is in);
00117   void quitOk (Is in);
00118   bool check_Is_cin (Is in);    
00119 
00120   void promptStream (Is in, bool interactive);
00121   void promptQuestion ();
00122   void promptCommandLine ();
00123 
00124   CLASS_INFO
00125 };
00126 
00127 

Copyright © 2003 inuTech GmbH. All rights reserved.