Class Definition File | MenuBar.idl |
Class C++ Binding | MenuBar.xh |
Class Hierarchy |
SOMObject ODObject ODRefCntObject ODBaseMenuBar ODMenuBar |
Description | An object of the ODMenuBar class represents a composite menu-bar object, made up of menus from the document shell and the active part. When OpenDoc first opens a document, the document shell creates a menu-bar object, adds menus to it, and installs it as the base menu-bar object, which contains the default set of menus shared by all parts in the document. Part editors can obtain a copy of the base menu-bar object, by calling the window-state object's CopyBaseMenuBar method, add menus to it, and install it as the current menu-bar object. Your part creates an empty menu-bar by calling the window-state object's CopyBaseMenuBar method. Your part can also create a copy of an existing menu-bar object by calling its menu-bar object's Copy method. These methods return a reference to the menu bar object. OpenDoc allows the document shell and part editors to register command IDs for menu items. If no command ID is registered, a synthetic command ID, one that is manufactured from the menu and menu item IDs, is generated. If a command ID is not registered and not synthetic, a part should not handle it. |
Methods | The methods defined by the ODMenuBar class include:
|
Deprecated Methods | The following deprecated methods are still defined by the ODMenuBar class, but each is superseded by newer methods. |
Overridden Methods | There are no methods overridden by the ODMenuBar class. |
This method inserts a new menu before another specified menu on this menu bar.
Signature
void AddMenuBefore (ODMenuID menuID, ODPlatformMenu menu, ODPart *part, ODMenuID beforeID) |
Parameters
Returns
None.
Exception Handling
kODErrOutOfMemory | There is not enough memory to allocate the menu. |
This method inserts a new menu before another specified menu on this menu bar. This method is similar to AddMenuBefore but takes additional parameters to specify the IDs for the submenus in the menu being added. This is necessary because Windows NT does not support IDs for submenus.
Signature
void AddMenuBeforeEx (ODMenuID menuID, ODPlatformMenu menu, ODPart *part, ODMenuID beforeID, ODUShort subMenuIDCount, ODMenuIDInfo *submenuIDInfo) |
Parameters
Each element has:
Returns
None.
Exception Handling
kODErrOutOfMemory | There is not enough memory to allocate the menu. |
This method inserts a menu item in the specified menu before the specified menu item.
Signature
ODBoolean AddMenuItemBefore (ODMenuID menuID, ODMenuItemID itemID, ODPlatformMenuItem *menuItem, ODMenuItemID beforeID) |
Parameters
Returns
kODTrue | Successful completion. |
kODFalse | Error occurred. |
Remarks
This method inserts a menu item in the specified menu before the specified menu item.
This method inserts a menu item at the end of the specified menu.
Signature
ODBoolean AddMenuItemLast (ODMenuID menuID, ODMenuItemID itemID, ODPlatformMenuItem *menuItem) |
Parameters
Returns
kODTrue | Successful completion. |
kODFalse | Error occurred. |
Remarks
This method inserts a menu item at the end of the specified menu.
This method appends a new menu to the end of this menu bar if there is no IDMS_HELP in the menu; otherwise, it is inserted before the IDMS_HELP entry.
Signature
void AddMenuLast (ODMenuID menuID, ODPlatformMenu menu, ODPart *part) |
Parameters
Returns
None.
Exception Handling
kODErrOutOfMemory | There is not enough memory to allocate the menu. |
This method appends a new menu to the end of this menu bar if there is no IDMS_HELP in the menu; otherwise, it is inserted before the IDMS_HELP entry.
This method is similar to AddMenuLast but takes additional parameters that specifies the IDs of any submenu in the menu being added. This is necessary because Windows NT does not support IDs for submenus.
Signature
void AddMenuLastEx (ODMenuID menuID, ODPlatformMenu menu, ODPart *part, ODUShort subMenuIDCount, ODMenuItemID *submenuIDInfo) |
Parameters
Each element has:
Returns
None.
Exception Handling
kODErrOutOfMemory | There is not enough memory to allocate the menu. |
This method inserts a new cascading submenu into the specified menu or submenu before the specified menu item.
Signature
ODBoolean AddSubMenuBefore (ODMenuID menuID, ODMenuItemID subMenuItemID, ODPlatformMenu newSubMenu, ODMenuItemID beforeID) |
Parameters
Returns
kODTrue | Successful completion. |
kODFalse | Error occurred. |
This method inserts a new cascading submenu into the specified menu or submenu before the specified menu item.
This method is similar to AddSubMenuBefore but takes additional parameters that specifies the IDs of any submenu in the menu being added. This is necessary because Windows NT does not support IDs for submenus.
Signature
ODBoolean AddSubMenuBeforeEx (ODMenuID menuID, ODMenuItemID subMenuItemID ODPlatformMenu newSubMenu, ODMenuItemID beforeID ODUShort subMenuIDCount, ODMenuIDInfo *submenuIDInfo) |
Parameters
Each element has:
Returns
kODTrue | Successful completion. |
kODFalse | Error occurred. |
This method inserts a new cascading submenu to the end of the specified menu or submenu.
Signature
ODBoolean AddSubMenuBefore (ODMenuID menuID, ODMenuItemID subMenuItemID, ODPlatformMenu newSubMenu) |
Parameters
Returns
kODTrue | Successful completion. |
kODFalse | Error occurred. |
This method inserts a new cascading submenu to the end of the specified menu or submenu.
This method is similar to AddSubMenuLast but takes additional parameters that specifies the IDs of any submenu in the menu being added. This is necessary because Windows NT does not support IDs for submenus.
Signature
ODBoolean AddSubMenuBeforeEx (ODMenuID menuID, ODMenuItemID subMenuItemID ODPlatformMenu newSubMenu, ODUShort subMenuIDCount, ODMenuIDInfo *submenuIDInfo) |
Parameters
Each element has:
Returns
kODTrue | Successful completion. |
kODFalse | Error occurred. |
This method adds accelerators to the accelerator table.
Signature
ODBoolean AddToAccelTable (ODULong ulNumberofAccels, ODACCEL *NewAccels) |
Parameters
Returns
kODTrue | Successful completion. |
kODFalse | Error occurred. |
This method checks or unchecks the specified menu item in the menu.
Signature
ODBoolean CheckMenuItem (ODMenuID menuID, ODMenuItemID menuItemID, ODBoolean check) |
Parameters
kODTrue | The menu item is to be checked. |
kODFalse | The menu item is to be unchecked. |
Returns
kODTrue | Successful completion. |
kODFalse | Error occurred. |
This method copies this menu-bar object.
Signature
ODMenuBar *Copy () |
Parameters
None.
Returns
Remarks
OpenDoc calls this method; this method is not called by most parts.
This method creates a new platform menu.
Signature
ODPlatformMenu CreateX11PlatformMenu (ODMenuID menuID) |
Parameters
Returns
Remarks
This method creates a new platform menu for use on AIX with ODMenuBar methods that require a platform-menu parameter.
This method disposes of a platform menu.
Signature
void DestroyX11PlatformMenu (ODPlatformMenu menu) |
Parameters
Returns
None.
Remarks
This method disposes of a platform menu created by the CreateX11PlatformMenu method that is no longer needed.
This method installs this menu-bar object as the current menu-bar, making it visible and active.
Signature
void Display () |
Parameters
None.
Returns
This method enables or disables the specified item.
Signature
ODBoolean EnableMenu (ODMenuID menuID, ODBoolean enable) |
Parameters
kODTrue | The menu item is to be enabled. |
kODFalse | The menu item is to be disabled. |
Returns
kODTrue | Successful completion. |
kODFalse | Error occurred. |
This method enables or disables the specified menu item.
Signature
ODBoolean EnableMenuItem (ODMenuID menuID, ODMenuItemID menuItemID, ODBoolean enable) |
Parameters
kODTrue | The menu item is to be enabled. |
kODFalse | The menu item is to be disabled. |
Returns
kODTrue | Successful completion. |
kODFalse | Error occurred. |
This method indicates whether the specified menu item exists.
Note:
This method has been superseded by methods MenuExists and MenuItemExists.
Signature
ODBoolean Exists (ODMenuID menuID, ODMenuItemID menuItemID): |
Parameters
Returns
kODTrue | The menu item exists. |
kODFalse | The menu item does not exist. |
This method returns a platform-specific menu structure for the specified menu ID.
Signature
ODPlatformMenu GetMenu (ODMenuID menu) |
Parameters
Returns
This method returns a platform-specific menu structure for the specified menu item ID.
Signature
ODBoolean GetMenuItem (ODMenuID menuID, ODMenuItemID menuItemID, ODPlatformMenuItem *menuItem) |
Parameters
Returns
kODTrue | The item was successfully retrieved. |
kODFalse | The item was not retrieved. |
This method returns text associated with the specified menu item.
Signature
ODUShort GetMenuItemText (ODMenuID menuID, ODMenuItemID menuItemID, string *menuItemString) |
Parameters
Returns
This method returns text associated with the specified menu.
Signature
ODUShort GetMenuText (ODMenuID menuID, string *menuString) |
Parameters
Returns
This method inserts a new submenu in the specified menu or submenu, creating a cascading menu.
Note:
This method has been superseded by methods AddSubMenuBefore and AddSubMenuLast.
Signature
ODBoolean InsertSubmenu (ODMenuID menuID, ODMenuItemID subMenuID, ODPlatformMenu newSubmenu) |
Parameters
Returns
kODTrue | Successful completion. |
kODFalse | Error occurred. |
Remarks
The value of subMenuID determines where the new submenu is to be inserted in the menu. If subMenuID contains a kODNULL, the new submenu is inserted in menuID. If subMenuID contains a value, the submenu is inserted into subMenuID.
This method indicates whether a menu item is checked.
Signature
ODBoolean IsItemChecked (ODMenuID menuID, ODMenuItemID menuItemID) |
Parameters
Returns
kODTrue | The specified menu item is checked. |
kODFalse | The specified menu item is not checked. |
This method indicates whether a menu item is enabled.
Signature
ODBoolean IsItemEnabled (ODMenuID menuID, ODMenuItemID menuItemID) |
Parameters
Returns
kODTrue | The specified menu item is enabled. |
kODFalse | The specified menu item is disabled. |
This method indicates whether a menu item is hidden from view.
Signature
ODBoolean IsItemHidden (ODMenuID menuID, ODMenuItemID menuItemID) |
Parameters
Returns
kODTrue | The specified menu item is hidden. |
kODFalse | The specified menu item is not hidden. |
This method indicates whether a menu is enabled.
Signature
ODBoolean IsMenuEnabled (ODMenuID menuID) |
Parameters
Returns
kODTrue | The specified menu item is enabled. |
kODFalse | The specified menu item is disabled. |
This method indicates whether this menu bar object is equivalent to the base menu bar object from which is was copied.
Signature
ODBoolean IsValid () |
Parameters
None.
Returns
kODTrue | The menu bar objects are not equivalent. |
kODFalse | The menu bar objects are equivalent. |
Remarks
Your part calls its cached base menu bar's IsValid method before adding its own menus and displaying the composite menu bar. If this base menu bar is no longer valid, your part recopies the current base menu bar object by calling its window state's CopyBaseMenuBar method.
Related Methods
This method indicates whether the specified menu exists.
Signature
ODBoolean MenuExists (ODMenuID menuID) |
Parameters
Returns
kODTrue | The menu exists. |
kODFalse | The menu does not exist. |
This method indicates whether the specified menu item exists.
Signature
ODBoolean MenuItemExists (ODMenuID menuID, ODMenuItemID menuItemID) |
Parameters
Returns
kODTrue | The menu item exists. |
kODFalse | The menu item does not exist. |
This method removes the menu with the specified ID from this menu bar.
Signature
void RemoveMenu (ODMenuID menu) |
Parameters
Returns
None.
Remarks The displayed menu bar is not affected.
This method removes the specified menu item from the menu bar.
Signature
ODBoolean RemoveMenuItem (ODMenuID menuID, ODMenuItemID menuItemID) |
Parameters
Returns
kODTrue | The item was successfully removed. |
kODFalse | The item was not removed. |
This method restores the OpenDoc accelerator table to its initial state and removes any part-defined accelerators.
Signature
void RestoreAccelTable () |
Parameters
None.
Returns
This method hides the text of the specified menu item.
Signature
ODBoolean SetHideMenuItem (ODMenuID menuID, ODMenuItemID menuItemID) |
Parameters
VIEW_SHOWFRAMEOUTLINE | Hide the Hide/Show Frame Outline menu item. |
VIEW_SHOWLINKS | Hide the Hide/Show Links menu item. |
Returns
kODTrue | Successful completion. |
kODFalse | Error occurred. |
This method sets the text associated with the specified menu item.
Signature
ODBoolean SetMenuItemText (ODMenuID menuID, ODMenuItemID menuItemID, string menuItemString) |
Parameters
Returns
kODTrue | Successful completion. |
kODFalse | Error occurred. |
This method sets the text associated with the specified menu.
Signature
ODBoolean SetMenuText (ODMenuID menuID, string menuString) |
Parameters
Returns
kODTrue | Successful completion. |
kODFalse | Error occurred. |
This method displays the text of the specified menu item.
Signature
ODBoolean SetShowMenuItem (ODMenuID menuID, ODMenuItemID menuItemID) |
Parameters
VIEW_SHOWFRAMEOUTLINE | Displays the Hide/Show Frame Outline menu item. |
VIEW_SHOWLINKS | Displays the Hide/Show Links menu item. |
Returns
kODTrue | Successful completion. |
kODFalse | Error occurred. |