GlsMenu  1.5.4
GlsMenuItemState Class Reference

#include <gls_menu_item.h>

Inheritance diagram for GlsMenuItemState:
GlsMenuDataGroup GlsMenuData

Public Member Functions

 GlsMenuItemState (const std::string &label, GlsMenuDictionary &dataDict, GlsMenuAction::HandlerCont_t &actionHandlers)
 
virtual ~GlsMenuItemState ()
 
virtual bool Active () const
 
const disti::glsColor & Color () const
 
virtual std::string Label () const
 
virtual bool Visible () const
 
virtual void Select ()
 
void CheckTimers ()
 
const GlsMenuDictionaryAttributes () const
 
virtual std::istream & ReadValue (std::istream &instr)
 
virtual std::ostream & WriteValue (std::ostream &outstr)
 
virtual void Inc (long amount=1)
 

Protected Attributes

GlsMenuActionGroup_actions
 Actions to execute when the menu item state is selected. More...
 
GlsBoolExpression _active
 Whether the state is active or not. More...
 
std::string _colorName
 Current color name of the menu item state. More...
 
GlsBoolExpression _visible
 Visibility of the menu item state. More...
 
GlsMenuDictionary_dataDict
 Meta-data dictionary used for expanding the values of variables. More...
 
GlsMenuHandlerGroup_T< GlsMenuTimer > * _timers
 Container of timers associated with the state. More...
 
GlsMenuDictionary _attr
 The dictionary of attributes for the group attribute. More...
 

Detailed Description

This class provides a base class menu item state. A menu item will be composed of one or more menu item states. This class contains those attributes that would be most common among menu items, such as visibility, color, and active. It also contains the actions that occur when an item is selected or chosen and timer events triggered upon the selection.

All state attributes support variable meta-data values, eg. the name of a meta-data attribute surrounded by $(). So, for example, if the value of _color is the current value of the meta-data variable TSD_Color will be looked up in a data dictionary and this will be the current value of _color.

The _active and _visible attributes support simple true and false values but also boolean expressions containing meta-data variables. Please see the GlsBooleanExpression class for an explanation. An example value for _visible would be:

   $(MFD_TopLevelMenu) != IDM && $(MFD_TopLevelMenu) != TSD

Definition at line 79 of file gls_menu_item.h.

Constructor & Destructor Documentation

GlsMenuItemState::GlsMenuItemState ( const std::string &  label,
GlsMenuDictionary dataDict,
GlsMenuAction::HandlerCont_t actionHandlers 
)

Class constructor.

Parameters
labelthe label of the menu item state
dataDictthe meta-data dictionary used for looking up the values of variables. This is passed on to the state's attributes.
actionHandlersThese are handlers for menu actions passed in by the menu item. These are considered local to the menu set and are handlers for menu actions and timer actions.
virtual GlsMenuItemState::~GlsMenuItemState ( )
virtual

Class destructor.

Member Function Documentation

virtual bool GlsMenuItemState::Active ( ) const
inlinevirtual

Returns whether the menu item state is active or not.

Definition at line 111 of file gls_menu_item.h.

References _active.

const GlsMenuDictionary& GlsMenuDataGroup::Attributes ( ) const
inlineinherited

Read attribute dictionary from an input stream.

Parameters
instrinput stream to read value from.

Definition at line 78 of file gls_menu_data_group.h.

References GlsMenuDataGroup::_attr.

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

void GlsMenuItemState::CheckTimers ( )

Check all associated timers for expiration and invoke their callbacks if so. This should be called on a cyclical basis by the menu item owning this state.

const disti::glsColor& GlsMenuItemState::Color ( ) const

Returns the current color of the menu item state.

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().

virtual std::string GlsMenuItemState::Label ( ) const
virtual

Returns the current label of the menu item state.

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

Read attribute dictionary from an input stream.

Parameters
instrinput stream to read value from.

Reimplemented in GlsMFDMenu_T< MenuItem_t, Submenu_t, PageId_t >, and GlsMenuDynDataGroup.

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

virtual void GlsMenuItemState::Select ( )
virtual

Notifies the menu item state that it has been selected and to invoke the associated actions (callbacks) and start all associated timers. A menu item should call this on its current state in response to some event, eg. menu item selection.

virtual bool GlsMenuItemState::Visible ( ) const
inlinevirtual

Returns the current visibility of the menu item state.

Definition at line 132 of file gls_menu_item.h.

References _visible.

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

GlsMenuActionGroup* GlsMenuItemState::_actions
protected

Actions to execute when the menu item state is selected.

Definition at line 155 of file gls_menu_item.h.

GlsBoolExpression GlsMenuItemState::_active
protected

Whether the state is active or not.

Definition at line 158 of file gls_menu_item.h.

Referenced by Active().

std::string GlsMenuItemState::_colorName
protected

Current color name of the menu item state.

Definition at line 161 of file gls_menu_item.h.

GlsMenuDictionary& GlsMenuItemState::_dataDict
protected

Meta-data dictionary used for expanding the values of variables.

Definition at line 167 of file gls_menu_item.h.

GlsMenuHandlerGroup_T<GlsMenuTimer>* GlsMenuItemState::_timers
protected

Container of timers associated with the state.

Definition at line 170 of file gls_menu_item.h.

GlsBoolExpression GlsMenuItemState::_visible
protected

Visibility of the menu item state.

Definition at line 164 of file gls_menu_item.h.

Referenced by Visible().


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