Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Macintosh Toolbox Essentials /
Chapter 3 - Menu Manager / About the Menu Manager


How the Menu Manager Maintains Information About an Application's Menu Bar

A menu list contains handles to the menu records of one or more menus (although a menu list can be empty). The end of a menu list can contain handles to the menu
records of submenus and pop-up menus; the phrase submenu portion of the menu list refers to this portion of the menu list, which contains information about submenus
and pop-up menus.

When your application initializes the Menu Manager, the Menu Manager allocates the current menu list, which is initially empty. The contents of the current menu list change as your application adds menus to or removes menus from it.

The current menu list contains handles to the menu records of all menus in the current menu bar and the menu records of any submenus or pop-up menus that you have inserted into the current menu list. Your application typically creates a menu list using GetNewMBar, and it then sets the current menu list to its newly created menu list using SetMenuBar. You can insert other menus in the current menu list using the GetMenu function and InsertMenu procedure.

The Menu Manager displays the menu bar and the titles of all pull-down menus that
are defined in the current menu list when your application calls the DrawMenuBar procedure. The Menu Manager displays the menus in the menu bar in the same order that they appear in the current menu list.

The Menu Manager provides routines for adding menus to and removing menus from the current menu list; your application should never access a menu list directly. To refer to a menu list, use the handle returned by GetNewMBar or GetMenuBar.

The Menu Manager inserts the Help menu, the Keyboard menu if necessary, and the Application menu into your application's menu list if your application calls the GetNewMBar function and your menu bar includes an Apple menu; your application then uses SetMenuBar to set the current menu list to the newly created menu list. The Menu Manager also inserts these menus into your application's current menu list if your application inserts the Apple menu into the current menu list using the InsertMenu procedure. Therefore, you should not make any assumptions about the last menu (or menus) in your application's current menu list.

When your application inserts a submenu into the current menu list, the Menu Manager stores a handle to the menu record of the submenu in the submenu portion of the current menu list. Similarly, when your application inserts a pop-up menu into the current menu list, the Menu Manager stores a handle to the menu record of the pop-up menu in the submenu portion of the current menu list.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996