Inheritance diagram for CP_Menu:
Public Member Functions | |
Constructor / Destructor | |
CP_Menu () | |
Constructor. | |
CP_Menu (SInt16 inMenuID, const CP_String &inMenuTitle, bool inPopup=false) | |
CP_Menu (const CP_String &inMenuTitle) | |
CP_Menu (SInt16 inMenuID, const CP_String &inMenuTitle, OSMenu inOSMenu) | |
CP_Menu (OSMenu innMenu) | |
virtual | ~CP_Menu () throw () |
Destructor. | |
Commands | |
virtual CP_CommandNo | GetCommandNo (SInt16 inMenuItemIndex) |
Getters | |
OSMenu | GetOSMenu () |
SInt16 | GetMenuItemCount () |
CP_String | GetTitle () const |
SInt16 | GetID () |
CP_CommandNo | GetCommand (SInt16 inItemIndex) |
SInt16 | GetCommandItemIndex (const CP_CommandNo inCommand) |
CP_String | GetItemText (SInt16 inItemIndex) |
Items | |
void | AppendItem (const CP_String &inItemText, CP_CommandNo inCommand) |
void | DeleteItem (UInt16 inItemIndex) |
Setters | |
void | SetTitle (const CP_String &inTitle) |
void | SetItemMark (CP_CommandNo inCommand, SInt16 inItemMark, bool inHasMark) |
void | SetItemMark (SInt16 inIndex, SInt16 inItemMark, bool inHasMark) |
Commands | |
virtual CP_CommandNo | GetCommandNo (SInt16 inMenuItemIndex) |
Getters | |
OSMenu | GetOSMenu () |
SInt16 | GetMenuItemCount () |
CP_String | GetTitle () const |
SInt16 | GetID () |
CP_CommandNo | GetCommand (SInt16 inItemIndex) |
SInt16 | GetCommandItemIndex (const CP_CommandNo inCommand) |
CP_String | GetItemText (SInt16 inItemIndex) |
Items | |
void | AppendItem (const CP_String &inItemText, CP_CommandNo inCommand) |
void | DeleteItem (UInt16 inItemIndex) |
Setters | |
void | SetTitle (const CP_String &inTitle) |
void | SetItemMark (CP_CommandNo inCommand, SInt16 inItemMark, bool inHasMark) |
void | SetItemMark (SInt16 inIndex, SInt16 inItemMark, bool inHasMark) |
Protected Member Functions | |
OSMenu | |
void | LoadOSMenu (SInt16 inMenuID, bool inPopup=false) |
OSMenu | |
void | LoadOSMenu (SInt16 inMenuID, bool inPopup=false) |
Protected Attributes | |
SInt16 | fMenuID |
OSMenu | fOSMenu |
CP_MenuImp_List | fSubMenus |
The menu class is also reference counted in case the menu is used in more than one place, and the underlying OS shares a copy of the native menu.
|
Constructor. This creates an empty menu. You will need to do the actual creation of the underlying OSMenu before being able to use this object. |
|
Constructor. This version creates the underlying OSMenu from the passed in menu resource id.
|
|
|
|
Constructor. This version creates the underlying OSMenu from the passed in menu resource id.
|
|
|
|
Destructor. |
|
Returns the CP_CommandNo associated with the menu item at the passed in 1 based index.
|
|
Return the MacOS platform menu reference.
|
|
Returns the number of menu items in this menu. If this is an Apple menu, then 1 is returned for the count.
|
|
Returns the menu title as a CP_String.
|
|
Return the ID of this menu.
|
|
|
|
|
|
|
|
Appends the passed in item to this menu.
|
|
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.
|
|
Sets the menu title from the passed in string.
|
|
Sets/remove the menu items mark to the passed in inItemMark.
|
|
Sets/remove the menu items mark to the passed in inItemMark.
|
|
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.
|
|
Add a reference to our object, returning the new reference count.
|
|
Remove a reference to our object, returning the new reference count. If the count is 0, then this object is also deleted, and 0 is returned.
|
|
Add the object to the topmost auto-release pool. This will ensure that the object is eventually released.
|
|
Returns the current ref count.
|
|
|
|
Menu id of this menu. |
|
MacOS menu reference. |