GlsMenu
GlsMenuItem_T< State_t > Class Template Reference

#include <gls_menu_item.h>

Inheritance diagram for GlsMenuItem_T< State_t >:
GlsMenuHandlerGroup_T< State_t > GlsMenuDynDataGroup GlsMenuDataGroup GlsMenuData

Public Types

typedef GlsMenuHandlerGroup_T< State_t > BaseClass
 

Public Member Functions

 GlsMenuItem_T (const std::string &name, GlsMenuDictionary &dataDict, GlsMenuAction::HandlerCont_t &actionHandlers)
 
virtual ~GlsMenuItem_T ()
 
State_t * State ()
 
void Select ()
 
State_t * Item (const std::string &name) const
 
virtual std::istream & ReadValue (std::istream &instr)
 
const GlsMenuDictionaryAttributes () const
 
virtual std::ostream & WriteValue (std::ostream &outstr)
 
virtual void Inc (long amount=1)
 

Protected Member Functions

virtual GlsMenuDataCreateDataItem (const std::string &name) const
 

Protected Attributes

State_t * _currentState
 
GlsMenuDictionary_dataDict
 Data dictionary to pass to items created in the group. This is the dictionary used to evaluate menu data variables. More...
 
GlsMenuAction::HandlerCont_t_handlers
 
bool _uniqueKeys
 Specifies whether attribute names should be unique or not. More...
 
GlsMenuDictionary _attr
 The dictionary of attributes for the group attribute. More...
 

Detailed Description

template<class State_t>
class GlsMenuItem_T< State_t >

This provides the functionality of a menu item. A menu item can contain one or more states that are visible at different instances. The current state is the first one found that is currently visible.

The class is templatized so that users can provide their own extended menu item state class as the states of the menu item. The State_t template parameter must be a class derived from GlsMenuItemState.

Definition at line 193 of file gls_menu_item.h.

Member Typedef Documentation

template<class State_t >
typedef GlsMenuHandlerGroup_T<State_t> GlsMenuItem_T< State_t >::BaseClass

Definition at line 196 of file gls_menu_item.h.

Constructor & Destructor Documentation

template<class State_t >
GlsMenuItem_T< State_t >::GlsMenuItem_T ( const std::string &  name,
GlsMenuDictionary dataDict,
GlsMenuAction::HandlerCont_t actionHandlers 
)
inline

Class constructor.

Parameters
namename of menu item. This usually refers to a location of an item, as the states of the item can contain different labels.
dataDictthe meta-data dictionary used for looking up the values of variables. This is passed on to the item's states when they are created for them to use.
actionHandlersThese are handlers for menu actions passed in by the creator. These are considered local to the menu set.

Definition at line 212 of file gls_menu_item.h.

template<class State_t >
virtual GlsMenuItem_T< State_t >::~GlsMenuItem_T ( )
inlinevirtual

Class destructor.

Definition at line 226 of file gls_menu_item.h.

Member Function Documentation

const GlsMenuDictionary& GlsMenuDataGroup::Attributes ( ) const
inlineinherited

Read attribute dictionary from an input stream.

Parameters
instrinput stream to read value from.

Definition at line 80 of file gls_menu_data_group.h.

References GlsMenuDataGroup::_attr.

Referenced by GlsMFDMenu_T< MenuItem_t, Submenu_t, PageId_t >::ReadValue().

virtual GlsMenuData* GlsMenuHandlerGroup_T< State_t >::CreateDataItem ( const std::string &  name) const
inlineprotectedvirtualinherited

Create a new instance of our particular data item type. In this case, it is an menu item that will accept action handlers, since it or one of its components will handle actions.

Parameters
namename of the data item.
Returns
a pointer to the item or 0 if the item cannot be created.

Implements GlsMenuDynDataGroup.

Definition at line 331 of file gls_menu_data_group.h.

virtual void GlsMenuData::Inc ( long  amount = 1)
virtualinherited

Increment the data item. Derived classes must override this as the default is a no-op.

Reimplemented in GlsMenuDiscrete_T< T >.

Referenced by GlsMenuSet_T< MenuType_t, DataFactory_t >::IncData().

State_t * GlsMenuHandlerGroup_T< State_t >::Item ( const std::string &  name) const
inlineinherited

Gain access to a particular meta-data item within the group.

Parameters
namename of the meta-data item.
Returns
a pointer to the item or 0 if the item does not exist within the group.

Definition at line 305 of file gls_menu_data_group.h.

virtual std::istream& GlsMenuDynDataGroup::ReadValue ( std::istream &  instr)
virtualinherited

Read attribute dictionary from an input stream.

Parameters
instrinput stream to read value from.

Reimplemented from GlsMenuDataGroup.

template<class State_t >
void GlsMenuItem_T< State_t >::Select ( )
inline

The menu item has been selected, so notify the current state, if any, that it has been selected. This should activate all callbacks.

Definition at line 267 of file gls_menu_item.h.

References GlsMenuItem_T< State_t >::_currentState.

template<class State_t >
State_t* GlsMenuItem_T< State_t >::State ( )
inline

Returns the current state of the menu item and checks the timers of all its menu item states. This should be called on a cyclical basis if the timer mechanism is to work properly. This should be used to update the state of the menu item on some display. The state should determine how the item looks on the display.

Definition at line 237 of file gls_menu_item.h.

References GlsMenuDataGroup::_attr, and GlsMenuItem_T< State_t >::_currentState.

virtual std::ostream& GlsMenuDataGroup::WriteValue ( std::ostream &  outstr)
virtualinherited

Read attribute dictionary from an input stream.

Parameters
instrinput stream to read value from.

Field Documentation

template<class State_t >
State_t* GlsMenuItem_T< State_t >::_currentState
protected
GlsMenuDictionary& GlsMenuHandlerGroup_T< State_t >::_dataDict
protectedinherited

Data dictionary to pass to items created in the group. This is the dictionary used to evaluate menu data variables.

Definition at line 314 of file gls_menu_data_group.h.

GlsMenuAction::HandlerCont_t& GlsMenuHandlerGroup_T< State_t >::_handlers
protectedinherited

Definition at line 318 of file gls_menu_data_group.h.

bool GlsMenuDynDataGroup::_uniqueKeys
protectedinherited

Specifies whether attribute names should be unique or not.

Definition at line 157 of file gls_menu_data_group.h.


The documentation for this class was generated from the following file: