Important: The information in this document is obsolete and should not be used for new development.
The Menu List
The menu list contains information about the menus in a menu bar, about submenus, and about pop-up menus. A menu list contains handles to the menu records of zero,
one, or more menus and contains other information that the Menu Manager uses to manage menus.The
InitMenus
procedure creates the current menu list of an application. The current menu list contains handles to the menu records of all menus currently in the menu bar and handles to the menu records of any submenus or pop-up menus inserted into the menu list by your application. The menu bar shows the titles, in order, of all menus (other than submenus or pop-up menus) in the menu list.The initial menu list created by
InitMenus
does not contain handles to any menus. The Menu Manager dynamically allocates storage in a menu list as menus are added to and deleted from the menu list.Your application should not directly change or access the information in a menu list. You should use Menu Manager routines to create a menu list and to add menus to or remove menus from the current menu list.
You typically define your application's menu bar in an
'MBAR'
resource and create a menu list using theGetNewMBar
function. TheGetNewMBar
function returns a handle to a menu list. You can set the current menu list to the menu list returned byGetNewMBar
using theSetMenuBar
procedure.The structure of the menu list is private to the Menu Manager. For conceptual purposes, however, its general structure is defined here.
TYPE DynamicMenuList = RECORD lastMenu: Integer; {offset to last pull-down menu} lastRight: Integer; {pixel location of right edge } { of rightmost menu in menu bar} mbResID: Integer; {upper 13 bits are the resource ID of menu } { bar defn function, low 3 bits the variant} menu: ARRAY[1..X] {variable array with one record for } OF MenuRec; { each menu} lastHMenu: Integer; {offset to last submenu or pop-up menu} menuTitleSave: {handle to bits behind inverted menu title} pixMapHandle; hMenu: ARRAY[1..Y] {variable array with one record for } OF HMenuRec;{ each submenu or pop-up menu} END;The Menu Manager dynamically allocates the records that contain handles to the menu records of menus in the menu bar, submenus, and pop-up menus. These records can be defined conceptually as theMenuRec
andHMenuRec
data types. The Menu Manager uses a data structure similar to that of theMenuRec
data type to store information about pull-down menus in the menu list.
TYPE MenuRec = RECORD menuOH: MenuHandle; {handle to menu's menu record} menuLeft: Integer; {pixel location of left edge } { of this menu} END;The Menu Manager stores information about submenus and pop-up menus at the end of a menu list in a data structure similar to that of theHMenuRec
data type.
TYPE HMenuRec = RECORD menuHOH: MenuHandle; {handle to menu's menu record} reserved: Integer; {reserved} END;