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

CP_MenuBar Class Reference

A class to represent the top level menu bar in a CPLAT application. More...

Inheritance diagram for CP_MenuBar:

CP_NoCopy List of all members.

Public Member Functions

Constructor / Destructor
 CP_MenuBar ()
 Constructor.
 CP_MenuBar (SInt16 inMenuBarID)
virtual ~CP_MenuBar ()
 Destructor.
Getters
OSMenuBar GetOSMenuBar ()
SInt16 GetMenuBarID ()
CP_CommandNo GetCommandNo (HICommand inHICommand)
Menus
void AppendMenu (CP_Menu *inMenu, bool inInsertInMenuBar=true)
void InsertMenu (CP_Menu *inMenu, SInt16 inBeforeMenuID)
void InsertMenuAt (CP_Menu *inMenu, SInt16 inPosition)
SInt16 GetMenuIndex (SInt16 inMenuID) const
SInt16 GetMenuIDAt (SInt16 inIndex)
CP_MenuGetCPMenu (SInt16 inMenuID)
CP_MenuGetCPMenuAt (SInt16 inIndex)
CP_MenuFindMenu (OSMenu inOSMenu)
Utility
void Refresh ()
void SetMainWindow (CP_Window *inMainWindow)
void AddMenuHier (CP_Menu *inMenu)
void LoadMenuBarMenus (SInt16 inMenuBarID)

Protected Member Functions

MenuBar
OSMenuBar LoadMenuBar (SInt16 inMenuBarID)

Protected Attributes

CP_Menu_ListfMenus
SInt16 fMenuBarID
OSWindow fOwnerWindow
OSMenuBar fMenuBar

Private Member Functions

Menu List
void AddMenuToList (CP_Menu *inMenu)

Detailed Description

This class is used in conjunction with the CP_MenuBarManager class to manage the top level menu bars in your application.


Constructor & Destructor Documentation

CPLAT_Begin_Namespace_CPLAT CP_MenuBar::CP_MenuBar  ) 
 

Constructor.

Exceptions:
none 

CP_MenuBar::CP_MenuBar SInt16  inMenuBarID  ) 
 

Constructor.

Exceptions:
none 

CP_MenuBar::~CP_MenuBar  )  [virtual]
 

Destructor.

Exceptions:
none 


Member Function Documentation

OSMenuBar CP_MenuBar::GetOSMenuBar  ) 
 

Return the platforms menu bar reference.

Returns:
OSMenuBar Platforms menubar reference.

SInt16 CP_MenuBar::GetMenuBarID  ) 
 

CP_CommandNo CP_MenuBar::GetCommandNo HICommand  inHICommand  ) 
 

Returns a CP_CommandNo for the passed in HICommand. This will find the CP_Menu object corresponding to the menu reference passed in from the HICommand, and then find the command in that menu.

Parameters:
inMenuBarID Platforms menu bar resource id.
Exceptions:
none 
Returns:
void

void CP_MenuBar::AppendMenu CP_Menu inMenu,
bool  inInsertInMenuBar = true
 

Appends the passed in CP_Menu to the end of this menu bar. If the parameter inInsertInMenuBar is true, the menu is also inserted into the platforms menu bar.

Parameters:
inMenu CP_Menu to add to this menu bar.
inInsertInMenuBar Flag to indicate if the menu is also inserted into the platforms menu bar.
Exceptions:
none 
Returns:
void

void CP_MenuBar::InsertMenu CP_Menu inMenu,
SInt16  inBeforeMenuID
 

Insert the menu into our menu bar. inBeforeMenuID is the menu ID we want to insert our menu before

Parameters:
inMenu CP_Menu to add to this menu bar.
inBeforeMenuID Menu id of the menu to insert before.
Exceptions:
none 
Returns:
void

void CP_MenuBar::InsertMenuAt CP_Menu inMenu,
SInt16  inPosition
 

Insert the menu into our menu bar at the specified index.

Parameters:
inMenu CP_Menu to add to this menu bar.
inPosition Index of the location to insert our menu at.
Exceptions:
CP_paramErr If the passed in menu is NULL;
Returns:
void

SInt16 CP_MenuBar::GetMenuIndex SInt16  inMenuID  )  const
 

Returns the 1 based index of the menu with the passed in menu id of the menus in our menu bar. If a menu with the matching id is not found, then kCP_InvalidIndex is returned.

Parameters:
inMenu CP_Menu to add to this menu bar.
inPosition Index of the location to insert our menu at.
Exceptions:
none 
Returns:
void

SInt16 CP_MenuBar::GetMenuIDAt SInt16  inIndex  ) 
 

Returns the id of the menu at the passed in inIndex.

Parameters:
inMenu CP_Menu to add to this menu bar.
inPosition Index of the location to insert our menu at.
Exceptions:
none 
Returns:
void

CP_Menu * CP_MenuBar::GetCPMenu SInt16  inMenuID  ) 
 

Returns the CP_Menu of the menu with the passed in menu id.

Parameters:
inMenuID The ID of the menu to find.
Exceptions:
none 
Returns:
void

CP_Menu * CP_MenuBar::GetCPMenuAt SInt16  inIndex  ) 
 

Returns the CP_Menu of the menu at the passed inIndex

Parameters:
inIndex Index of the menu to return.
Exceptions:
none 
Returns:
void

CP_Menu * CP_MenuBar::FindMenu OSMenu  inOSMenu  ) 
 

Returns a CP_Menu object from the passed in inOSMenu. If the corresponding menu is not locted within this menu bar, NULL is returned.

Parameters:
inOSMenu OSMenu reference to the menu to find.
Exceptions:
none 
Returns:
CP_Menu * The CP_Menu in this menu bar that corresponds to the passed in OSMenu.

void CP_MenuBar::Refresh  ) 
 

Method to cause the platforms menu bar to update itself.

Exceptions:
none 
Returns:
void

void CP_MenuBar::SetMainWindow CP_Window inMainWindow  ) 
 

Sets the main window associated with this application.

Parameters:
inMainWindow The main window for this application.
Exceptions:
none 
Returns:
void

void CP_MenuBar::AddMenuHier CP_Menu inMenu  ) 
 

void CP_MenuBar::LoadMenuBarMenus SInt16  inMenuBarID  ) 
 

Constructor.

Exceptions:
none 

OSMenuBar CP_MenuBar::LoadMenuBar SInt16  inMenuBarID  )  [protected]
 

Loads the platforms menu bar with the passed in inMenuBarID, and also creates and loads each CP_Menu as specified in the menu bar resource. If the resource can't be found an CP_ThrowIfResFail exception is thrown.

Parameters:
inMenuBarID Platforms menu bar resource id.
Exceptions:
none 
Returns:
void

void CP_MenuBar::AddMenuToList CP_Menu inMenu  )  [private]
 

Private method to add the menu to the list of menus in this menu bar. A check is made to make sure the menu is not currently in the list of menus, and if so, not inserted so only a single version of the menu is in the list.

Parameters:
inMenu CP_Menu to add to the list of menus.
Exceptions:
none 
Returns:
void


Member Data Documentation

CP_Menu_List* CP_MenuBar::fMenus [protected]
 

SInt16 CP_MenuBar::fMenuBarID [protected]
 

List of menus in this menu bar.

OSWindow CP_MenuBar::fOwnerWindow [protected]
 

ID of the menu bar.

OSMenuBar CP_MenuBar::fMenuBar [protected]
 


The documentation for this class was generated from the following files:
Generated on Tue Sep 20 20:21:53 2005 for CPLAT_MacOS by  doxygen 1.4.0