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 / Introduction to Menus


Menu and Menu Bar Definition Routines

The menu definition procedure and menu bar definition function define the general appearance and behavior of menus. The Menu Manager uses these routines to display and perform basic operations on menus and the menu bar.

A menu definition procedure performs all the drawing of menu items within a menu. When you define a menu, you specify its menu definition procedure. The Menu Manager uses the specified menu definition procedure to draw the menu items in a menu, determine which item the user chose from a menu, insert scrolling indicators as items in a menu, and calculate the menu's dimensions.

A menu bar definition function draws the menu bar and performs most of the drawing activities related to the display of menus when the user moves the cursor between them. Unless you specify otherwise, the Menu Manager uses the standard menu bar definition function to manage your application's menu bar. The Menu Manager uses the standard menu bar definition function to draw the menu bar, clear the menu bar, determine whether the cursor is in the menu bar or any currently displayed menu, calculate the left edges of menu titles, highlight a menu title, invert the entire menu bar, erase the background color of a menu and draw the menu's structure (shadow), and save or restore the bits behind a menu.

Apple provides a standard menu definition procedure and standard menu bar definition function. These definition routines are stored as resources in the System file. The standard menu definition procedure is the 'MDEF' resource with resource ID 0. The standard menu bar definition function is the 'MBDF' resource with resource ID 0.

When you define your menus and menu bar, you specify the definition routines that the Menu Manager should use when managing them. You'll usually want to use the standard definition routines for your application. However, if you need a feature not provided by the standard menu definition procedure (for example, if you want to include more graphics in your menus), you can choose to write your own menu definition procedure. See "Writing Your Own Menu Definition Procedure" beginning on page 3-89 for more information. While the Menu Manager does allow you to specify your own menu bar definition function, Apple recommends that you use the standard menu bar definition function.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996