Diffpack Documentation


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

MenuSystem.h

Go to the documentation of this file.
00001 
00005 class MenuSystem : public HandleId
00006 
00007 {
00008 
00009   friend class PromptBase;
00010 
00011 private:
00012   void promptSequential ();
00013   
00014   Handle(PromptBase) parallel_prompt; 
00015 
00016 protected:
00017   VecSimplest(Handle(MenuLists)) menu_lists;  
00018   bool initialized;                           
00019 
00020   MenuAnswerTable table;
00021   bool disable_add_and_prompt;
00022   bool is_inside_multiple_loop;
00023   String command_prefix;
00024   String save_input_to_file;
00025 
00026   int ncomb;           
00027   int icomb;           
00028 
00029   String about_image;
00030   String about_text;
00031   int    about_width;
00032   int    about_height;
00033 
00034 public:
00035   MenuSystem ();
00036  ~MenuSystem ();
00037 
00038   void init (const String& description, const String& label);
00039 
00040   MenuItemBase* addItem
00041     (
00042            int       level,             
00043      const String&   command,           
00044      const String&   cl_option_string,  
00045      const String&   description,       
00046      const String&   default_answer,    
00047      const String&   valid_answer,      
00048            char      hot_key,           
00049            char      cl_option_char,    
00050            MenuCallBack* func = NULL    
00051     );
00052 
00053   MenuItemBase* addItem
00054     (
00055            int       level,             
00056      const String&   command,           
00057      const String&   cl_option_string,  
00058      const String&   description,       
00059      const String&   default_answer,    
00060      const String&   valid_answer,      
00061            MenuCallBack* func = NULL    
00062     );
00063 
00064   MenuItemBase* addItem                 
00065     (
00066            int       level,             
00067      const String&   command,           
00068      const String&   description,       
00069      const String&   default_answer     
00070     );
00071 
00072   bool addSubMenu
00073     (
00074            int     level,        
00075      const String& name_label,   
00076      const String& command,      
00077      const String& description,  
00078            char    hot_key       
00079     );
00080 
00081   bool addSubMenu
00082     (
00083            int     level,        
00084      const String& name_label,   
00085      const String& command,      
00086      const String& description   
00087     );
00088 
00089   bool addSubMenu (MenuSystem* menu); 
00090 
00091   bool disableIfEqual(String item_boss, String value, String item_disable);
00092 
00093   void forget ();
00094 
00095 #if defined(WIN32) && defined(MFCDP_MENUS)
00096   
00097   void reinitForNextRun();
00098 #endif
00099 
00100   void prompt(); 
00101 
00102   StringList answers;  
00103   void forceAnswer (const String& command_and_answer);
00104 
00105   String get (const String& command);
00106   void   set (const String& command, const String& value);
00107 
00108   void setAboutImage(const String& path) { about_image = path; }
00109   void setAboutText (const String& text) { about_text  = text; }
00110   void setAboutGeometry (int width, int height) 
00111     { about_width=width; about_height=height; }
00112 
00113   String getAboutImage()  const { return about_image;  }
00114   String getAboutText()   const { return about_text;   }
00115   int    getAboutWidth()  const { return about_width;  }
00116   int    getAboutHeight() const { return about_height; }
00117   
00118   void print4awk (Os os);        
00119 
00120   void multipleLoop (SimCase& user);
00121 
00122   bool insideMultipleLoop  () const { return is_inside_multiple_loop; }
00123   int getMultipleLoopLimit () const { return ncomb;                   }
00124   int getMultipleLoopIndex () const { return icomb;                   }
00125 
00126   void   setCommandPrefix (const String& prefix);
00127   void unsetCommandPrefix ();
00128   String getCommandPrefix () const;
00129 
00130   bool ok () const;
00131   bool empty () const;
00132 
00133   void writeHeadings4multipleAnswers (StringList& headings);
00134   void writeResults4multipleAnswers  (StringList& results);
00135   void writeExtendedResults4multipleAnswers (MultipleReporter& rep,
00136                                              int section_level = 1 /*0*/);
00137   static void makeSubMenuHeader
00138     (
00139            MenuSystem&  menu,
00140      const String&      description,
00141      const String&      command,
00142            int&         level,
00143            char         hot_key
00144     );
00145 
00146   String getDescription() const {return menu_lists(1)->description;}
00147   MenuItemBase* getFirstItem();
00148 
00149   
00150   void initParallelPrompt (const PromptBase& p) { parallel_prompt.rebind(p); }
00151   
00152 protected:
00153   
00154   void search4multipleAnswers (MenuAnswerTable& table);
00155 
00156   MenuLists* getMenuListsPtr();
00157   bool levelCheck(int level);
00158   
00159   
00160   
00161   SetDistinct(String) init_from_command_line_options;
00162   StringList          init_from_command_line_defaults;
00163   StringList          init_from_command_line_descriptions;
00164   StringList          init_from_command_line_vartypes;
00165 
00166 public:
00167 
00168 #if defined(WIN32) && defined(MFCDP_MENUS)
00169   MenuLists*  getMFCListsPtr();
00170 #endif
00171 
00172   bool initFromCommandLineArg
00173      (const char* option, real& number, real default_value,
00174       const char* description = NULL, const char* variable_type = NULL);
00175   bool initFromCommandLineArg
00176      (const char* option, int& number, int default_value,
00177       const char* description = NULL, const char* variable_type = NULL);
00178   bool initFromCommandLineArg
00179      (const char* option, bool& indicator, bool default_value,
00180       const char* description = NULL, const char* variable_type = NULL);
00181   bool initFromCommandLineArg
00182      (const char* option, String& string, const char* default_value,
00183       const char* description = NULL, const char* variable_type = NULL);
00184 };
00185 
00186 
00187 
00188 
00189 
00190 
00191 inline bool initFromCommandLineArg (const char* option, 
00192                                     real& number, 
00193                                     real default_value,
00194                                     const char* description = NULL, 
00195                                     const char* variable_type = NULL)
00196 { 
00197   return global_menu.initFromCommandLineArg (option, number, default_value,
00198                                              description, variable_type); 
00199 }
00200 
00201 inline bool initFromCommandLineArg (const char* option, 
00202                                     int& number, 
00203                                     int default_value,
00204                                     const char* description = NULL, 
00205                                     const char* variable_type = NULL)
00206 { 
00207   return global_menu.initFromCommandLineArg (option, number, default_value,
00208                                              description, variable_type); 
00209 }
00210 
00211 inline bool initFromCommandLineArg (const char* option,
00212                                     bool& indicator,
00213                                     bool default_value,
00214                                     const char* description = NULL,
00215                                     const char* variable_type = NULL)
00216 { 
00217   return global_menu.initFromCommandLineArg (option, indicator,
00218                                              default_value,
00219                                              description, variable_type);
00220 }
00221 
00222 inline bool initFromCommandLineArg (const char* option,
00223                                     String& string,
00224                                     const char* default_value,
00225                                     const char* description = NULL,
00226                                     const char* variable_type = NULL)
00227 { 
00228   return global_menu.initFromCommandLineArg (option, string, default_value,
00229                                              description, variable_type);
00230 }
00231 
00232 
00233 extern String validationString (const char** legal_names);  
00234 extern String validationString (const StringList& legal_names);
00235 
00236 ) 
00449        see documentation of the function
00450        "writeHeadings4multipleAnswers". The value of the menu items
00451        that are varied in a multiple loop is written in a separate
00452        section in the report. The extra argument "section_level"
00453        determines the level of the section; 0 means a section, and 1
00454        means a subsection. For stand-alone solvers, 1 is appropriate,
00455        while 0 is used when solvers are combined (system of PDEs),
00456        because then it is appropriate with a common section with the
00457        multiple loop parameters before each solver presents its
00458        specific part of the report.
00459 
00460 */
00461 

Copyright © 2003 inuTech GmbH. All rights reserved.