### IMenuBar

  The IMenuBar class represents a menu bar for frame windows.
  Note: You can add a menu bar to a frame window without using the IMenuBar class by specifying the style IFrameWindow::menuBar when you construct an IFrameWindow object.

#### AIX Considerations

  The Open Class Library adds a Motif callback routine to all menu bars for processing selected menu bar items.

#### Windows Considerations

  To support menus loaded from a resource file, IMenuBar classes have the following requirements:

  - Menu resources must be defined using the MENUEX keyword.
  - Unique IDs must be provided for all pop-up menu items, indicated by the POPUP keyword.

### IMenuBar - Member Functions and Data by Group

### Constructors & Destructor

You can construct and destruct objects of this class. You cannot copy or assign IMenuBar objects because the copy constructor and assignment operator are private functions.

~IMenuBar

      public:
      virtual ~IMenuBar()

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

IMenuBar

  Overload 1

      public:
      IMenuBar( IFrameWindow* owner,
                const Style& style = defaultStyle ( ) )

  Creates an empty menu bar or a wrapper for an existing IFrameWindow menu bar. Use this constructor to create the following:

  - A menu bar with no entries, using the style IMenuBar::empty
  - A menu bar wrapper, using the style IMenuBar::wrapper

Exception

  IInvalidParameter | owner is 0. You must specify a valid IFrameWindow as the owner for the menu bar.
  IInvalidRequest | The style specified is invalid. Specify one of the styles IMenuBar::wrapper or IMenuBar::empty, but not both.
  IInvalidRequest | The style IMenuBar::wrapper was specified, but the frame window has no menu bar. Verify that the IFrameWindow::menuBar style was specified when the frame was created and that owner is the correct IFrameWindow.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2

      public:
      IMenuBar(const IResourceId& menuResId, IFrameWindow* owner)

  Creates a menu bar with a menu resource ID and a frame window owner. Use this constructor to create a menu bar for a frame window with a menu resource from your resource library.

Exception

  IInvalidParameter | owner is 0. You must specify a valid IFrameWindow as the owner for the menu bar.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

Windows Considerations

  To support menus loaded from a resource file, IMenuBar classes have the following requirements:

  - Menu resources must be defined using the MENUEX keyword.
  - Unique IDs must be provided for all pop-up menu items, indicated by the POPUP keyword.

### Replacing Menus

You can replace the menu currently being used on the menu bar with another menu.

setMenu

  Sets or changes the menu bar to the specified menu. The previous menu bar is destroyed.

  Overload 1

      public:
      virtual IMenuBar& setMenu(const IMenuHandle& menuHandle)

  The new menu is specified by its menu handle.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | No | No

  Overload 2

      public:
      virtual IMenuBar& setMenu(const IResourceId& menuResId)

  The new menu is specified by its menu id.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

Windows Considerations

  To support menus loaded from a resource file, IMenuBar classes have the following requirements:

  - Menu resources must be defined using the MENUEX keyword.
  - Unique IDs must be provided for all pop-up menu items, indicated by the POPUP keyword.

### Styles

IMenuBar defines objects of the nested class IMenuBar::Style. You can use these styles with the function IMenuBar::setDefaultStyle and a constructor for IMenuBar.

defaultStyle

      public:
      static Style defaultStyle()

  Returns the default style. The default style is IMenuBar::classDefaultStyle unless you have changed it using IMenuBar::setDefaultStyle.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setDefaultStyle

      public:
      static void setDefaultStyle(const Style& style)

  Sets the default style for all subsequent menu bars.

  This member function is not thread safe. In a multithreaded application, it should only be called when a conflict is not possible. A conflict can arise if you set the default style on one thread at the same time that it is being queried on another. In this situation, the query would take place while the style is in an unknown state.

  When you create a window class and do not specify window styles in the constructor, the Open Class Library queries the default style. Therefore, the only safe place to call this member function is when no other application threads that create windows are active.

  Another way to avoid a conflict in a multithreaded application is to specify window styles on window construction, rather than calling this member function.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

classDefaultStyle

      public:
      static const Style classDefaultStyle

  Specifies the original default style for this class, which is IMenuBar::empty.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

empty

      public:
      static const Style empty

  Creates a menu with no items. You can dynamically populate the menu using functions from IMenu and ISubmenu. You cannot specify this style with the IMenuBar::wrapper style.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

wrapper

      public:
      static const Style wrapper

  Specifies that the menu bar is a wrapper for an IFrameWindow menu bar, which you previously created using the style IFrameWindow::menuBar. You cannot specify this style with the IMenuBar::empty style.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### IMenuBar - Inherited Member Functions and Data

#### Inherited Public Functions

  IMenu

  -     virtual ~IMenu()

  -     virtual IMenu& add(IMenuItem& menuItem, Cursor& cursor)

  -     virtual IMenu&
          addAsNext( IMenuItem& menuItem,
                     Cursor& cursor )

  -     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&
          addBitmap( unsigned long newItemId,
                     const IBitmapHandle& itemBitmap,
                     unsigned long intoSubmenuId = 0 )

  -     virtual IMenu&
          addItem( IMenuItem& menuItem,
                   unsigned long intoSubmenuId = 0 )

  -     virtual IMenu&
          addSeparator( unsigned long intoSubmenuId = 0 )

  -     virtual IMenu&
          addSeparator( unsigned long newItemId,
                        unsigned long intoSubmenuId )

  -     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

  -     virtual IMenu& deleteAt(Cursor& cursor)

  -     virtual IMenu& deleteItem(unsigned long itemId)

  -     virtual IMenu& disableItem(unsigned long itemId)

  -     virtual IMenu& disableUpdate()

  -     virtual IMenuItem elementAt(const Cursor& cursor) const

  -     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

  -     virtual IMenuHandle menuHandle() 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

  INotifier

  -     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

  IStandardNotifier

  -     virtual ~IStandardNotifier()

  -     virtual IStandardNotifier& disableNotification()

  -     virtual IStandardNotifier&
          enableNotification( bool enable = true )

  -     virtual bool isEnabledForNotification() const

  -     IStandardNotifier(const IStandardNotifier& copy)

  -     IStandardNotifier()

  -     virtual INotifierAddress notifierAddress() const

  -     virtual IStandardNotifier&
          notifyObservers( const INotificationEvent& anEvent )

  -     virtual IStandardNotifier&
          notifyObserversAsync( const INotificationEvent& anEvent )

  -     IStandardNotifier&
          operator =( const IStandardNotifier& aStandardNotifier )

#### Inherited Public Data

  INotifier

  -     static INotificationId const allChangesId

  -     static INotificationId const deleteId

  IMenu

  -     static const Style noStyle

  -     static const Style visible

#### Inherited Protected Functions

  INotifier

  -     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) = 0

  -     virtual INotifier&
          removeObserver( IObserver& observer,
                          const IInterest& interest )

  IStandardNotifier

  -     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 )

  -     virtual IStandardNotifier&
          removeObserver( IObserver& observer,
                          const IInterest& interest )

  IMenu

  -     IMenu()

  -     void setWindow(IWindow* window)

#### Inherited Protected Data

  - None