GlsMenu
1.5.4
|
#include <gls_menu_set.h>
Public Types | |
typedef MenuType_t | Menu_t |
Public Member Functions | |
GlsMenuSet_T (GlsMenuDictionary &data) | |
virtual | ~GlsMenuSet_T () |
Menu_t * | Current () const |
void | RegisterAction (const std::string &name, GlsMenuAction::ActionHandler_t *handler) |
void | SelectItem (const typename Menu_t::ItemId_t &itemId) |
virtual void | Show (const std::string &menuName="") |
virtual void | Read (std::istream &instr) |
void | Read (const std::string &filename) |
void | ReadMenuFiles (const std::string &directory, const std::string &ext="menu") |
void | Write (std::ostream &outstr) |
void | Write (const std::string &filename) |
Protected Attributes | |
GlsMenuAction::HandlerCont_t | _actionHandlers |
Handlers for menu actions local to an instance of a menu set. Each menu set can have its own set of action handlers. More... | |
GlsMenuDictionary | _menuStructure |
Menu structure attribute dictionary contains structure of menu. More... | |
GlsMenuDictionary & | _menuData |
Menu meta-data attribute dictionary contains variables and values. More... | |
std::string | _showMenuName |
Menu_t * | _currentMenu |
Currently displayed menu page. More... | |
GlsMenuHandlerGroup_T< Menu_t > * | _menus |
Set of all menus. More... | |
Private Member Functions | |
void | ShowMenu (std::istream &args) |
void | ToggleData (std::istream &args) const |
void | SetData (std::istream &args) const |
void | SetDataNoExpand (std::istream &args) const |
void | IncData (std::istream &args) const |
GlsMenuSet_T (const GlsMenuSet_T &) | |
GlsMenuSet_T & | operator= (const GlsMenuSet_T &) |
The GlsMenuSet_T class provides support for a set of menus. The MenuType template parameter should be a class derived from GlsMenu_T and explicitly defines the type of menus contained in the set. The DataFactory_t template parameter should be either the GlsMenuDataFactory class or a class derived from it. This will be used to create data items declared in the menu script files at run-time.
Definition at line 66 of file gls_menu_set.h.
typedef MenuType_t GlsMenuSet_T< MenuType_t, DataFactory_t >::Menu_t |
Definition at line 69 of file gls_menu_set.h.
|
inline |
Class constructor.
Definition at line 76 of file gls_menu_set.h.
References GlsMenuSet_T< MenuType_t, DataFactory_t >::_menuData, GlsMenuSet_T< MenuType_t, DataFactory_t >::_menus, GlsMenuSet_T< MenuType_t, DataFactory_t >::_menuStructure, GlsFunctor(), GlsMenuSet_T< MenuType_t, DataFactory_t >::IncData(), GlsMenuSet_T< MenuType_t, DataFactory_t >::RegisterAction(), GlsMenuSet_T< MenuType_t, DataFactory_t >::SetData(), GlsMenuSet_T< MenuType_t, DataFactory_t >::SetDataNoExpand(), GlsMenuSet_T< MenuType_t, DataFactory_t >::ShowMenu(), and GlsMenuSet_T< MenuType_t, DataFactory_t >::ToggleData().
|
inlinevirtual |
Class destructor.
Definition at line 127 of file gls_menu_set.h.
References GlsMenuSet_T< MenuType_t, DataFactory_t >::_actionHandlers.
|
private |
|
inline |
Return the current menu of the set.
Definition at line 149 of file gls_menu_set.h.
References GlsMenuSet_T< MenuType_t, DataFactory_t >::_currentMenu.
|
inlineprivate |
Increment meta-data value by some amount.
Definition at line 444 of file gls_menu_set.h.
References GetQuoted(), and GlsMenuData::Inc().
Referenced by GlsMenuSet_T< MenuType_t, DataFactory_t >::GlsMenuSet_T().
|
private |
|
inlinevirtual |
Read in the menu structure and behavior from a stream.
instr | input stream to read from. |
Reimplemented in GlsMFDMenuSet_T< MenuType_t, DataFactory_t >.
Definition at line 231 of file gls_menu_set.h.
References GlsMenuSet_T< MenuType_t, DataFactory_t >::_menuStructure.
Referenced by GlsMenuSet_T< MenuType_t, DataFactory_t >::Read(), and GlsMenuSet_T< MenuType_t, DataFactory_t >::ReadMenuFiles().
|
inline |
Read in the menu structure from a file.
filename | to read from. |
Definition at line 243 of file gls_menu_set.h.
References GlsMenuSet_T< MenuType_t, DataFactory_t >::Read().
|
inline |
Read in the menu structure and data attributes from all files within a particular directory.
directory | to read files from. |
ext | extension of menu files. |
Definition at line 268 of file gls_menu_set.h.
References GlsMenuSet_T< MenuType_t, DataFactory_t >::Read().
|
inline |
Register a handler for a specific action local to this menu set. If a handler for an action is not found in the local handlers, a handler will be searched for in the global handler list. Local action names should be unique or else the handler will be replaced by each subsequent call.
name | action name |
handler | handler for the action |
Definition at line 163 of file gls_menu_set.h.
References GlsMenuSet_T< MenuType_t, DataFactory_t >::_actionHandlers.
Referenced by GlsMenuSet_T< MenuType_t, DataFactory_t >::GlsMenuSet_T().
|
inline |
Handle selection of one of the menu items on the current menu.
itemId | id of the menu item. |
Definition at line 177 of file gls_menu_set.h.
References GlsMenuSet_T< MenuType_t, DataFactory_t >::_currentMenu.
|
inlineprivate |
Set meta-data value to a value.
Definition at line 408 of file gls_menu_set.h.
References GetQuoted().
Referenced by GlsMenuSet_T< MenuType_t, DataFactory_t >::GlsMenuSet_T().
|
inlineprivate |
Set meta-data value to a value, but don't expand the value first.
Definition at line 426 of file gls_menu_set.h.
References GetQuoted().
Referenced by GlsMenuSet_T< MenuType_t, DataFactory_t >::GlsMenuSet_T().
|
inlinevirtual |
Change the currently displayed menu.
menuName | name of the desired menu to show. |
Definition at line 190 of file gls_menu_set.h.
References GlsMenuSet_T< MenuType_t, DataFactory_t >::_currentMenu, GlsMenuSet_T< MenuType_t, DataFactory_t >::_menus, GlsMenuSet_T< MenuType_t, DataFactory_t >::_showMenuName, and GlsMenuHandlerGroup_T< T >::Item().
Referenced by GlsMenuSet_T< MenuType_t, DataFactory_t >::ShowMenu().
|
inlineprivate |
Menu action to Show a particular menu page.
Definition at line 372 of file gls_menu_set.h.
References GlsMenuSet_T< MenuType_t, DataFactory_t >::Show().
Referenced by GlsMenuSet_T< MenuType_t, DataFactory_t >::GlsMenuSet_T().
|
inlineprivate |
Toggle meta-data value between two options.
Definition at line 384 of file gls_menu_set.h.
References GetQuoted().
Referenced by GlsMenuSet_T< MenuType_t, DataFactory_t >::GlsMenuSet_T().
|
inline |
Write out the menu structure and behavior to a stream.
outstr | output stream to write to. |
Definition at line 316 of file gls_menu_set.h.
References GlsMenuSet_T< MenuType_t, DataFactory_t >::_menuStructure.
Referenced by GlsMenuSet_T< MenuType_t, DataFactory_t >::Write().
|
inline |
Write out the menu structure and behavior to file.
outstr | output stream to write to. |
Definition at line 328 of file gls_menu_set.h.
References GlsMenuSet_T< MenuType_t, DataFactory_t >::Write().
|
protected |
Handlers for menu actions local to an instance of a menu set. Each menu set can have its own set of action handlers.
Definition at line 350 of file gls_menu_set.h.
Referenced by GlsMenuSet_T< MenuType_t, DataFactory_t >::RegisterAction(), and GlsMenuSet_T< MenuType_t, DataFactory_t >::~GlsMenuSet_T().
|
protected |
Currently displayed menu page.
Definition at line 361 of file gls_menu_set.h.
Referenced by GlsMenuSet_T< MenuType_t, DataFactory_t >::Current(), GlsMenuSet_T< MenuType_t, DataFactory_t >::SelectItem(), and GlsMenuSet_T< MenuType_t, DataFactory_t >::Show().
|
protected |
Menu meta-data attribute dictionary contains variables and values.
Definition at line 356 of file gls_menu_set.h.
Referenced by GlsMenuSet_T< MenuType_t, DataFactory_t >::GlsMenuSet_T().
|
protected |
Set of all menus.
Definition at line 364 of file gls_menu_set.h.
Referenced by GlsMenuSet_T< MenuType_t, DataFactory_t >::GlsMenuSet_T(), and GlsMenuSet_T< MenuType_t, DataFactory_t >::Show().
|
protected |
Menu structure attribute dictionary contains structure of menu.
Definition at line 353 of file gls_menu_set.h.
Referenced by GlsMenuSet_T< MenuType_t, DataFactory_t >::GlsMenuSet_T(), GlsMFDMenuSet_T< MenuType_t, DataFactory_t >::Read(), GlsMenuSet_T< MenuType_t, DataFactory_t >::Read(), and GlsMenuSet_T< MenuType_t, DataFactory_t >::Write().
|
protected |
Definition at line 358 of file gls_menu_set.h.
Referenced by GlsMenuSet_T< MenuType_t, DataFactory_t >::Show().