Humble Framework for SkyOS


Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

HMenu Class Reference
[Graphical User Interface]

#include <HMenu.h>

Inheritance diagram for HMenu:

HWidget HID HObjNoCopy HObj HMenuBar

Detailed Description

A menu class that provides all of the basic menu functionality, including adding items, enabling/disabling items, and managing a "menu bar". Each menu keeps a ptr to the underlying widget_menu structure, as well as a map of widget_menu_item ptrs and their commands. This map is used to find the menu item that corresponds to each command, so that it can be enabled, etc.

Definition at line 32 of file HMenu.h.

Public Member Functions

 HMenu (int32 id=0)
ErrCode AddItem (int32 nCmd, StringPtr pstrLabel, uint32 uFlags=0, bool bEnabled=true)
 Adds a new item to the menu.
ErrCode AddSeparator (void)
 Adds a separator to the current menu.
ErrCode Create (int32 nID, HANDLE hWnd=NULL)
 Create a new menu.
ErrCode EnableItem (int32 nCmd, bool bEnable=true)
 Enables (or disables) the menu item for a given command.
widget_menu * GetMenuPtr (void) const
 Returns a ptr to the underlying widget_menu structure.
ErrCode SetItemText (int32 nCmd, StringPtr pstrLabel)
 Sets the menu item label for a given command.

Protected Types

typedef widget_menu_item * MenuItemPtr
typedef HMap< int32, MenuItemPtr > MenuItemMap

Protected Member Functions

MenuItemPtr getMenuItem (int32 nCmd)
 Returns a ptr to the item for a given command.

Protected Attributes

MenuItemMap m_items
 STL map of menu items.

Friends

class HMenuBar


Member Function Documentation

ErrCode HMenu::AddItem int32  nCmd,
StringPtr  pstrLabel,
uint32  uFlags = 0,
bool  bEnabled = true
 

Adds a new item to the menu, enabling it or disabling it as appropriate.

Returns:
NO_ERROR on success, error code otherwise
Parameters:
nCmd Command ID associated with this item (must be non-zero)
pstrLabel String to label menu item with
uFlags Flags
bEnabled True to enable item, false to disable it

Definition at line 73 of file HMenu.h.

ErrCode HMenu::AddSeparator void   ) 
 

Returns:
NO_ERROR on success, error code otherwise

Definition at line 125 of file HMenu.h.

ErrCode HMenu::Create int32  nID,
HANDLE  hWnd = NULL
 

Creates a new menu. The menu id must be non-zero.

Returns:
NO_ERROR on success, error code otherwise
Parameters:
nID ID of this menu (must be non-zero)
hWnd [optional] handle to window

Definition at line 165 of file HMenu.h.

ErrCode HMenu::EnableItem int32  nCmd,
bool  bEnable = true
 

Returns:
NO_ERROR on success, error code otherwise
Parameters:
nCmd Command ID (must be non-zero)
bEnable True to enable command, false to disable it.

Definition at line 194 of file HMenu.h.

widget_menu* HMenu::GetMenuPtr void   )  const
 

Returns:
Ptr to widget_menu structure

Definition at line 221 of file HMenu.h.

ErrCode HMenu::SetItemText int32  nCmd,
StringPtr  pstrLabel
 

Returns:
NO_ERROR on success, error code otherwise
Parameters:
nCmd Command ID (must be non-zero)
pstrLabel String to display

Definition at line 230 of file HMenu.h.

MenuItemPtr HMenu::getMenuItem int32  nCmd  )  [protected]
 

Returns:
Ptr to widget_menu_item structure

Definition at line 250 of file HMenu.h.


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

2006.01.09-16:37