The ISubmenu class creates a submenu object from a menu handle. This class overrides functions of IMenu to provide menu item functions that can be restored. The menu item functions in this class act upon this ISubmenu object. Any changes are undone when the menu ends.
The Open Class Library adds a Motif callback routine to all submenus to enable processing of the following menu events:
Constructors & DestructorYou can construct and destruct objects of this class. You cannot copy or assign ISubmenu objects because both the copy constructor and assignment operator are private functions.
![]() |
public:
virtual ~ISubmenu()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
ISubmenu(const IMenuHandle& submenuHandle)
Creates an ISubmenu object from the handle of an existing submenu. One of the primary uses of this constructor is in the implementation of the IMenuHandler class.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Adding Items
You can add textual, graphical, submenu, or separator items to a submenu object.
You can also construct an object of the
IMenuItem class and add it
to the submenu object.
In these overridden versions,
the item is always added to this ISubmenu object. You do not need
to specify the intoSubmenuId parameter because it is always assumed
to have the value of the identifier of this submenu.
Note:
![]() |
Adds a bitmap menu item as the last item in a menu or submenu.
public:
virtual ISubmenu& addBitmap( unsigned long newItemId, const IResourceId& newItemBitmapResId, unsigned long intoSubmenuId = 0 )
Use this version to load a bitmap from the resource library that you specified when you created the IResourceId object. The parameters are the following:
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
X-Motif provides specific widgets and gadgets to use for specific purposes in menus. Pull-down menus can contain the following widgets and gadgets:
public:
virtual ISubmenu& addBitmap( unsigned long newItemId, const IBitmapHandle& itemBitmap, unsigned long intoSubmenuId = 0 )
Use this version to add a bitmap you already have loaded into a menu item. The parameters are the following:
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
X-Motif provides specific widgets and gadgets to use for specific purposes in menus. Pull-down menus can contain the following widgets and gadgets:
public:
virtual ISubmenu& addBitmap( unsigned long newItemId, unsigned long newItemBitmapResId, unsigned long intoSubmenuId = 0 )
Use this version to load a bitmap from the default resource library. The parameters are the following:
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
X-Motif provides specific widgets and gadgets to use for specific purposes in menus. Pull-down menus can contain the following widgets and gadgets:
![]() |
public:
virtual ISubmenu& addItem( IMenuItem& menuItem, unsigned long intoSubmenuId = 0 )
Adds a menu item represented by an IMenuItem object as the last item in a menu or submenu. The optional intoSubmenuId is ignored. It is only present to allow this function to override the function inherited from IMenu.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
X-Motif provides specific widgets and gadgets to use for specific purposes in menus. Pull-down menus can contain the following widgets and gadgets:
![]() |
Adds a separator menu item with the specified identifier as the last item in a submenu.
public:
virtual ISubmenu& addSeparator( unsigned long newItemId, unsigned long intoSubmenuId )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
virtual ISubmenu& addSeparator(unsigned long newItemId = 0)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Adds a text menu item as the last item in a menu or submenu. The optional intoSubmenuId is ignored. It is only present to allow this function to override the function inherited from IMenu.
public:
virtual ISubmenu& addText( unsigned long newItemId, const char* itemText, unsigned long intoSubmenuId = 0 )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
X-Motif provides specific widgets and gadgets to use for specific purposes in menus. Pull-down menus can contain the following widgets and gadgets:
public:
virtual ISubmenu& addText( unsigned long newItemId, const IResourceId& newItemTextResId, unsigned long intoSubmenuId = 0 )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
X-Motif provides specific widgets and gadgets to use for specific purposes in menus. Pull-down menus can contain the following widgets and gadgets:
Cursored OperationsCursored operations use objects of the ISubmenu::Cursor nested class to designate which menu item is to be acted upon. You can use these members to access each item in the menu without knowing the menu item identifiers. In these overridden versions, information is stored about the change so that the change can be undone.
![]() |
public:
virtual ISubmenu& add(IMenuItem& menuItem, Cursor& cursor)
Adds the specified menu item at the position of the specified cursor by pushing down everything after the cursor.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual ISubmenu& addAsNext( IMenuItem& menuItem, Cursor& cursor )
Adds the specified menu item as the next item in the submenu and sets the specified cursor there.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
Cursor cursor(unsigned long itemId) const
Returns an ISubmenu::Cursor object and sets the cursor to point to the specified menu item.
| IInvalidRequest | The menu item identifier is invalid. Verify that the identifier represents an item in the menu. |
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual ISubmenu& deleteAt(Cursor& cursor)
Deletes the menu item at the position of the specified cursor and sets the cursor to the menu item that precedes the deleted menu item.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual IMenuItem elementAt(const Cursor& cursor) const
Returns the menu item at the position of the specified cursor.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual ISubmenu& removeSubmenuAt(Cursor& cursor)
Removes the menu item at the cursor position submenu indicator and destroys the submenu. Typically, you use this member function to remove cascading menus.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
PropertiesUse property members to obtain general information about the submenu.
![]() |
public:
virtual IMenuHandle handle() const
Returns the submenu handle. This function is equivalent to menuHandle.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
The handle returned is the handle of the underlying window.
The handle returned is the handle of the underlying window.
The handle returned is the underlying HMENU.
![]() |
public:
virtual IMenuHandle menuHandle() const
Returns the submenu handle. This function is equivalent to handle.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
The handle returned is the handle of the underlying window.
The handle returned is the handle of the underlying window.
Removing ItemsThese members delete menu items and remove a submenu of the instances of this submenu class. In these overridden versions, information is stored about the change so that the change can be undone.
![]() |
public:
virtual ISubmenu& deleteItem(unsigned long itemId)
Removes the specified item from a menu.
| IInvalidRequest | The menu item identifier is invalid. Verify that the identifier represents an item in the menu. |
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual ISubmenu& removeSubmenu( unsigned long itemWithSubmenuId )
Removes the menu item submenu indicator and destroys the submenu. Typically, you use this member function to remove cascading menus.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Replacing ItemsYou replace a menu item to change the text or graphic displayed by the item or to create a submenu. You can also replace a menu item with an IMenuItem object. You can create an IMenuItem object using the menuItem function, make the appropriate changes to the IMenuItem object, and then replace the item in the menu object using the setItem function.
This class overrides inherited functions for replacing menu items. In these overridden versions, information is stored about the change so that the change can be undone. In addition, with these versions, the item is always added to this ISubmenu object. You do not need to specify the intoSubmenuId parameter because it is always assumed to have the value of the identifier of this submenu.
![]() |
Replaces a specified menu item with a bitmap.
public:
virtual ISubmenu& setBitmap( unsigned long menuItemId, unsigned long newBitmapResId )
Use this function when you want Open Class Library to load the bitmap from the default resource library.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
virtual ISubmenu& setBitmap( unsigned long menuItemId, const IResourceId& newBitmapResId )
Use this function when you want Open Class Library to load the bitmap from the resource library you specified when you created the IResourceId object.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
virtual ISubmenu& setBitmap( unsigned long menuItemId, const IBitmapHandle& bitmapHandle )
Use this function when you have the bitmap loaded.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual ISubmenu& setItem(const IMenuItem& menuItem)
Replaces a specified menu item's style and representation.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Replaces a specified menu item's text.
public:
virtual ISubmenu& setText( unsigned long menuItemId, const IResourceId& newTextResId )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
virtual ISubmenu& setText( unsigned long menuItemId, const char* newText )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
SelectionUse selection members to determine if a menu item is selectable (enabled) or is displaying a selection state indicator. You can also change these properties. The ISubmenu class overrides these IMenu selection members so that information about how the menu was changed can be stored. The stored information allows the changes to be undone later.
![]() |
public:
virtual ISubmenu& checkItem( unsigned long itemId, bool checked = true )
Places a selection state indicator to the left of the item with the specified identifier.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
The selection state indicator is a square-shaped object to the left of the specified item.
The selection state indicator is a check mark in front of the menu item.
The selection state indicator is a check mark in front of the menu item.
![]() |
public:
virtual ISubmenu& disableItem(unsigned long itemId)
Makes the menu item with the specified identifier unselectable.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual ISubmenu& enableItem( unsigned long itemId, bool enabled = true )
Makes the menu item with the specified identifier selectable.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
virtual ISubmenu& uncheckItem(unsigned long itemId)
Removes the selection state indicator from the left of the item with the specified identifier.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
The selection state indicator is a square-shaped object to the left of the specified item.
The selection state indicator is a check mark in front of the menu item.
The selection state indicator is a check mark in front of the menu item.
UndoUndo members support restoring the ISubmenu to the state that existed before the use of ISubmenu members. You usually do not have to call these functions because the IMenuHandler class calls them automatically.
![]() |
public:
virtual ISubmenu& undo()
Reverses all the changes made to the menu using the ISubmenu member functions.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
virtual ~IMenu()
virtual IMenu& add(IMenuItem& menuItem, Cursor& cursor)
virtual IMenu& addAsNext( IMenuItem& menuItem, Cursor& cursor )
virtual IMenu&
addBitmap( unsigned long newItemId,
const IBitmapHandle& itemBitmap,
unsigned long intoSubmenuId = 0 )
virtual IMenu&
addBitmap( unsigned long newItemId,
const IResourceId& bitmapResId,
unsigned long intoSubmenuId = 0 )
virtual IMenu&
addBitmap( unsigned long newItemId,
unsigned long bitmapResId,
unsigned long intoSubmenuId = 0 )
virtual IMenu& addItem( IMenuItem& menuItem, unsigned long intoSubmenuId = 0 )
virtual IMenu&
addSeparator( unsigned long newItemId,
unsigned long intoSubmenuId )
virtual IMenu& addSeparator( unsigned long intoSubmenuId = 0 )
virtual IMenu&
addSubmenu( unsigned long itemId,
const IResourceId& submenuResId )
virtual IMenu& addSubmenu(unsigned long itemId)
virtual IMenu&
addText( unsigned long newItemId,
const char* itemText,
unsigned long intoSubmenuId = 0 )
virtual IMenu&
addText( unsigned long newItemId,
const IResourceId& textResId,
unsigned long intoSubmenuId = 0 )
virtual IMenu&
checkItem( unsigned long itemId,
bool check = true )
virtual unsigned long conditionalCascade( unsigned long itemWithSubmenuId )
Cursor cursor( unsigned long itemId, unsigned long inSubmenuId = 0 ) const
static Style defaultStyle()
virtual IMenu& deleteAt(Cursor& cursor)
virtual IMenu& deleteItem(unsigned long itemId)
virtual IMenu& disableItem(unsigned long itemId)
virtual IMenu& disableUpdate()
virtual IMenu&
enableItem( unsigned long itemId,
bool enable = true )
virtual IMenu& enableUpdate(bool enableWindow = true)
virtual IWindowHandle handle() const
virtual IMenu& hide()
virtual unsigned long id() const
IMenu(const IMenuHandle& menuHandle)
virtual bool isFrameWindow() const
bool isItemChecked(unsigned long itemId) const
bool isItemEnabled(unsigned long itemId) const
bool isShowing() const
virtual bool isValid() const
bool isVisible() const
unsigned long itemHelpId(unsigned long menuItemId) const
IDMItemProvider* itemProvider() const
IRectangle itemRect(unsigned long itemId) const
IMenuItem menuItem(unsigned long itemId) const
static IMenuHandle menuWithParent(IWindow& parent)
unsigned long numberOfItems( unsigned long forSubmenuId = 0 ) const
virtual IWindow* owner() const
virtual IMenu& refresh( const IRectangle& invalidRectangle, bool immediate = false )
virtual IMenu& refresh( IWindow::RefreshType type = IWindow::paintAll )
virtual IMenu& removeConditionalCascade( unsigned long itemWithSubmenuId )
virtual IMenu& removeSubmenu( unsigned long itemWithSubmenuId )
virtual IMenu& removeSubmenuAt(Cursor& cursor)
virtual IMenu& selectItem(unsigned long itemId)
virtual IMenu&
setBitmap( unsigned long menuItemId,
const IResourceId& newBitmapResId )
virtual IMenu&
setBitmap( unsigned long menuItemId,
const IBitmapHandle& bitmapHandle )
virtual IMenu&
setBitmap( unsigned long menuItemId,
unsigned long newBitmapResId )
virtual IMenu&
setConditionalCascade( unsigned long itemWithSubmenuId,
unsigned long defaultItemId )
static void setDefaultStyle(const Style& aStyle)
virtual IMenu& setItem(const IMenuItem& menuItem)
virtual IMenu&
setItemHelpId( unsigned long menuItemId,
unsigned long helpTopicId )
IMenu& setItemProvider(IDMItemProvider* dragProvider)
virtual IMenu&
setSubmenu( unsigned long itemId,
const IResourceId& submenuResId )
virtual IMenu&
setText( unsigned long menuItemId,
const IResourceId& newTextResId )
virtual IMenu&
setText( unsigned long menuItemId,
const char* newText )
virtual IMenu& show(bool showMenu = true)
virtual IMenu& uncheckItem(unsigned long itemId)
virtual IWindow* window() const
virtual ~INotifier()
virtual INotifier& disableNotification() = 0
virtual INotifier& enableNotification( bool enable = true ) = 0
INotifier()
virtual bool isEnabledForNotification() const = 0
virtual INotifier& notifyObservers( const INotificationEvent& event ) = 0
virtual INotifier& notifyObserversAsync( const INotificationEvent& event )
const IThreadId& threadId() const
virtual ~IStandardNotifier()
virtual IStandardNotifier& disableNotification()
virtual IStandardNotifier& enableNotification( bool enable = true )
virtual bool isEnabledForNotification() const
IStandardNotifier()
IStandardNotifier(const IStandardNotifier& copy)
virtual INotifierAddress notifierAddress() const
virtual IStandardNotifier& notifyObservers( const INotificationEvent& anEvent )
virtual IStandardNotifier& notifyObserversAsync( const INotificationEvent& anEvent )
IStandardNotifier& operator =( const IStandardNotifier& aStandardNotifier )
static INotificationId const allChangesId
static INotificationId const deleteId
static const Style classDefaultStyle
static const Style noStyle
static const Style visible
virtual INotifier& addObserver( IObserver& observer, const IInterest& interest )
virtual INotifier& notifyObservers( const INotificationId& id ) = 0
virtual IObserverList& observerList( const IInterest* anInterest = 0 ) const = 0
virtual INotifier& removeAllObservers() = 0
virtual INotifier& removeObserver( IObserver& observer, const IInterest& interest )
virtual INotifier& removeObserver(IObserver& observer) = 0
virtual IStandardNotifier& addObserver( IObserver& observer, const IInterest& interest )
virtual IStandardNotifier& notifyObservers( const INotificationId& nId )
virtual IObserverList& observerList( const IInterest* anInterest = 0 ) const
virtual IStandardNotifier& removeAllObservers()
virtual IStandardNotifier& removeObserver( IObserver& observer, const IInterest& interest )
virtual IStandardNotifier& removeObserver( IObserver& observer )
IMenu()
void setWindow(IWindow* window)