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

CP_Menu_Imp Class Reference

MacOS implementation of the CP_Menu class.

Inheritance diagram for CP_Menu_Imp:

CP_NoCopy CP_Menu List of all members.

Public Member Functions

Constructor / Destructor
 CP_Menu_Imp ()
 Constructor.
 CP_Menu_Imp (SInt16 inMenuID, const CP_String &inMenuTitle)
 CP_Menu_Imp (const CP_String &inMenuTitle)
 CP_Menu_Imp (SInt16 inMenuID, const CP_String &inMenuTitle, OSMenu inOSMenu)
 CP_Menu_Imp (OSMenu inOSMenu)
virtual ~CP_Menu_Imp () throw ()
 Destructor.

Protected Attributes

SInt16 fMenuID
OSMenu fOSMenu
CP_MenuImp_List fSubMenus

Private Member Functions

Utility
void RemoveQuitItem ()
void RemovePreferenceItem ()

Constructor & Destructor Documentation

CPLAT_Begin_Namespace_CPLAT CP_Menu_Imp::CP_Menu_Imp  ) 
 

Constructor.

Exceptions:
none 

CP_Menu_Imp::CP_Menu_Imp SInt16  inMenuID,
const CP_String inMenuTitle
 

Constructor. Constructs the menu from a menu id and a menu title.

Parameters:
inMenuID Resource id of the menu.
inMenuTitle String containing the title of the menu.
Exceptions:
ThowIfResFail Thrown if the menu could not be created.

CP_Menu_Imp::CP_Menu_Imp const CP_String inMenuTitle  ) 
 

Constructor. Constructs the menu from a menu id and a menu title.

Parameters:
inMenuTitle String containing the title of the menu.
Exceptions:
ThowIfResFail Thrown if the menu could not be created.

CP_Menu_Imp::CP_Menu_Imp SInt16  inMenuID,
const CP_String inMenuTitle,
OSMenu  inOSMenu
 

Constructor. Constructs the menu from a menu id and a menu title.

Parameters:
inMenuID Resource id of the menu.
inMenuTitle String containing the title of the menu.
Exceptions:
CP_paramErr If the passed in OSMenu is NULL, a CP_paramErr is thrown

CP_Menu_Imp::CP_Menu_Imp OSMenu  inOSMenu  ) 
 

Constructor. Constructs the menu from an existing OSMenu

Parameters:
inOSMenu The platforms OS menu to use for this class.
Exceptions:
none 

CP_Menu_Imp::~CP_Menu_Imp  )  throw () [virtual]
 

Destructor.

Exceptions:
none 


Member Function Documentation

CP_CommandNo CP_Menu_Imp::GetCommandNo SInt16  inMenuItemIndex  )  [virtual]
 

Returns the CP_CommandNo associated with the menu item at the passed in 1 based index.

Parameters:
inMenuItemIndex 1 based index of the menu item to return the command for.
Exceptions:
OSErr 
Returns:
CP_CommandNo The command associated with the menu item.

OSMenu CP_Menu_Imp::GetOSMenu  ) 
 

Return the MacOS platform menu reference.

Exceptions:
none 
Returns:
OSMenu MacOS menu reference.

SInt16 CP_Menu_Imp::GetMenuItemCount  ) 
 

Returns the number of menu items in this menu. If this is an Apple menu, then 1 is returned for the count.

Exceptions:
none 
Returns:
UInt16 Number of menu items.

CP_String CP_Menu_Imp::GetTitle  )  const
 

Returns the menu title as a CP_String.

Exceptions:
none 
Returns:
CP_String const The menu title.

SInt16 CP_Menu_Imp::GetID  ) 
 

Return the ID of this menu.

Exceptions:
none 
Returns:
SInt16 ID of this menu.

CP_CommandNo CP_Menu_Imp::GetCommand SInt16  inItemIndex  ) 
 

SInt16 CP_Menu_Imp::GetCommandItemIndex const CP_CommandNo  inCommand  ) 
 

CP_String CP_Menu_Imp::GetItemText SInt16  inItemIndex  ) 
 

void CP_Menu_Imp::AppendItem const CP_String inItemText,
CP_CommandNo  inCommand
 

Appends the passed in item to this menu.

Parameters:
inItemText The text of the item being appended.
inCommand The command of the item being appended.
Exceptions:
OSErr 
Returns:
void

void CP_Menu_Imp::DeleteItem UInt16  inItemIndex  ) 
 

Deletes the menu item with the passed in inItemIndex which is 1 based, and should be between 1 and the number of items in this menu.

Parameters:
inItemIndex The 1 based index of the item to delete.
Exceptions:
none 
Returns:
void

void CP_Menu_Imp::SetTitle const CP_String inTitle  ) 
 

Sets the menu title from the passed in string.

Parameters:
inTitle The title of the menu.
Exceptions:
OSErr 
Returns:
void

void CP_Menu_Imp::SetItemMark CP_CommandNo  inCommand,
SInt16  inItemMark,
bool  inHasMark
 

Sets/remove the menu items mark to the passed in inItemMark.

Parameters:
inCommand The CP_CommandNo of the item being set.
inItemMark The character to use as the menu item mark.
inHasMark Flag to indicate if we are setting or removing the mark.
Exceptions:
OSErr 
Returns:
void

void CP_Menu_Imp::SetItemMark SInt16  inIndex,
SInt16  inItemMark,
bool  inHasMark
 

Sets/remove the menu items mark to the passed in inItemMark.

Parameters:
inIndex Index of the menu item being set.
inItemMark The character to use as the menu item mark.
inHasMark Flag to indicate if we are setting or removing the mark.
Exceptions:
OSErr 
Returns:
void

void CP_Menu_Imp::LoadOSMenu SInt16  inMenuID,
bool  inPopup = false
[protected]
 

Loads the MacOS menu reference with the passed in resource id. If no menu can be found a CP_ThrowIfResFail exception is thrown.

Under MacOSX if this is a menu with the id of kCP_FileMenuID a check will be made if there is a Quit item at the end of the menu, and if so it and its separator line (if any) will be removed from this menu.

Under MacOSX the edit menu is also checked for a preference item, and it will be removed like the above file menus quit item.

Parameters:
inMenuID Resource id of the menu to load.
inPopup Flag to indicate if this is a popup menu.
Exceptions:
CP_ThrowIfResFail If the menu could not be loaded.
Returns:
void

void CP_Menu_Imp::RemoveQuitItem  )  [private]
 

Under MacOSX if this is a menu with the id of kCP_FileMenuID a check will be made if there is a Quit item at the end of the menu, and if so it and its separator line (if any) will be removed from this menu.

Exceptions:
OSErr 
Returns:
void

void CP_Menu_Imp::RemovePreferenceItem  )  [private]
 

Under MacOSX if this is a menu with the id of kCP_EditMenuID a check will be made if there is a Preference item at the end of the menu, and if so it and its separator line (if any) will be removed from this menu.

Exceptions:
OSErr 
Returns:
void


Member Data Documentation

SInt16 CP_Menu_Imp::fMenuID [protected]
 

OSMenu CP_Menu_Imp::fOSMenu [protected]
 

Menu id of this menu.

CP_MenuImp_List CP_Menu_Imp::fSubMenus [protected]
 

MacOS menu reference.


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