Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

KeyMenu Class Reference

An Interactor that provides a menu of operations that can be triggered by pressing a single key on the keyboard. More...

#include <key_menu.H>

Inheritance diagram for KeyMenu:

Inheritance graph
[legend]
Collaboration diagram for KeyMenu:

Collaboration graph
[legend]
List of all members.

Public Types

typedef int(* key_callback_t )(const Event &, State *&)
typedef CallMeth_t< KeyMenu,
Event
_callb
typedef GuardMeth_t< KeyMenu,
Event
_guard

Public Member Functions

 KeyMenu (State *start_in)
void add_menu_item (char key, const std::string &desc, key_callback_t cb)
 Add a single key/operation pair to the menu.
void add_menu_item (const char *keys, const std::string &desc, key_callback_t cb)
 Add multiple keys all with the same operation and description.
void remove_menu_item (char key)
 Remove a single key/operation pair from the menu.
void remove_menu_item (const char *keys)
 Remove multiple key/operation pairs from the menu.
std::string get_item_desc (char key)
 Get the description for the supplied key.
void display_menu (std::ostream &out)
 Display the menu to the supplied output stream.
_callbCb (TYPENAME _callb::_method m)
_callbCb (TYPENAME _callb::_method m, State_t< Event > *s)
_guardGd (const Event &e, TYPENAME _guard::_method m)
Stateentry ()
const Stateentry () const

Protected Attributes

State _entry

Private Attributes

Statestart
State button_down
std::vector< KeyMenuItemmenu_items

Detailed Description

An Interactor that provides a menu of operations that can be triggered by pressing a single key on the keyboard.

Each key/operation pair also has a corresponding description so that the menu can be displayed to a standard output stream.

Definition at line 29 of file key_menu.H.


Member Typedef Documentation

typedef CallMeth_t<KeyMenu ,Event > Interactor< KeyMenu , Event , State >::_callb [inherited]
 

Definition at line 388 of file fsa.H.

typedef GuardMeth_t<KeyMenu ,Event > Interactor< KeyMenu , Event , State >::_guard [inherited]
 

Definition at line 389 of file fsa.H.

typedef int(* KeyMenu::key_callback_t)(const Event &, State *&)
 

Definition at line 33 of file key_menu.H.


Constructor & Destructor Documentation

KeyMenu::KeyMenu State start_in  ) 
 

Parameters:
[in] start_in The FSA State where keyboard events will originate from.

Definition at line 38 of file key_menu.C.


Member Function Documentation

void KeyMenu::add_menu_item const char *  keys,
const std::string desc,
key_callback_t  cb
 

Add multiple keys all with the same operation and description.

void KeyMenu::add_menu_item char  key,
const std::string desc,
key_callback_t  cb
 

Add a single key/operation pair to the menu.

Referenced by TestSPSapp::init_kbd(), SMVIEWapp::init_kbd(), and BaseJOTapp::init_kbd().

_callb* Interactor< KeyMenu , Event , State >::Cb TYPENAME _callb::_method  m,
State_t< Event > *  s
[inline, inherited]
 

Definition at line 396 of file fsa.H.

_callb* Interactor< KeyMenu , Event , State >::Cb TYPENAME _callb::_method  m  )  [inline, inherited]
 

Definition at line 393 of file fsa.H.

void KeyMenu::display_menu std::ostream &  out  ) 
 

Display the menu to the supplied output stream.

Referenced by BaseJOTapp::keymenu_help_cb().

const State * Interactor< KeyMenu , Event , State >::entry  )  const [inline, inherited]
 

Definition at line 403 of file fsa.H.

References Interactor< T, EVENT, STATE >::_entry.

State * Interactor< KeyMenu , Event , State >::entry  )  [inline, inherited]
 

Definition at line 402 of file fsa.H.

References Interactor< T, EVENT, STATE >::_entry.

_guard* Interactor< KeyMenu , Event , State >::Gd const Event e,
TYPENAME _guard::_method  m
[inline, inherited]
 

Definition at line 399 of file fsa.H.

std::string KeyMenu::get_item_desc char  key  ) 
 

Get the description for the supplied key.

Parameters:
[in] key Character representing the key to get the description for.
Returns:
The description of the supplied key if it is in the menu and the empty string otherwise.

Definition at line 170 of file key_menu.C.

References menu_items.

void KeyMenu::remove_menu_item const char *  keys  ) 
 

Remove multiple key/operation pairs from the menu.

Parameters:
[in] keys String of characters representing the keys to remove from the menu.

Definition at line 150 of file key_menu.C.

References remove_menu_item().

void KeyMenu::remove_menu_item char  key  ) 
 

Remove a single key/operation pair from the menu.

Parameters:
[in] key Character representing the key to remove from the menu.
Note:
This function does nothing if key is not already in the menu.

Definition at line 114 of file key_menu.C.

References KEYD, menu_items, and start.

Referenced by remove_menu_item().


Member Data Documentation

State Interactor< KeyMenu , Event , State >::_entry [protected, inherited]
 

Definition at line 407 of file fsa.H.

State KeyMenu::button_down [private]
 

Definition at line 56 of file key_menu.H.

std::vector<KeyMenuItem> KeyMenu::menu_items [private]
 

Definition at line 58 of file key_menu.H.

Referenced by get_item_desc(), and remove_menu_item().

State* KeyMenu::start [private]
 

Definition at line 55 of file key_menu.H.

Referenced by remove_menu_item().


The documentation for this class was generated from the following files:
Generated on Mon Sep 18 11:46:20 2006 for jot by  doxygen 1.4.4