Diffpack Documentation


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

MenuLists Class Reference

Menu class object with a list of items. More...

#include <MenuLists.h>

Inheritance diagram for MenuLists::

HandleId List of all members.

Public Methods

 MenuLists ()
 MenuLists (const String &description, const String &prompt)
virtual ~MenuLists ()
void initCommandLine ()
void setDescription (const String &description_, const String &label)
bool ok () const
bool empty () const
void setInputSource (InputSource source)
InputSource getInputSource ()
MenuItemBaseaddItem (const String &command, const String &cl_option_string, const String &description, const String &default_answer, const String &valid_answer, char hot_key, char cl_option_char, MenuCallBack *func=NULL)
bool addSubMenu (const String &command, const String &description, const char hot_key, MenuLists *menu)
bool addSubMenu (MenuLists *menu)
MenuItemBasegetItemPtr (const String &in_command, char inkey, bool sublevels=true)
MenuItemBasegetItemPtr (const char *cl_arg, char cl_char='\0')
String get (const String &in_command, bool sublevels=true)
void set (const String &in_command, const String &value, bool sublevels=true)
void print4awk (Os os)
void search4multipleAnswers (MenuAnswerTable &table)
String getDescription () const
String getPrompt () const
void prompt (Is in)
void printCommandList (Os out, bool sublevels=true)
void forget ()

Detailed Description

Menu class object with a list of items.

NAME: MenuLists - Menu class object with a list of items

DESCRIPTION:

The "MenuLists" object contains a single linked list of "MenuItemBase" objects defining the menu. Class "MenuItemBase" is implemented with two subclasses, "MenuField" and "MenuSub". The former represents standard menu items while the latter represents submenus. Class "MenuLists" is used by class "MenuSystem", and it is recommended that programmers use "MenuSystem" and not the lower level menu classes such as "MenuLists", "MenuItemBase", "MenuField" and "MenuSub". Hence there is only minor documentation of these classes. For class "MenuLists", most of the functions are documented in "MenuSystem".

DESIGN OF A MENU TREE:

     [MS] - object of class MenuSystem
     [Mn] - object of class MenuLists (n is a number)
  
     (P)  - object of class MenuField : MenuItemBase (also called Item !)
     (S)  - object of class MenuSub : MenuItemBase
  
     -->  - pointer to MenuItemBase object
  
     |
     v    - pointer to Menu object
  
  
     [M1] --> (P) --> (P) --> (S) --> (S) --> (P) --> NULL
                               |       |
                                      |
                                      
                               |       v
                               |      [M12] --> (P) --> (P) --> (P) --> NULL
                                     [M12] --> (P) --> (P) --> (P) --> NULL
                               |
                               v
                             [M11] --> (S) --> (P) --> (P) --> NULL
                                        |
                                        
                                        v
                                       [M111] --> (P) --> (S) --> NULL
                                                           |
                                                           v
                                                          [M1111] --> NULL
  
      This menu contains 4 levels of submenus, recommended max number of
      levels is 3, the maximum number of levels allowed of one MenuSystem
      is given by the variable MAXLEVELELS (currently 10).
  
      A global variabel MENULEVEL indicates current level of the most recent
      menu item.
  
      [MS] [0     1     2     3     4]
            |     |     |     |     |
            v     v     v     v     v
           [M1] [M11] [M12] [M1111] NULL
  
     An object of class MenuSystem contains an array of pointers to MenuLists
     objects. However, only the first element in this array is used when
     accessing the MenuLists functions - the submenus are automatically
     entered from a MenuSub object (note that the MenuSub objects have
     MenuLists* pointers to the submenu-list). The other elements of the array
     are only used when MenuSystem creates the menu list.


Constructor & Destructor Documentation

MenuLists::MenuLists ( )
 

There are two constructors, one accepting two "String" arguments "description" and "prompt". These string values are then used as the global description text for the current menu system and the string used to prompt the user when run in text-based modes. The second constructor uses standard values for these two text strings.

MenuLists::MenuLists ( const String & description,
const String & prompt )
 

See documentation of one of the overloaded constructor.

MenuLists::~MenuLists ( ) [virtual]
 


Member Function Documentation

MenuItemBase * MenuLists::addItem ( const String & command,
const String & cl_option_string,
const String & description,
const String & default_answer,
const String & valid_answer,
char hot_key,
char cl_option_char,
MenuCallBack * func = NULL )
 

bool MenuLists::addSubMenu ( MenuLists * menu )
 

bool MenuLists::addSubMenu ( const String & command,
const String & description,
const char hot_key,
MenuLists * menu )
 

bool MenuLists::empty ( ) const [inline]
 

void MenuLists::forget ( ) [inline]
 

String MenuLists::get ( const String & in_command,
bool sublevels = true )
 

String MenuLists::getDescription ( ) const [inline]
 

InputSource MenuLists::getInputSource ( ) [inline]
 

MenuItemBase * MenuLists::getItemPtr ( const char * cl_arg,
char cl_char = '\0' )
 

MenuItemBase * MenuLists::getItemPtr ( const String & in_command,
char inkey,
bool sublevels = true )
 

String MenuLists::getPrompt ( ) const [inline]
 

void MenuLists::initCommandLine ( )
 

bool MenuLists::ok ( ) const [inline]
 

void MenuLists::print4awk ( Os os )
 

void MenuLists::printCommandList ( Os out,
bool sublevels = true )
 

void MenuLists::prompt ( Is in )
 

void MenuLists::search4multipleAnswers ( MenuAnswerTable & table )
 

void MenuLists::set ( const String & in_command,
const String & value,
bool sublevels = true )
 

void MenuLists::setDescription ( const String & description_,
const String & label )
 

void MenuLists::setInputSource ( InputSource source ) [inline]
 


Friends And Related Function Documentation

class MenuSub [friend]
 

class MenuSystem [friend]
 

class PromptBase [friend]
 


The documentation for this class was generated from the following file:
Copyright © 2003 inuTech GmbH. All rights reserved.