GlsMenu
1.5.4
|
#include <gls_menu_item.h>
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 GlsMenuDictionary & | Attributes () 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... | |
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.
GlsMenuItemState::GlsMenuItemState | ( | const std::string & | label, |
GlsMenuDictionary & | dataDict, | ||
GlsMenuAction::HandlerCont_t & | actionHandlers | ||
) |
Class constructor.
label | the label of the menu item state |
dataDict | the meta-data dictionary used for looking up the values of variables. This is passed on to the state's attributes. |
actionHandlers | These 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 |
Class destructor.
|
inlinevirtual |
Returns whether the menu item state is active or not.
Definition at line 111 of file gls_menu_item.h.
References _active.
|
inlineinherited |
Read attribute dictionary from an input stream.
instr | input 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.
|
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 |
Returns the current label of the menu item state.
|
virtualinherited |
Read attribute dictionary from an input stream.
instr | input 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 |
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.
|
inlinevirtual |
Returns the current visibility of the menu item state.
Definition at line 132 of file gls_menu_item.h.
References _visible.
|
virtualinherited |
Read attribute dictionary from an input stream.
instr | input stream to read value from. |
|
protected |
Actions to execute when the menu item state is selected.
Definition at line 155 of file gls_menu_item.h.
|
protected |
Whether the state is active or not.
Definition at line 158 of file gls_menu_item.h.
Referenced by Active().
|
protectedinherited |
The dictionary of attributes for the group attribute.
Definition at line 100 of file gls_menu_data_group.h.
Referenced by GlsMenuDataGroup::Attributes(), GlsMenu_T< MenuItem_t, GlsMFD::MenuItemId_t >::GlsMenu_T(), GlsMFDMenu_T< MenuItem_t, Submenu_t, PageId_t >::GlsMFDMenu_T(), GlsMFDSubmenu_T< MenuItemId_t >::GlsMFDSubmenu_T(), GlsMenuDataGroup_T< T >::Item(), GlsMenuHandlerGroup_T< Menu_t >::Item(), GlsMFDMenu_T< MenuItem_t, Submenu_t, PageId_t >::ReadValue(), and GlsMenuItem_T< State_t >::State().
|
protected |
Current color name of the menu item state.
Definition at line 161 of file gls_menu_item.h.
|
protected |
Meta-data dictionary used for expanding the values of variables.
Definition at line 167 of file gls_menu_item.h.
|
protected |
Container of timers associated with the state.
Definition at line 170 of file gls_menu_item.h.
|
protected |
Visibility of the menu item state.
Definition at line 164 of file gls_menu_item.h.
Referenced by Visible().