Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
vgui_mfc_utils Class Reference

MFC support for menus. More...

#include <vgui_mfc_utils.h>

List of all members.

Public Member Functions

 vgui_mfc_utils ()
 Constructor.
 ~vgui_mfc_utils ()
 Destructor.
HMENU add_submenu (const vgui_menu &menu)
 Create a MFC sub-menu from the given vgui_menu.
void set_menu (const vgui_menu &menu)
 Sets the menu of the application window.
CMenu * set_popup_menu (const vgui_menu &menu)
 Create popup menu.
void delete_last_popup_menu_callbacks ()
 Delete the callback functions from the last popup menu.
virtual void menu_dispatcher (UINT nID)
 Called within message service routine of vgui_mfc_mainfrm.

Static Public Member Functions

static vgui_mfc_utilsinstance ()
 (Create if necessary and) return singleton instance of this class.

Public Attributes

HACCEL AccelTable
 Menu accelerator table - this defines menu shortcuts.

Private Member Functions

void add_menu_accelerator (const vgui_menu_item item, const WORD function_id, vcl_string &the_menu_name)
 Add keyboard shortcut for this menu item to accelerator table (accels).

Private Attributes

int item_count
 Number of menu items.
vcl_vector< vgui_command * > callbacks
 List of commands to be called by menus.
vcl_vector< ACCEL > accels
 List of menu accelerators.
vcl_vector< CMenu * > menus_to_be_deleted
 List of menus to be deleted when we are finished:.
bool first_popup
 first time a popup menu was created.
int last_item_count
 last item_count before a popup menu is created.

Detailed Description

MFC support for menus.

Only one instance of the class is allowed

Definition at line 35 of file vgui_mfc_utils.h.


Constructor & Destructor Documentation

vgui_mfc_utils::vgui_mfc_utils ( ) [inline]

Constructor.

Definition at line 54 of file vgui_mfc_utils.h.

vgui_mfc_utils::~vgui_mfc_utils ( )

Destructor.

Definition at line 42 of file vgui_mfc_utils.cxx.


Member Function Documentation

void vgui_mfc_utils::add_menu_accelerator ( const vgui_menu_item  menu_item,
const WORD  function_id,
vcl_string &  the_menu_name 
) [private]

Add keyboard shortcut for this menu item to accelerator table (accels).

Add keyboard shortcut for this menu item to our accelerator table (accels).

Also add text to the_menu_name for the shortcut.

Definition at line 50 of file vgui_mfc_utils.cxx.

HMENU vgui_mfc_utils::add_submenu ( const vgui_menu menu)

Create a MFC sub-menu from the given vgui_menu.

Definition at line 80 of file vgui_mfc_utils.cxx.

void vgui_mfc_utils::delete_last_popup_menu_callbacks ( )

Delete the callback functions from the last popup menu.

Definition at line 221 of file vgui_mfc_utils.cxx.

vgui_mfc_utils * vgui_mfc_utils::instance ( ) [static]

(Create if necessary and) return singleton instance of this class.

Definition at line 35 of file vgui_mfc_utils.cxx.

void vgui_mfc_utils::menu_dispatcher ( UINT  nID) [virtual]

Called within message service routine of vgui_mfc_mainfrm.

Definition at line 26 of file vgui_mfc_utils.cxx.

void vgui_mfc_utils::set_menu ( const vgui_menu menu)

Sets the menu of the application window.

Definition at line 121 of file vgui_mfc_utils.cxx.

CMenu * vgui_mfc_utils::set_popup_menu ( const vgui_menu menu)

Create popup menu.

Make sure to call delete after its use otherwise MLK!!!

Definition at line 172 of file vgui_mfc_utils.cxx.


Member Data Documentation

vcl_vector<ACCEL> vgui_mfc_utils::accels [private]

List of menu accelerators.

Definition at line 44 of file vgui_mfc_utils.h.

Menu accelerator table - this defines menu shortcuts.

Definition at line 75 of file vgui_mfc_utils.h.

vcl_vector<vgui_command *> vgui_mfc_utils::callbacks [private]

List of commands to be called by menus.

Definition at line 41 of file vgui_mfc_utils.h.

first time a popup menu was created.

Definition at line 82 of file vgui_mfc_utils.h.

Number of menu items.

Definition at line 38 of file vgui_mfc_utils.h.

last item_count before a popup menu is created.

Definition at line 85 of file vgui_mfc_utils.h.

vcl_vector<CMenu*> vgui_mfc_utils::menus_to_be_deleted [private]

List of menus to be deleted when we are finished:.

Definition at line 79 of file vgui_mfc_utils.h.


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