Humble Framework for SkyOS


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

HMenuBar Class Reference
[Graphical User Interface]

#include <HMenu.h>

Inheritance diagram for HMenuBar:

HMenu HWidget HID HObjNoCopy HObj

Detailed Description

The menu bar is itself a menu, and (by convention) should be the only menu with an ID of zero (0). It also maintains a map of widget_menu * and menu IDs, so that it can find specific menus.

Definition at line 271 of file HMenu.h.

Public Member Functions

ErrCode AddMenu (int32 nID, StringPtr pstrLabel, HMenuPtr &pMenu)
 Adds a new menu to the menu bar.
ErrCode Destroy (void)
 Destroys the menu bar.
ErrCode RemoveMenu (int32 nID)
 Removes a menu with the specific ID.
HMenuPtr GetMenu (int32 nID)
 Returns a pointer to a menu with a given ID#.
int32 GetMenuCount (void) const
 Returns the count of menus currently in the menu bar.
HMenuPtr GetMenuByCommand (int32 nCmd)
 Returns a pointer to the menu that contains the requested command.
HMenuPtr GetNthMenu (int32 index)
 Returns a pointer to a menu with a given offset.

Protected Types

typedef std::map< int32, HMenuPtrHMenuMap

Protected Attributes

HMenuMap m_menus
 STL map of menu objects.


Member Function Documentation

ErrCode HMenuBar::AddMenu int32  nID,
StringPtr  pstrLabel,
HMenuPtr pMenu
 

Adds a menu with the specified ID and label to the menu bar. The menus must be added in order, and if the menu already exists, it is NOT added again.

Returns:
NO_ERROR on success, error code otherwise
Parameters:
nID ID of new menu
pstrLabel Label of new menu
[out] pMenu Ptr to HMenu object on success, NULL on error

Definition at line 310 of file HMenu.h.

ErrCode HMenuBar::Destroy void   )  [virtual]
 

Destroys the menu bar and all associated menu objects

Returns:
NO_ERROR on success, error code otherwise

Reimplemented from HWidget.

Definition at line 374 of file HMenu.h.

ErrCode HMenuBar::RemoveMenu int32  nID  ) 
 

Searches the array of menus and removes the first menu with the requested ID #.

Returns:
NO_ERROR on success, error code otherwise
Parameters:
nID ID# of menu to remove

Definition at line 409 of file HMenu.h.

HMenuPtr HMenuBar::GetMenu int32  nID  ) 
 

Searches the array of menus and returns the first menu with the given ID#. Note that not finding the desired menu isn't an error, because the caller may be trying to verify that a menu doesn't already exist.

Returns:
Ptr to HMenu object on success, NULL if not found
Parameters:
nID ID # of menu to find

Definition at line 450 of file HMenu.h.

int32 HMenuBar::GetMenuCount void   )  const
 

Returns:
Count of menus (0..kMaxMenus)

Definition at line 464 of file HMenu.h.

HMenuPtr HMenuBar::GetMenuByCommand int32  nCmd  ) 
 

Searches the array of menus and returns a ptr to the menu that contains the requested command, or NULL if the command is not associated with any menu. If the same command appears in more than one menu--which is allowed but not recommended--only the first one will be returned.

Returns:
Ptr to HMenu object on success, NULL if not found
Parameters:
nCmd Command to find menu for

Definition at line 477 of file HMenu.h.

HMenuPtr HMenuBar::GetNthMenu int32  index  ) 
 

Searches the array of menus and returns the menu at the requested index

Returns:
Ptr to HMenu object on success, NULL if not foudn
Parameters:
index Index of menu to find (0..kMaxMenus)

Definition at line 500 of file HMenu.h.


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

2006.01.09-16:37