Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5998 lines
185 KiB

  1. /*
  2. File: Menus.h
  3. Contains: Menu Manager Interfaces.
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1985-2001 by Apple Computer, Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __MENUS__
  11. #define __MENUS__
  12. #ifndef __MACTYPES__
  13. #include <MacTypes.h>
  14. #endif
  15. #ifndef __MACERRORS__
  16. #include <MacErrors.h>
  17. #endif
  18. #ifndef __TEXTCOMMON__
  19. #include <TextCommon.h>
  20. #endif
  21. #ifndef __COLLECTIONS__
  22. #include <Collections.h>
  23. #endif
  24. #ifndef __CFSTRING__
  25. #include <CFString.h>
  26. #endif
  27. #ifndef __CFUUID__
  28. #include <CFUUID.h>
  29. #endif
  30. #ifndef __FONTS__
  31. #include <Fonts.h>
  32. #endif
  33. #ifndef __QUICKDRAW__
  34. #include <Quickdraw.h>
  35. #endif
  36. #ifndef __APPLEEVENTS__
  37. #include <AppleEvents.h>
  38. #endif
  39. #ifndef __PROCESSES__
  40. #include <Processes.h>
  41. #endif
  42. #ifndef __CARBONEVENTSCORE__
  43. #include <CarbonEventsCore.h>
  44. #endif
  45. #ifndef __EVENTS__
  46. #include <Events.h>
  47. #endif
  48. #ifndef __HIOBJECT__
  49. #include <HIObject.h>
  50. #endif
  51. #if PRAGMA_ONCE
  52. #pragma once
  53. #endif
  54. #ifdef __cplusplus
  55. extern "C" {
  56. #endif
  57. #if PRAGMA_IMPORT
  58. #pragma import on
  59. #endif
  60. #if PRAGMA_STRUCT_ALIGN
  61. #pragma options align=mac68k
  62. #elif PRAGMA_STRUCT_PACKPUSH
  63. #pragma pack(push, 2)
  64. #elif PRAGMA_STRUCT_PACK
  65. #pragma pack(2)
  66. #endif
  67. /*
  68. * Menu Manager
  69. */
  70. /*--------------------------------------------------------------------------------------*/
  71. /* o Menu Constants */
  72. /*--------------------------------------------------------------------------------------*/
  73. enum {
  74. noMark = 0 /* mark symbol for SetItemMark; other mark symbols are defined in Fonts.h */
  75. };
  76. /*
  77. A Short Course on Menu Definition Functions
  78. A menu definition function is used to implement a custom visual appearance for a menu.
  79. Menu definition functions are still supported in Carbon, but the messages sent to a
  80. menu definition function in Carbon are different than for a non-Carbon application.
  81. In general, Apple recommends using the system menu definition whenever possible.
  82. Menu definition functions will continue to be supported, but it is not easy to write
  83. a correct menu definition, especially one that attempts to imitate the standard system
  84. menu appearance. If you require special features in your menu that the system menu
  85. definition does not support, please mail <toolbox@apple.com> and describe your requirements;
  86. we would much rather enhance the system menu definition than have you write a custom one.
  87. Menu definition functions before Carbon used the following messages:
  88. kMenuDrawMsg
  89. kMenuChooseMsg
  90. kMenuSizeMsg
  91. kMenuPopUpMsg
  92. kMenuDrawItemMsg
  93. kMenuCalcItemMsg
  94. kMenuThemeSavvyMsg
  95. kMenuChooseMsg and kMenuDrawItemMsg are not supported in Carbon and are not sent to
  96. Carbon menu definitions. In Carbon, kMenuChooseMsg is replaced by kMenuFindItemMsg and
  97. kMenuHiliteItemMsg. Menu definition functions in Carbon use the following messages:
  98. kMenuInitMsg
  99. kMenuDisposeMsg
  100. kMenuFindItemMsg
  101. kMenuHiliteItemMsg
  102. kMenuDrawItemsMsg
  103. kMenuDrawMsg
  104. kMenuSizeMsg
  105. kMenuPopUpMsg
  106. kMenuCalcItemMsg
  107. kMenuThemeSavvyMsg
  108. The rest of this documentation will focus on Carbon menu definitions only.
  109. Menu Definition Messages
  110. Carbon menu definition functions should support the following messages:
  111. kMenuInitMsg
  112. menuRect unused
  113. hitPt unused
  114. whichItem OSErr*
  115. Sent when a menu is created. This message gives the menu definition an opportunity
  116. to initialize its own state. If the menu definition encounters an error while
  117. initializing, it should set *whichItem to a non-zero error code; this will cause the
  118. Menu Manager to destroy the menu and return an error back from the API that was used
  119. to create the menu.
  120. kMenuDisposeMsg
  121. menuRect unused
  122. hitPt unused
  123. whichItem unused
  124. Sent when a menu is destroyed. This message gives the menu definition an opportunity
  125. to destroy its own data.
  126. kMenuFindItemMsg
  127. menuRect menu bounds
  128. hitPt point to hit-test
  129. whichItem MDEFFindItemData*
  130. Sent when the Menu Manager is displaying a menu and needs to know what item is under
  131. the mouse. The whichItem parameter is actually a pointer to a MenuTrackingData structure.
  132. On entry, the menu, virtualMenuTop, and virtualMenuBottom fields of this structure are
  133. valid. The menu definition should determine which item containst the given point, if any,
  134. and fill in the itemUnderMouse, itemSelected, and itemRect fields. If an item is found,
  135. the menu definition should always fill in the itemUnderMouse and itemRect fields. The
  136. menu definition should only fill in the itemSelected field if the item is available for
  137. selection; if it is unavailable (because it is disabled, or for some other reason), the
  138. menu definition should set the itemSelected field to zero.
  139. The values placed in the itemUnderMouse and itemSelected fields should be less than or
  140. equal to the number of items returned by CountMenuItems on this menu.
  141. The menu definition should not hilite the found item during this message. The Menu
  142. Manager will send a separate kMenuHiliteItemMsg to request hiliting of the item.
  143. If the menu definition supports scrolling, it should scroll the menu during this message,
  144. and update the virtualMenuTop and virtualMenuBottom fields of the MenuTrackingData to
  145. indicate the menu's new scrolled position.
  146. If the menu definition uses QuickDraw to draw while scrolling, it should draw into the
  147. current port.
  148. If the menu definition uses CoreGraphics to draw while scrolling, it should use the
  149. CGContextRef passed in the context field of the MDEFHiliteItemData structure.
  150. Menu definitions must use the ScrollMenuImage API, if available, to scroll the menu contents.
  151. This API is available in CarbonLib 1.5 and later, and in Mac OS X 10.1 and later. ScrollMenuImage
  152. properly supports scrolling the alpha channel in the menu's image data. Use of QuickDraw's
  153. ScrollRect API to scroll the menu contents will result in the alpha channel being set to 0xFF
  154. (opaque) and the menu will no longer be transparent.
  155. The menu definition should not modify the menu field of the MenuTrackingData.
  156. kMenuHiliteItemMsg
  157. menuRect menu bounds
  158. hitPt unused
  159. whichItem MDEFHiliteItemData*
  160. Sent when the Menu Manager is displaying a menu and needs to hilite a newly selected
  161. item. The whichItem parameter is actually a pointer to a MDEFHiliteItemData structure.
  162. The menu definition should unhilite the item in the previousItem field, if non-zero,
  163. and hilite the item in the newItem field.
  164. Menu definitions should use the EraseMenuBackground API to erase the old menu contents
  165. before unhiliting a menu item, if the menu definition is using the Appearance Manager's
  166. menu drawing APIs. This is necessary because the background of a menu is transparent on
  167. Aqua, and if the old hilite is not erased first, it will show through the new unhilited
  168. menu background.
  169. If the menu definition uses QuickDraw to draw, it should draw into the current port.
  170. If the menu definition uses CoreGraphics to draw, it should use the CGContextRef passed
  171. in the context field of the MDEFHiliteItemData structure.
  172. kMenuDrawItemsMsg
  173. menuRect menu bounds
  174. hitPt unused
  175. whichItem MDEFDrawItemsData*
  176. Sent when the Menu Manager is displaying a menu and needs to redraw a portion of the
  177. menu. This message is used by the dynamic menu item support code in the Menu Manager;
  178. for example, if items five and six in a menu are a dynamic group, the Menu Manager will
  179. send a DrawItems message when the group's modifier key is pressed or released to redraw
  180. the appropriate item, but no other items in the menu.
  181. The whichItem parameter for this message is actually a pointer to a MDEFDrawItemsData
  182. structure. The menu definition should redraw the items starting with firstItem and
  183. ending with lastItem, inclusive.
  184. If the menu definition uses QuickDraw to draw, it should draw into the current port.
  185. If the menu definition uses CoreGraphics to draw, it should use the CGContextRef passed
  186. in the context field of the MDEFDrawItemsData structure.
  187. kMenuDrawMsg
  188. menuRect menu bounds
  189. hitPt unused
  190. whichItem MDEFDrawData*
  191. Sent when the Menu Manager is displaying a menu and needs to redraw the entire menu.
  192. The whichItem parameter is actually a pointer to a MenuTrackingData structure. On entry,
  193. the menu field of this structure is valid. The menu definition should draw the menu and,
  194. if it supports scrolling, should also fill in the virtualMenuTop and virtualMenuBottom
  195. fields of the structure to indicate the menu's initial unscrolled position; typically,
  196. virtualMenuTop would be set to the same value as the top coordinate of the menu rect,
  197. and virtualMenuBottom would be set to virtualMenuTop plus the virtual height of the menu.
  198. If the menu definition uses QuickDraw to draw, it should draw into the current port.
  199. If the menu definition uses CoreGraphics to draw, it should use the CGContextRef passed
  200. in the context field of the MDEFDrawData structure.
  201. kMenuSizeMsg
  202. menuRect unused
  203. hitPt maximum width and height of the menu
  204. whichItem unused
  205. Sent when the Menu Manager needs to determine the size of a menu. The menu definition
  206. should calculate the width and height of the menu and store the sizes into the menu with
  207. SetMenuWidth and SetMenuHeight.
  208. If the gestaltMenuMgrSendsMenuBoundsToDefProc bit is set in the Menu Manager's Gestalt
  209. value, then the hitPt parameter to this message is the maximum width (hitPt.h) and height
  210. (hitPt.v) of the menu. The menu definition should ensure that the width and height that it
  211. places in the menu do not exceed these values. If the gestalt bit is not set, the menu
  212. definition should just use the main GDevice's width and height as constraints on the menu's
  213. width and height.
  214. kMenuPopUpMsg
  215. menuRect on entry, constraints on the menu's position; on exit, menu bounds
  216. hitPt requested menu location, with swapped coordinates
  217. whichItem on entry, requested initial selection; on exit, virtual menu top
  218. Sent when the Menu Manager is about to display a popup menu. The menu definition should
  219. calculate the appropriate menu bounds to contain the menu based on the requested menu
  220. location and selected item. It should write the menuBounds into the rect given by the
  221. menuRect parameter.
  222. If the gestaltMenuMgrSendsMenuBoundsToDefProc bit is set in the Menu Manager's Gestalt
  223. value, then the menuRect parameter on entry to this message contains a constraint rect,
  224. in global coordinates, outside of which the popup menu should not be positioned. The menu
  225. definition should take this constraint rect into account as it calculates the menu bounds.
  226. If the gestalt bit is not set, the menu definition should use the bounds of the GDevice
  227. containing the menu's top left corner as a constraint on the menu's position.
  228. The hitPt parameter is a requested location for the top left corner of the menu. The
  229. coordinates of this parameter are swapped from their normal order; the h field of the
  230. hitPt parameter contains the vertical coordinate, and the v field of hitPt contains
  231. the horizontal coordinate.
  232. On entry, the whichItem parameter points at a menu item index which is requested to be
  233. the initial selection when the menu is displayed. After calculating the menu's bounds,
  234. the menu definition should write the menu's virtual top coordinate into the location
  235. pointed at by the whichItem parameter. If displaying the menu at the requested location
  236. does not require scrolling, the virtual top will be the same as the menu bounds top;
  237. if the menu must scroll to fit in the requested location, the virtual top may be different.
  238. kMenuCalcItemMsg
  239. menuRect on exit, item bounds
  240. hitPt unused
  241. whichItem the item whose rect to calculate
  242. Sent when the Menu Manager needs to know the bounds of a menu item. The menu definition
  243. should calculate the size of the item specified by the whichItem parameter, and store
  244. the bounds in the rect specified by the menuRect parameter.
  245. Some sample menu definition code provided by Apple has previously shown an implementation
  246. of this message that always sets the top left corner of the item bounds to (0,0), regardless
  247. of the item's actual position in the menu. For best future compatibility, menu definitions
  248. should begin storing an item bounds that gives the item's actual position in the menu based
  249. on the menu's current virtual top. For example, if the virtual menu top starts at 20, then
  250. the menu definition would calculate an item bounds for the first item that starts at (0,20),
  251. an item bounds for the second item that starts at (0,40), and so on. The menu definition
  252. should call GetMenuTrackingData to get the menu's current virtual position, and use zero
  253. for the menu top if GetMenuTrackingData returns an error.
  254. kMenuThemeSavvyMsg
  255. menuRect unused
  256. hitPt unused
  257. whichItem on exit, indicates theme-savvyness of the menu definition
  258. Sent by the Menu Manager to determine whether the MDEF uses the Appearance Manager
  259. menu-drawing functions to draw its menu. If it does, the menu definition should return
  260. kThemeSavvyMenuResponse in the location pointed to by whichItem. If the menu definition
  261. draws its own custom content without using the Appearance Manager menu-drawing functions,
  262. it should ignore this message.
  263. Low-memory Global Replacements
  264. Pre-Carbon menu definitions needed to use several low-memory globals to communicate with the
  265. Menu Manager. These globals have all been replaced or made obsolete in Carbon, as follows:
  266. MenuDisable
  267. MenuDisable is now set automatically by the Menu Manager using the value returned in the
  268. itemUnderMouse field of the MenuTrackingData structure passed to kMenuFindItemMsg.
  269. TopMenuItem
  270. AtMenuBottom
  271. TopMenuItem and AtMenuBottom are now set automatically by the Menu Manager using the
  272. values returned in the virtualMenuTop and virtualMenuBottom fields of the MenuTrackingData
  273. structure passed to kMenuDrawMsg and kMenuFindItemMsg.
  274. mbSaveLoc
  275. This undocumented low-memory global was used by pre-Carbon menu definitions to store
  276. the bounding rect of the currently selected item and to avoid drawing glitches while
  277. the menu definition was scrolling the contents of a menu that had submenus. The Menu
  278. Manager now automatically sets the selected item bounds using the value returned in
  279. the itemRect field of the MenuTrackingData structure passed to kMenuFindItemMsg. In
  280. order to correctly support scrolling of menus with submenus, a menu definition should
  281. verify, before scrolling the menu contents, that no submenus of the scrolling menu are
  282. currently visible. A menu definition can use GetMenuTrackingData to verify this condition,
  283. as follows:
  284. Boolean SafeToScroll( MenuRef menuBeingScrolled )
  285. {
  286. MenuTrackingData lastMenuData;
  287. return GetMenuTrackingData( NULL, &lastMenuData ) == noErr
  288. && lastMenuData.menu == menuBeingScrolled;
  289. }
  290. If SafeToScroll returns false, the menu definition should not scroll the menu.
  291. */
  292. enum {
  293. /* menu defProc messages */
  294. kMenuDrawMsg = 0,
  295. kMenuSizeMsg = 2,
  296. kMenuPopUpMsg = 3,
  297. kMenuCalcItemMsg = 5,
  298. kMenuThemeSavvyMsg = 7, /* is your MDEF theme-savvy? If so, return kThemeSavvyMenuResponse in the whichItem parameter*/
  299. mDrawMsg = 0,
  300. mSizeMsg = 2,
  301. mPopUpMsg = 3, /* position the popup menu rect appropriately */
  302. mCalcItemMsg = 5
  303. };
  304. #if CALL_NOT_IN_CARBON
  305. /*
  306. Carbon MDEFs must replace mChooseMsg with the new messages kMenuFindItemMsg and kMenuHiliteItemMsg.
  307. mDrawItemMsg was used by the popup menu control before 8.5, but is no longer used.
  308. */
  309. enum {
  310. mChooseMsg = 1,
  311. mDrawItemMsg = 4,
  312. kMenuChooseMsg = 1,
  313. kMenuDrawItemMsg = 4
  314. };
  315. #endif /* CALL_NOT_IN_CARBON */
  316. enum {
  317. kThemeSavvyMenuResponse = 0x7473 /* should be returned in *whichItem when handling kMenuThemeSavvyMsg*/
  318. };
  319. /* these MDEF messages are only supported in Carbon*/
  320. enum {
  321. kMenuInitMsg = 8,
  322. kMenuDisposeMsg = 9,
  323. kMenuFindItemMsg = 10,
  324. kMenuHiliteItemMsg = 11,
  325. kMenuDrawItemsMsg = 12
  326. };
  327. enum {
  328. textMenuProc = 0,
  329. hMenuCmd = 27, /*itemCmd == 0x001B ==> hierarchical menu*/
  330. hierMenu = -1, /*a hierarchical menu - for InsertMenu call*/
  331. kInsertHierarchicalMenu = -1, /*a better name for hierMenu */
  332. mctAllItems = -98, /*search for all Items for the given ID*/
  333. mctLastIDIndic = -99 /*last color table entry has this in ID field*/
  334. };
  335. /* Constants for use with MacOS 8.0 (Appearance 1.0) and later*/
  336. enum {
  337. kMenuStdMenuProc = 63,
  338. kMenuStdMenuBarProc = 63
  339. };
  340. /* For use with Get/SetMenuItemModifiers*/
  341. enum {
  342. kMenuNoModifiers = 0, /* Mask for no modifiers*/
  343. kMenuShiftModifier = (1 << 0), /* Mask for shift key modifier*/
  344. kMenuOptionModifier = (1 << 1), /* Mask for option key modifier*/
  345. kMenuControlModifier = (1 << 2), /* Mask for control key modifier*/
  346. kMenuNoCommandModifier = (1 << 3) /* Mask for no command key modifier*/
  347. };
  348. /* For use with Get/SetMenuItemIconHandle*/
  349. enum {
  350. kMenuNoIcon = 0, /* No icon*/
  351. kMenuIconType = 1, /* Type for ICON*/
  352. kMenuShrinkIconType = 2, /* Type for ICON plotted 16 x 16*/
  353. kMenuSmallIconType = 3, /* Type for SICN*/
  354. kMenuColorIconType = 4, /* Type for cicn*/
  355. kMenuIconSuiteType = 5, /* Type for Icon Suite*/
  356. kMenuIconRefType = 6, /* Type for Icon Ref*/
  357. kMenuCGImageRefType = 7, /* Type for a CGImageRef (Mac OS X only)*/
  358. kMenuSystemIconSelectorType = 8, /* Type for an IconRef registered with Icon Services under kSystemIconsCreator (Mac OS X 10.1 and later only)*/
  359. kMenuIconResourceType = 9 /* Type for a CFStringRef naming a resource in the main bundle of the process (Mac OS X 10.1 and later only)*/
  360. };
  361. /* For use with Get/SetMenuItemKeyGlyph*/
  362. enum {
  363. kMenuNullGlyph = 0x00, /* Null (always glyph 1)*/
  364. kMenuTabRightGlyph = 0x02, /* Tab to the right key (for left-to-right script systems)*/
  365. kMenuTabLeftGlyph = 0x03, /* Tab to the left key (for right-to-left script systems)*/
  366. kMenuEnterGlyph = 0x04, /* Enter key*/
  367. kMenuShiftGlyph = 0x05, /* Shift key*/
  368. kMenuControlGlyph = 0x06, /* Control key*/
  369. kMenuOptionGlyph = 0x07, /* Option key*/
  370. kMenuSpaceGlyph = 0x09, /* Space (always glyph 3) key*/
  371. kMenuDeleteRightGlyph = 0x0A, /* Delete to the right key (for right-to-left script systems)*/
  372. kMenuReturnGlyph = 0x0B, /* Return key (for left-to-right script systems)*/
  373. kMenuReturnR2LGlyph = 0x0C, /* Return key (for right-to-left script systems)*/
  374. kMenuNonmarkingReturnGlyph = 0x0D, /* Nonmarking return key*/
  375. kMenuPencilGlyph = 0x0F, /* Pencil key*/
  376. kMenuDownwardArrowDashedGlyph = 0x10, /* Downward dashed arrow key*/
  377. kMenuCommandGlyph = 0x11, /* Command key*/
  378. kMenuCheckmarkGlyph = 0x12, /* Checkmark key*/
  379. kMenuDiamondGlyph = 0x13, /* Diamond key*/
  380. kMenuAppleLogoFilledGlyph = 0x14, /* Apple logo key (filled)*/
  381. kMenuParagraphKoreanGlyph = 0x15, /* Unassigned (paragraph in Korean)*/
  382. kMenuDeleteLeftGlyph = 0x17, /* Delete to the left key (for left-to-right script systems)*/
  383. kMenuLeftArrowDashedGlyph = 0x18, /* Leftward dashed arrow key*/
  384. kMenuUpArrowDashedGlyph = 0x19, /* Upward dashed arrow key*/
  385. kMenuRightArrowDashedGlyph = 0x1A, /* Rightward dashed arrow key*/
  386. kMenuEscapeGlyph = 0x1B, /* Escape key*/
  387. kMenuClearGlyph = 0x1C, /* Clear key*/
  388. kMenuLeftDoubleQuotesJapaneseGlyph = 0x1D, /* Unassigned (left double quotes in Japanese)*/
  389. kMenuRightDoubleQuotesJapaneseGlyph = 0x1E, /* Unassigned (right double quotes in Japanese)*/
  390. kMenuTrademarkJapaneseGlyph = 0x1F, /* Unassigned (trademark in Japanese)*/
  391. kMenuBlankGlyph = 0x61, /* Blank key*/
  392. kMenuPageUpGlyph = 0x62, /* Page up key*/
  393. kMenuCapsLockGlyph = 0x63, /* Caps lock key*/
  394. kMenuLeftArrowGlyph = 0x64, /* Left arrow key*/
  395. kMenuRightArrowGlyph = 0x65, /* Right arrow key*/
  396. kMenuNorthwestArrowGlyph = 0x66, /* Northwest arrow key*/
  397. kMenuHelpGlyph = 0x67, /* Help key*/
  398. kMenuUpArrowGlyph = 0x68, /* Up arrow key*/
  399. kMenuSoutheastArrowGlyph = 0x69, /* Southeast arrow key*/
  400. kMenuDownArrowGlyph = 0x6A, /* Down arrow key*/
  401. kMenuPageDownGlyph = 0x6B, /* Page down key*/
  402. kMenuAppleLogoOutlineGlyph = 0x6C, /* Apple logo key (outline)*/
  403. kMenuContextualMenuGlyph = 0x6D, /* Contextual menu key*/
  404. kMenuPowerGlyph = 0x6E, /* Power key*/
  405. kMenuF1Glyph = 0x6F, /* F1 key*/
  406. kMenuF2Glyph = 0x70, /* F2 key*/
  407. kMenuF3Glyph = 0x71, /* F3 key*/
  408. kMenuF4Glyph = 0x72, /* F4 key*/
  409. kMenuF5Glyph = 0x73, /* F5 key*/
  410. kMenuF6Glyph = 0x74, /* F6 key*/
  411. kMenuF7Glyph = 0x75, /* F7 key*/
  412. kMenuF8Glyph = 0x76, /* F8 key*/
  413. kMenuF9Glyph = 0x77, /* F9 key*/
  414. kMenuF10Glyph = 0x78, /* F10 key*/
  415. kMenuF11Glyph = 0x79, /* F11 key*/
  416. kMenuF12Glyph = 0x7A, /* F12 key*/
  417. kMenuF13Glyph = 0x87, /* F13 key*/
  418. kMenuF14Glyph = 0x88, /* F14 key*/
  419. kMenuF15Glyph = 0x89, /* F15 key*/
  420. kMenuControlISOGlyph = 0x8A, /* Control key (ISO standard)*/
  421. kMenuEjectGlyph = 0x8C /* Eject key (available on Jaguar and later)*/
  422. };
  423. /*
  424. * MenuAttributes
  425. *
  426. * Summary:
  427. * Menu attributes control behavior of the entire menu. They are
  428. * used with the Get/ChangeMenuAttributes APIs.
  429. */
  430. typedef UInt32 MenuAttributes;
  431. enum {
  432. /*
  433. * No column space is allocated for the mark character when this menu
  434. * is drawn.
  435. */
  436. kMenuAttrExcludesMarkColumn = (1 << 0),
  437. /*
  438. * The menu title is automatically disabled when all items are
  439. * disabled.
  440. */
  441. kMenuAttrAutoDisable = (1 << 2),
  442. /*
  443. * The pencil glyph from the Keyboard font (kMenuPencilGlyph) is used
  444. * to draw the Control modifier key in menu keyboard equivalents.
  445. * This appearance is typically used only by Japanese input method
  446. * menus.
  447. */
  448. kMenuAttrUsePencilGlyph = (1 << 3),
  449. /*
  450. * The menu title is not drawn in the menubar, even when the menu is
  451. * inserted in the menubar. Useful for adding command keys that don't
  452. * correspond to a visible menu item; menu items with the desired
  453. * command keys can be added to the menu and inserted in the menubar
  454. * without making the menu visible. This attribute is available in
  455. * Mac OS X after 10.1.
  456. */
  457. kMenuAttrHidden = (1 << 4)
  458. };
  459. /*
  460. * MenuItemAttributes
  461. *
  462. * Summary:
  463. * Menu item attributes control behavior of individual menu items.
  464. * They are used with the Get/ChangeMenuItemAttributes APIs.
  465. */
  466. typedef UInt32 MenuItemAttributes;
  467. enum {
  468. /*
  469. * This item is disabled.
  470. */
  471. kMenuItemAttrDisabled = (1 << 0),
  472. /*
  473. * This item's icon is disabled.
  474. */
  475. kMenuItemAttrIconDisabled = (1 << 1),
  476. /*
  477. * Allows the parent item of a submenu to be selectable.
  478. */
  479. kMenuItemAttrSubmenuParentChoosable = (1 << 2),
  480. /*
  481. * This item changes dynamically based on modifier key state.
  482. */
  483. kMenuItemAttrDynamic = (1 << 3),
  484. /*
  485. * This item is not part of the same dynamic group as the previous
  486. * item.
  487. */
  488. kMenuItemAttrNotPreviousAlternate = (1 << 4),
  489. /*
  490. * This item is not drawn when the menu is displayed. It is also not
  491. * included in command key matching, unless the item also has either
  492. * the Dynamic or IncludeInCmdKeyMatching attributes.
  493. */
  494. kMenuItemAttrHidden = (1 << 5),
  495. /*
  496. * This item is a separator; the text of the item is ignored.
  497. */
  498. kMenuItemAttrSeparator = (1 << 6),
  499. /*
  500. * This item is a menu section header; it is disabled and
  501. * unselectable.
  502. */
  503. kMenuItemAttrSectionHeader = (1 << 7),
  504. /*
  505. * Metacharacters in the text of this item (such as the dash) are
  506. * ignored.
  507. */
  508. kMenuItemAttrIgnoreMeta = (1 << 8),
  509. /*
  510. * This item is recognized by IsMenuKeyEvent when it is passed an
  511. * auto-repeat keyboard event.
  512. */
  513. kMenuItemAttrAutoRepeat = (1 << 9),
  514. /*
  515. * When MenuEvent and IsMenuKeyEvent compare this item's keyboard
  516. * equivalent against a keyboard event, they use the item's virtual
  517. * keycode equivalent rather than its character code equivalent.
  518. */
  519. kMenuItemAttrUseVirtualKey = (1 << 10),
  520. /*
  521. * This item is drawn in a customized fashion by the application.
  522. * Causes custom menu item drawing Carbon events to be sent. This
  523. * attribute is available in CarbonLib 1.4 and Mac OS X 10.1, and
  524. * later.
  525. */
  526. kMenuItemAttrCustomDraw = (1 << 11),
  527. /*
  528. * This item is examined during command key matching by MenuKey,
  529. * MenuEvent, and IsMenuKeyEvent. Normally, visible menu items are
  530. * included in command key matching, but hidden menu items are
  531. * excluded (unless the item also has the Dynamic menu item
  532. * attribute). The IncludeInCmdKeyMatching attribute can be used to
  533. * force a hidden, non-dynamic menu item to be included in command
  534. * key matching when it normally wouldn't. This attribute is
  535. * available in CarbonLib 1.6 and later, and in Mac OS X after 10.1.
  536. */
  537. kMenuItemAttrIncludeInCmdKeyMatching = (1 << 12)
  538. };
  539. /*
  540. * MenuTrackingMode
  541. *
  542. * Summary:
  543. * A menu tracking mode constant is part of the
  544. * kEventMenuBeginTracking and kEventMenuChangeTrackingMode Carbon
  545. * events. It indicates whether menus are being tracked using the
  546. * mouse or keyboard.
  547. */
  548. typedef UInt32 MenuTrackingMode;
  549. enum {
  550. /*
  551. * Menus are being tracked using the mouse.
  552. */
  553. kMenuTrackingModeMouse = 1,
  554. /*
  555. * Menus are being tracked using the keyboard.
  556. */
  557. kMenuTrackingModeKeyboard = 2
  558. };
  559. /*
  560. * MenuEventOptions
  561. *
  562. * Summary:
  563. * Menu event options control how the menus are searched for an item
  564. * matching a particular keyboard event. They are used with the
  565. * IsMenuKeyEvent API.
  566. */
  567. typedef UInt32 MenuEventOptions;
  568. enum {
  569. /*
  570. * Disabled items are examined for a match.
  571. */
  572. kMenuEventIncludeDisabledItems = 0x0001,
  573. /*
  574. * Don't hilite the menu title if a match is found.
  575. */
  576. kMenuEventQueryOnly = 0x0002,
  577. /*
  578. * Don't look for a match in submenus of the starting menu.
  579. */
  580. kMenuEventDontCheckSubmenus = 0x0004
  581. };
  582. /*--------------------------------------------------------------------------------------*/
  583. /* o Menu Types */
  584. /*--------------------------------------------------------------------------------------*/
  585. typedef SInt16 MenuID;
  586. typedef UInt16 MenuItemIndex;
  587. typedef UInt32 MenuCommand;
  588. #if !OPAQUE_TOOLBOX_STRUCTS
  589. struct MenuInfo {
  590. MenuID menuID; /* in Carbon use Get/SetMenuID*/
  591. short menuWidth; /* in Carbon use Get/SetMenuWidth*/
  592. short menuHeight; /* in Carbon use Get/SetMenuHeight*/
  593. Handle menuProc; /* not supported in Carbon*/
  594. long enableFlags; /* in Carbon use Enable/DisableMenuItem, IsMenuItemEnable*/
  595. Str255 menuData; /* in Carbon use Get/SetMenuTitle*/
  596. };
  597. typedef struct MenuInfo MenuInfo;
  598. typedef MenuInfo * MenuPtr;
  599. typedef MenuPtr * MenuHandle;
  600. typedef MenuHandle MenuRef;
  601. #else
  602. typedef struct OpaqueMenuRef* MenuRef;
  603. /* MenuHandle is old name for MenuRef*/
  604. typedef MenuRef MenuHandle;
  605. #endif /* !OPAQUE_TOOLBOX_STRUCTS */
  606. /*
  607. A MenuBarHandle is a handle to a MenuBarHeader. An instance of this structure is returned
  608. by the GetMenuBar and GetNewMBar APIs. It is typedef'd to a plain Handle to retain
  609. source compatibility with previous versions of this header file.
  610. */
  611. typedef Handle MenuBarHandle;
  612. /*
  613. * MenuBarHeader
  614. *
  615. * Summary:
  616. * This structure is contained in a MenuBarHandle. It contains a
  617. * list of the non-hierarchical menus that have been inserted into
  618. * the menubar.
  619. *
  620. * Discussion:
  621. * The MenuBarHandle is a dynamically sized object which cannot be
  622. * directly expressed as a C or Pascal structure. First is the
  623. * MenuBarHeader structure, followed by a dynamically sized array of
  624. * MenuBarMenus, one for each menu. This array is followed by the
  625. * HMenuBarHeader, followed by another dynamically sized array of
  626. * HMenuBarMenus, one for each hierarchical menu.
  627. */
  628. struct MenuBarHeader {
  629. /*
  630. * Offset in bytes from the start of the header to the last menu in
  631. * the array of MenuBarMenus.
  632. */
  633. UInt16 lastMenu;
  634. /*
  635. * Global coordinate of the right edge of the rightmost menu; unused
  636. * in a MenuBarHandle returned by GetMenuBar or GetNewMBar.
  637. */
  638. SInt16 lastRight;
  639. /*
  640. * The MBDF resource ID; unused in a MenuBarHandle returned by
  641. * GetMenuBar or GetNewMBar.
  642. */
  643. SInt16 mbResID;
  644. };
  645. typedef struct MenuBarHeader MenuBarHeader;
  646. /*
  647. * HMenuBarHeader
  648. *
  649. * Summary:
  650. * This structure is contained in a MenuBarHandle. It contains a
  651. * list of the hierarchical menus that have been inserted into the
  652. * menubar with InsertMenu( menu, -1 ).
  653. *
  654. * Discussion:
  655. * The hierarchical portion of the menubar follows the
  656. * non-hierarchical portion in a menubar handle. The hierarchical
  657. * portion begins with the HMenuBarHeader structure, followed by a
  658. * dynamically sized array of HMenuBarMenus.
  659. */
  660. struct HMenuBarHeader {
  661. /*
  662. * Offset in bytes from the start of the header to the last menu in
  663. * the array of HMenuBarMenus.
  664. */
  665. UInt16 lastHMenu;
  666. /*
  667. * Saved bits behind the hilited menu title; unused in a
  668. * MenuBarHandle returned by GetMenuBar or GetNewMBar.
  669. */
  670. PixMapHandle menuTitleBits;
  671. };
  672. typedef struct HMenuBarHeader HMenuBarHeader;
  673. /*
  674. * MenuBarMenu
  675. *
  676. * Summary:
  677. * This structure contains a single menu in the menubar. It is an
  678. * element in an array in the MenuBarHeader data strucuture.
  679. */
  680. struct MenuBarMenu {
  681. /*
  682. * A menu in the menubar.
  683. */
  684. MenuRef menu;
  685. /*
  686. * The global coordinate of the left edge of the menu title; unused
  687. * in a MenuBarHandle returned by GetMenuBar or GetNewMBar.
  688. */
  689. SInt16 menuLeft;
  690. };
  691. typedef struct MenuBarMenu MenuBarMenu;
  692. /*
  693. * HMenuBarMenu
  694. *
  695. * Summary:
  696. * This structure contains a single hierarchical menu in the
  697. * menubar. It is an element in an array in the HMenuBarHeader data
  698. * strucuture.
  699. */
  700. struct HMenuBarMenu {
  701. /*
  702. * An hierarchical menu in the menubar.
  703. */
  704. MenuRef menu;
  705. /*
  706. * This field is currently unused.
  707. */
  708. SInt16 reserved;
  709. };
  710. typedef struct HMenuBarMenu HMenuBarMenu;
  711. struct MCEntry {
  712. MenuID mctID; /*menu ID. ID = 0 is the menu bar*/
  713. short mctItem; /*menu Item. Item = 0 is a title*/
  714. RGBColor mctRGB1; /*usage depends on ID and Item*/
  715. RGBColor mctRGB2; /*usage depends on ID and Item*/
  716. RGBColor mctRGB3; /*usage depends on ID and Item*/
  717. RGBColor mctRGB4; /*usage depends on ID and Item*/
  718. short mctReserved; /*reserved for internal use*/
  719. };
  720. typedef struct MCEntry MCEntry;
  721. typedef MCEntry * MCEntryPtr;
  722. typedef MCEntry MCTable[1];
  723. typedef MCEntry * MCTablePtr;
  724. typedef MCTablePtr * MCTableHandle;
  725. struct MenuCRsrc {
  726. short numEntries; /*number of entries*/
  727. MCTable mcEntryRecs; /*ARRAY [1..numEntries] of MCEntry*/
  728. };
  729. typedef struct MenuCRsrc MenuCRsrc;
  730. typedef MenuCRsrc * MenuCRsrcPtr;
  731. typedef MenuCRsrcPtr * MenuCRsrcHandle;
  732. #if TARGET_OS_WIN32
  733. /* QuickTime 3.0 */
  734. struct MenuAccessKeyRec {
  735. short count;
  736. long flags;
  737. unsigned char keys[1];
  738. };
  739. typedef struct MenuAccessKeyRec MenuAccessKeyRec;
  740. typedef MenuAccessKeyRec * MenuAccessKeyPtr;
  741. typedef MenuAccessKeyPtr * MenuAccessKeyHandle;
  742. #if CALL_NOT_IN_CARBON
  743. /*
  744. * SetMenuItemHotKey()
  745. *
  746. * Availability:
  747. * Non-Carbon CFM: not available
  748. * CarbonLib: not available
  749. * Mac OS X: not available
  750. */
  751. EXTERN_API_C( void )
  752. SetMenuItemHotKey(
  753. MenuRef menu,
  754. short itemID,
  755. char hotKey,
  756. long flags);
  757. #endif /* CALL_NOT_IN_CARBON */
  758. #endif /* TARGET_OS_WIN32 */
  759. /*
  760. * MenuTrackingData
  761. *
  762. * Summary:
  763. * The MenuTrackingData structure contains information about a menu
  764. * currently being displayed. It is used with the
  765. * GetMenuTrackingData API.
  766. */
  767. struct MenuTrackingData {
  768. MenuRef menu;
  769. MenuItemIndex itemSelected;
  770. MenuItemIndex itemUnderMouse;
  771. Rect itemRect;
  772. SInt32 virtualMenuTop;
  773. SInt32 virtualMenuBottom;
  774. };
  775. typedef struct MenuTrackingData MenuTrackingData;
  776. typedef MenuTrackingData * MenuTrackingDataPtr;
  777. /*
  778. * MDEFHiliteItemData
  779. *
  780. * Summary:
  781. * The MDEFHiliteItemData structure contains information about which
  782. * menu items should be hilited and unhilited as the user moves
  783. * through the menus. It is used by menu definition functions, which
  784. * receive a pointer to an MDEFHiliteItemData structure as the
  785. * whichItem parameter during kMenuHiliteItemMsg.
  786. */
  787. struct MDEFHiliteItemData {
  788. /*
  789. * The item that was previously selected. It should be redrawn in an
  790. * unhilited state. May be zero if no item was previously selected.
  791. */
  792. MenuItemIndex previousItem;
  793. /*
  794. * The item that is now selected. It should be redrawn in a hilited
  795. * state. May be zero if no item is now selected.
  796. */
  797. MenuItemIndex newItem;
  798. /*
  799. * A CoreGraphics context that the MDEF should draw into. The Menu
  800. * Manager will flush the context after the MDEF has returned.
  801. */
  802. void * context;
  803. };
  804. typedef struct MDEFHiliteItemData MDEFHiliteItemData;
  805. typedef MDEFHiliteItemData * MDEFHiliteItemDataPtr;
  806. typedef MDEFHiliteItemData HiliteMenuItemData;
  807. typedef MDEFHiliteItemDataPtr HiliteMenuItemDataPtr;
  808. /*
  809. * MDEFDrawData
  810. *
  811. * Summary:
  812. * The MDEFDrawData structure contains information needed to draw a
  813. * menu. It is used by menu definition functions, which receive a
  814. * pointer to an MDEFDrawData structure as the whichItem parameter
  815. * during kMenuDrawMsg.
  816. */
  817. struct MDEFDrawData {
  818. /*
  819. * Information about the menu being drawn. The MDEF should fill in
  820. * the virtualMenuTop and virtualMenuBottom fields of this structure
  821. * while drawing the menu.
  822. */
  823. MenuTrackingData trackingData;
  824. /*
  825. * A CoreGraphics context that the MDEF should draw into. The Menu
  826. * Manager will flush the context after the MDEF has returned.
  827. */
  828. void * context;
  829. };
  830. typedef struct MDEFDrawData MDEFDrawData;
  831. typedef MDEFDrawData * MDEFDrawDataPtr;
  832. /*
  833. * MDEFFindItemData
  834. *
  835. * Summary:
  836. * The MDEFFindItemData structure contains information needed to
  837. * determine which item is currently selected by the user. It is
  838. * used by menu definition functions, which receive a pointer to an
  839. * MDEFDrawData structure as the whichItem parameter during
  840. * kMenuFindItemMsg.
  841. */
  842. struct MDEFFindItemData {
  843. /*
  844. * Information about the menu being drawn. The MDEF should fill in
  845. * the itemSelected, itemUnderMouse, and itemRect fields of this
  846. * structure after determining which item is at the specified point.
  847. */
  848. MenuTrackingData trackingData;
  849. /*
  850. * A CoreGraphics context that the MDEF should draw into if it needs
  851. * to scroll the menu during the FindItem message. The Menu Manager
  852. * will flush the context after the MDEF has returned.
  853. */
  854. void * context;
  855. };
  856. typedef struct MDEFFindItemData MDEFFindItemData;
  857. typedef MDEFFindItemData * MDEFFindItemDataPtr;
  858. /*
  859. * MDEFDrawItemsData
  860. *
  861. * Summary:
  862. * The MDEFDrawItemsData structure contains information about which
  863. * menu items to redraw. It is used by menu definition functions,
  864. * which receive a pointer to an MDEFDrawItemsData structure as the
  865. * whichItem parameter during kMenuDrawItemsMsg.
  866. */
  867. struct MDEFDrawItemsData {
  868. /*
  869. * The first item to draw.
  870. */
  871. MenuItemIndex firstItem;
  872. /*
  873. * The last item to draw.
  874. */
  875. MenuItemIndex lastItem;
  876. /*
  877. * Information about the menu's tracking state. The virtualMenuTop
  878. * and virtualMenuBottom fields in this structure will be the most
  879. * useful in handling the DrawItems message.
  880. */
  881. MenuTrackingData * trackingData;
  882. /*
  883. * A CoreGraphics context that the MDEF should draw into. The Menu
  884. * Manager will flush the context after the MDEF returns.
  885. */
  886. void * context;
  887. };
  888. typedef struct MDEFDrawItemsData MDEFDrawItemsData;
  889. typedef MDEFDrawItemsData * MDEFDrawItemsDataPtr;
  890. /*
  891. * Summary:
  892. * A MenuItemDataFlags value indicates which fields of a
  893. * MenuItemDataRec structure should be used by the
  894. * Copy/SetMenuItemData APIs. All MenuItemDataFlags may be used when
  895. * getting or setting the contents of a menu item; some may also be
  896. * used when getting or setting information about the menu itself,
  897. * if the item index given to Copy/SetMenuItemData is 0.
  898. */
  899. enum {
  900. /*
  901. * Set or return the Str255 text of a menu using the
  902. * MenuItemDataRec.text field. If getting the text, the text field
  903. * must be initialized with a pointer to a Str255 variable before
  904. * calling CopyMenuItemData. If both kMenuItemDataText and
  905. * kMenuItemCFString are set on entry to CopyMenuItemData, the API
  906. * will determine whether the menu text was most recently set using a
  907. * Str255 or CFString, and return only that text format; the flags
  908. * value for the other format will be cleared. Valid for both menu
  909. * items and the menu title (if item number is 0).
  910. */
  911. kMenuItemDataText = (1 << 0),
  912. /*
  913. * Set or return the mark character of a menu item using the
  914. * MenuItemDataRec.mark field. Valid only for menu items.
  915. */
  916. kMenuItemDataMark = (1 << 1),
  917. /*
  918. * Set or return the command key of a menu item using the
  919. * MenuItemDataRec.cmdKey field. Valid only for menu items.
  920. */
  921. kMenuItemDataCmdKey = (1 << 2),
  922. /*
  923. * Set or return the command key glyph of a menu item using the
  924. * MenuItemDataRec.cmdKeyGlyph field. Valid only for menu items.
  925. */
  926. kMenuItemDataCmdKeyGlyph = (1 << 3),
  927. /*
  928. * Set or return the command key modifiers of a menu item using the
  929. * MenuItemDataRec.cmdKeyModifiers field. Valid only for menu items.
  930. */
  931. kMenuItemDataCmdKeyModifiers = (1 << 4),
  932. /*
  933. * Set or return the QuickDraw text style of a menu item using the
  934. * MenuItemDataRec.style field. Valid only for menu items.
  935. */
  936. kMenuItemDataStyle = (1 << 5),
  937. /*
  938. * Set or return the enable state of a menu using the
  939. * MenuItemDataRec.enabled field. Valid for both menu items and the
  940. * menu itself (if item number is 0).
  941. */
  942. kMenuItemDataEnabled = (1 << 6),
  943. /*
  944. * Set or return the enable state of a menu item icon using the
  945. * MenuItemDataRec.iconEnabled field. Valid only for menu items.
  946. */
  947. kMenuItemDataIconEnabled = (1 << 7),
  948. /*
  949. * Set or return the icon resource ID of a menu item using the
  950. * MenuItemDataRec.iconID field. Valid only for menu items.
  951. */
  952. kMenuItemDataIconID = (1 << 8),
  953. /*
  954. * Set or return the icon handle of a menu item using the
  955. * MenuItemDataRec.iconType and MenuItemDataRec.iconHandle fields.
  956. * Both fields must be initialized if setting the icon handle; both
  957. * fields will be returned when getting the handle. The iconType
  958. * field should contain one of the constants kMenuIconType,
  959. * kMenuShrinkIconType, kMenuSmallIconType, kMenuColorIconType,
  960. * kMenuIconSuiteType, or kMenuIconRefType. An icon handle may be a
  961. * handle to an ICON resource, a SICN resource, a cicn resource, an
  962. * IconSuite, or an IconRef. Valid only for menu items.
  963. */
  964. kMenuItemDataIconHandle = (1 << 9),
  965. /*
  966. * Set or return the command ID of a menu item using the
  967. * MenuItemDataRec.cmdID field. Valid only for menu items.
  968. */
  969. kMenuItemDataCommandID = (1 << 10),
  970. /*
  971. * Set or return the text encoding of a menu item using the
  972. * MenuItemDataRec.encoding field. Valid only for menu items.
  973. */
  974. kMenuItemDataTextEncoding = (1 << 11),
  975. kMenuItemDataSubmenuID = (1 << 12),
  976. kMenuItemDataSubmenuHandle = (1 << 13),
  977. kMenuItemDataFontID = (1 << 14),
  978. kMenuItemDataRefcon = (1 << 15),
  979. kMenuItemDataAttributes = (1 << 16),
  980. kMenuItemDataCFString = (1 << 17),
  981. /*
  982. * Set or return the properties of a menu using the
  983. * MenuItemDataRec.properties field. If setting the properties, the
  984. * properties field should contain a collection with the new
  985. * properties; existing menu properties with the same collection
  986. * creator and tag will be replaced by the new properties. If getting
  987. * the properties, the properties field should either be set to NULL
  988. * or to a valid Collection. If NULL, a new collection is allocated
  989. * by the CopyMenuItemData and returned in the properties field. If
  990. * not NULL, the entire contents of the collection are replaced by
  991. * the properties of the menu. Valid for both menu items and the menu
  992. * itself (if item number is 0).
  993. */
  994. kMenuItemDataProperties = (1 << 18),
  995. /*
  996. * Set or return the item indent level of a menu item using the
  997. * MenuItemDataRec.indent field. Valid only for menu items.
  998. */
  999. kMenuItemDataIndent = (1 << 19),
  1000. /*
  1001. * Set or return the virtual key code keyboard equivalent of a menu
  1002. * item using the MenuItemDataRec.cmdVirtualKey field. Valid only for
  1003. * menu items. On output, only valid if the item has the
  1004. * kMenuItemAttrUseVirtualKeyCode attribute.
  1005. */
  1006. kMenuItemDataCmdVirtualKey = (1 << 20),
  1007. kMenuItemDataAllDataVersionOne = 0x000FFFFF,
  1008. kMenuItemDataAllDataVersionTwo = kMenuItemDataAllDataVersionOne | kMenuItemDataCmdVirtualKey
  1009. };
  1010. typedef UInt64 MenuItemDataFlags;
  1011. /*
  1012. * MenuItemDataRec
  1013. *
  1014. * Summary:
  1015. * The MenuItemDataRec structure is used to get and change aspects
  1016. * of a menu item. It is used with the Copy/SetMenuItemData APIs.
  1017. *
  1018. * Discussion:
  1019. * When using this structure with Copy/SetMenuItemData, the caller
  1020. * must first set the whichData field to a combination of
  1021. * MenuItemDataFlags indicating which specific data should be
  1022. * retrieved or set. Some fields also require initialization before
  1023. * calling CopyMenuItemData; see the individual MenuItemDataFlags
  1024. * documentation for details.
  1025. */
  1026. struct MenuItemDataRec {
  1027. MenuItemDataFlags whichData;
  1028. StringPtr text;
  1029. UniChar mark;
  1030. UniChar cmdKey;
  1031. UInt32 cmdKeyGlyph;
  1032. UInt32 cmdKeyModifiers;
  1033. Style style;
  1034. Boolean enabled;
  1035. Boolean iconEnabled;
  1036. UInt8 filler1;
  1037. SInt32 iconID;
  1038. UInt32 iconType;
  1039. Handle iconHandle;
  1040. MenuCommand cmdID;
  1041. TextEncoding encoding;
  1042. MenuID submenuID;
  1043. MenuRef submenuHandle;
  1044. SInt32 fontID;
  1045. UInt32 refcon;
  1046. OptionBits attr;
  1047. CFStringRef cfText;
  1048. Collection properties;
  1049. UInt32 indent;
  1050. UInt16 cmdVirtualKey;
  1051. };
  1052. typedef struct MenuItemDataRec MenuItemDataRec;
  1053. typedef MenuItemDataRec * MenuItemDataPtr;
  1054. typedef UInt32 MenuItemID;
  1055. /*--------------------------------------------------------------------------------------*/
  1056. /* o Menu ProcPtrs */
  1057. /* */
  1058. /* All of these procs are considered deprecated. Developers interested in portability */
  1059. /* to Carbon should avoid them entirely, if at all possible. */
  1060. /*--------------------------------------------------------------------------------------*/
  1061. typedef CALLBACK_API( void , MenuDefProcPtr )(short message, MenuRef theMenu, Rect *menuRect, Point hitPt, short *whichItem);
  1062. typedef STACK_UPP_TYPE(MenuDefProcPtr) MenuDefUPP;
  1063. /*
  1064. * NewMenuDefUPP()
  1065. *
  1066. * Availability:
  1067. * Non-Carbon CFM: available as macro/inline
  1068. * CarbonLib: in CarbonLib 1.0 and later
  1069. * Mac OS X: in version 10.0 and later
  1070. */
  1071. EXTERN_API_C( MenuDefUPP )
  1072. NewMenuDefUPP(MenuDefProcPtr userRoutine);
  1073. #if !OPAQUE_UPP_TYPES
  1074. enum { uppMenuDefProcInfo = 0x0000FF80 }; /* pascal no_return_value Func(2_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  1075. #ifdef __cplusplus
  1076. inline DEFINE_API_C(MenuDefUPP) NewMenuDefUPP(MenuDefProcPtr userRoutine) { return (MenuDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMenuDefProcInfo, GetCurrentArchitecture()); }
  1077. #else
  1078. #define NewMenuDefUPP(userRoutine) (MenuDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMenuDefProcInfo, GetCurrentArchitecture())
  1079. #endif
  1080. #endif
  1081. /*
  1082. * DisposeMenuDefUPP()
  1083. *
  1084. * Availability:
  1085. * Non-Carbon CFM: available as macro/inline
  1086. * CarbonLib: in CarbonLib 1.0 and later
  1087. * Mac OS X: in version 10.0 and later
  1088. */
  1089. EXTERN_API_C( void )
  1090. DisposeMenuDefUPP(MenuDefUPP userUPP);
  1091. #if !OPAQUE_UPP_TYPES
  1092. #ifdef __cplusplus
  1093. inline DEFINE_API_C(void) DisposeMenuDefUPP(MenuDefUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  1094. #else
  1095. #define DisposeMenuDefUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  1096. #endif
  1097. #endif
  1098. /*
  1099. * InvokeMenuDefUPP()
  1100. *
  1101. * Availability:
  1102. * Non-Carbon CFM: available as macro/inline
  1103. * CarbonLib: in CarbonLib 1.0 and later
  1104. * Mac OS X: in version 10.0 and later
  1105. */
  1106. EXTERN_API_C( void )
  1107. InvokeMenuDefUPP(
  1108. short message,
  1109. MenuRef theMenu,
  1110. Rect * menuRect,
  1111. Point hitPt,
  1112. short * whichItem,
  1113. MenuDefUPP userUPP);
  1114. #if !OPAQUE_UPP_TYPES
  1115. #ifdef __cplusplus
  1116. inline DEFINE_API_C(void) InvokeMenuDefUPP(short message, MenuRef theMenu, Rect * menuRect, Point hitPt, short * whichItem, MenuDefUPP userUPP) { CALL_FIVE_PARAMETER_UPP(userUPP, uppMenuDefProcInfo, message, theMenu, menuRect, hitPt, whichItem); }
  1117. #else
  1118. #define InvokeMenuDefUPP(message, theMenu, menuRect, hitPt, whichItem, userUPP) CALL_FIVE_PARAMETER_UPP((userUPP), uppMenuDefProcInfo, (message), (theMenu), (menuRect), (hitPt), (whichItem))
  1119. #endif
  1120. #endif
  1121. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  1122. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  1123. #define NewMenuDefProc(userRoutine) NewMenuDefUPP(userRoutine)
  1124. #define CallMenuDefProc(userRoutine, message, theMenu, menuRect, hitPt, whichItem) InvokeMenuDefUPP(message, theMenu, menuRect, hitPt, whichItem, userRoutine)
  1125. #endif /* CALL_NOT_IN_CARBON */
  1126. typedef CALLBACK_API( long , MenuBarDefProcPtr )(short selector, short message, short parameter1, long parameter2);
  1127. typedef CALLBACK_API( void , MenuHookProcPtr )(void);
  1128. typedef CALLBACK_API_REGISTER68K( short , MBarHookProcPtr, (Rect * menuRect) );
  1129. typedef STACK_UPP_TYPE(MenuBarDefProcPtr) MenuBarDefUPP;
  1130. typedef STACK_UPP_TYPE(MenuHookProcPtr) MenuHookUPP;
  1131. typedef REGISTER_UPP_TYPE(MBarHookProcPtr) MBarHookUPP;
  1132. #if CALL_NOT_IN_CARBON
  1133. /*
  1134. * NewMenuBarDefUPP()
  1135. *
  1136. * Availability:
  1137. * Non-Carbon CFM: available as macro/inline
  1138. * CarbonLib: not available
  1139. * Mac OS X: not available
  1140. */
  1141. EXTERN_API_C( MenuBarDefUPP )
  1142. NewMenuBarDefUPP(MenuBarDefProcPtr userRoutine);
  1143. #if !OPAQUE_UPP_TYPES
  1144. enum { uppMenuBarDefProcInfo = 0x00003AB0 }; /* pascal 4_bytes Func(2_bytes, 2_bytes, 2_bytes, 4_bytes) */
  1145. #ifdef __cplusplus
  1146. inline DEFINE_API_C(MenuBarDefUPP) NewMenuBarDefUPP(MenuBarDefProcPtr userRoutine) { return (MenuBarDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMenuBarDefProcInfo, GetCurrentArchitecture()); }
  1147. #else
  1148. #define NewMenuBarDefUPP(userRoutine) (MenuBarDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMenuBarDefProcInfo, GetCurrentArchitecture())
  1149. #endif
  1150. #endif
  1151. /*
  1152. * NewMenuHookUPP()
  1153. *
  1154. * Availability:
  1155. * Non-Carbon CFM: available as macro/inline
  1156. * CarbonLib: not available
  1157. * Mac OS X: not available
  1158. */
  1159. EXTERN_API_C( MenuHookUPP )
  1160. NewMenuHookUPP(MenuHookProcPtr userRoutine);
  1161. #if !OPAQUE_UPP_TYPES
  1162. enum { uppMenuHookProcInfo = 0x00000000 }; /* pascal no_return_value Func() */
  1163. #ifdef __cplusplus
  1164. inline DEFINE_API_C(MenuHookUPP) NewMenuHookUPP(MenuHookProcPtr userRoutine) { return (MenuHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMenuHookProcInfo, GetCurrentArchitecture()); }
  1165. #else
  1166. #define NewMenuHookUPP(userRoutine) (MenuHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMenuHookProcInfo, GetCurrentArchitecture())
  1167. #endif
  1168. #endif
  1169. /*
  1170. * NewMBarHookUPP()
  1171. *
  1172. * Availability:
  1173. * Non-Carbon CFM: available as macro/inline
  1174. * CarbonLib: not available
  1175. * Mac OS X: not available
  1176. */
  1177. EXTERN_API_C( MBarHookUPP )
  1178. NewMBarHookUPP(MBarHookProcPtr userRoutine);
  1179. #if !OPAQUE_UPP_TYPES
  1180. enum { uppMBarHookProcInfo = 0x000000CF }; /* SPECIAL_CASE_PROCINFO(12) */
  1181. #ifdef __cplusplus
  1182. inline DEFINE_API_C(MBarHookUPP) NewMBarHookUPP(MBarHookProcPtr userRoutine) { return (MBarHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMBarHookProcInfo, GetCurrentArchitecture()); }
  1183. #else
  1184. #define NewMBarHookUPP(userRoutine) (MBarHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMBarHookProcInfo, GetCurrentArchitecture())
  1185. #endif
  1186. #endif
  1187. /*
  1188. * DisposeMenuBarDefUPP()
  1189. *
  1190. * Availability:
  1191. * Non-Carbon CFM: available as macro/inline
  1192. * CarbonLib: not available
  1193. * Mac OS X: not available
  1194. */
  1195. EXTERN_API_C( void )
  1196. DisposeMenuBarDefUPP(MenuBarDefUPP userUPP);
  1197. #if !OPAQUE_UPP_TYPES
  1198. #ifdef __cplusplus
  1199. inline DEFINE_API_C(void) DisposeMenuBarDefUPP(MenuBarDefUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  1200. #else
  1201. #define DisposeMenuBarDefUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  1202. #endif
  1203. #endif
  1204. /*
  1205. * DisposeMenuHookUPP()
  1206. *
  1207. * Availability:
  1208. * Non-Carbon CFM: available as macro/inline
  1209. * CarbonLib: not available
  1210. * Mac OS X: not available
  1211. */
  1212. EXTERN_API_C( void )
  1213. DisposeMenuHookUPP(MenuHookUPP userUPP);
  1214. #if !OPAQUE_UPP_TYPES
  1215. #ifdef __cplusplus
  1216. inline DEFINE_API_C(void) DisposeMenuHookUPP(MenuHookUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  1217. #else
  1218. #define DisposeMenuHookUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  1219. #endif
  1220. #endif
  1221. /*
  1222. * DisposeMBarHookUPP()
  1223. *
  1224. * Availability:
  1225. * Non-Carbon CFM: available as macro/inline
  1226. * CarbonLib: not available
  1227. * Mac OS X: not available
  1228. */
  1229. EXTERN_API_C( void )
  1230. DisposeMBarHookUPP(MBarHookUPP userUPP);
  1231. #if !OPAQUE_UPP_TYPES
  1232. #ifdef __cplusplus
  1233. inline DEFINE_API_C(void) DisposeMBarHookUPP(MBarHookUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  1234. #else
  1235. #define DisposeMBarHookUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  1236. #endif
  1237. #endif
  1238. /*
  1239. * InvokeMenuBarDefUPP()
  1240. *
  1241. * Availability:
  1242. * Non-Carbon CFM: available as macro/inline
  1243. * CarbonLib: not available
  1244. * Mac OS X: not available
  1245. */
  1246. EXTERN_API_C( long )
  1247. InvokeMenuBarDefUPP(
  1248. short selector,
  1249. short message,
  1250. short parameter1,
  1251. long parameter2,
  1252. MenuBarDefUPP userUPP);
  1253. #if !OPAQUE_UPP_TYPES
  1254. #ifdef __cplusplus
  1255. inline DEFINE_API_C(long) InvokeMenuBarDefUPP(short selector, short message, short parameter1, long parameter2, MenuBarDefUPP userUPP) { return (long)CALL_FOUR_PARAMETER_UPP(userUPP, uppMenuBarDefProcInfo, selector, message, parameter1, parameter2); }
  1256. #else
  1257. #define InvokeMenuBarDefUPP(selector, message, parameter1, parameter2, userUPP) (long)CALL_FOUR_PARAMETER_UPP((userUPP), uppMenuBarDefProcInfo, (selector), (message), (parameter1), (parameter2))
  1258. #endif
  1259. #endif
  1260. /*
  1261. * InvokeMenuHookUPP()
  1262. *
  1263. * Availability:
  1264. * Non-Carbon CFM: available as macro/inline
  1265. * CarbonLib: not available
  1266. * Mac OS X: not available
  1267. */
  1268. EXTERN_API_C( void )
  1269. InvokeMenuHookUPP(MenuHookUPP userUPP);
  1270. #if !OPAQUE_UPP_TYPES
  1271. #ifdef __cplusplus
  1272. inline DEFINE_API_C(void) InvokeMenuHookUPP(MenuHookUPP userUPP) { CALL_ZERO_PARAMETER_UPP(userUPP, uppMenuHookProcInfo); }
  1273. #else
  1274. #define InvokeMenuHookUPP(userUPP) CALL_ZERO_PARAMETER_UPP((userUPP), uppMenuHookProcInfo)
  1275. #endif
  1276. #endif
  1277. /*
  1278. * InvokeMBarHookUPP()
  1279. *
  1280. * Availability:
  1281. * Non-Carbon CFM: available as macro/inline
  1282. * CarbonLib: not available
  1283. * Mac OS X: not available
  1284. */
  1285. EXTERN_API_C( short )
  1286. InvokeMBarHookUPP(
  1287. Rect * menuRect,
  1288. MBarHookUPP userUPP);
  1289. #if !OPAQUE_UPP_TYPES && (!TARGET_OS_MAC || !TARGET_CPU_68K || TARGET_RT_MAC_CFM)
  1290. #ifdef __cplusplus
  1291. inline DEFINE_API_C(short) InvokeMBarHookUPP(Rect * menuRect, MBarHookUPP userUPP) { return (short)CALL_ONE_PARAMETER_UPP(userUPP, uppMBarHookProcInfo, menuRect); }
  1292. #else
  1293. #define InvokeMBarHookUPP(menuRect, userUPP) (short)CALL_ONE_PARAMETER_UPP((userUPP), uppMBarHookProcInfo, (menuRect))
  1294. #endif
  1295. #endif
  1296. #endif /* CALL_NOT_IN_CARBON */
  1297. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  1298. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  1299. #define NewMenuBarDefProc(userRoutine) NewMenuBarDefUPP(userRoutine)
  1300. #define NewMenuHookProc(userRoutine) NewMenuHookUPP(userRoutine)
  1301. #define NewMBarHookProc(userRoutine) NewMBarHookUPP(userRoutine)
  1302. #define CallMenuBarDefProc(userRoutine, selector, message, parameter1, parameter2) InvokeMenuBarDefUPP(selector, message, parameter1, parameter2, userRoutine)
  1303. #define CallMenuHookProc(userRoutine) InvokeMenuHookUPP(userRoutine)
  1304. #define CallMBarHookProc(userRoutine, menuRect) InvokeMBarHookUPP(menuRect, userRoutine)
  1305. #endif /* CALL_NOT_IN_CARBON */
  1306. enum {
  1307. kMenuDefProcPtr = 0 /* raw proc-ptr access based on old MDEF */
  1308. };
  1309. typedef UInt32 MenuDefType;
  1310. struct MenuDefSpec {
  1311. MenuDefType defType;
  1312. union {
  1313. MenuDefUPP defProc;
  1314. } u;
  1315. };
  1316. typedef struct MenuDefSpec MenuDefSpec;
  1317. typedef MenuDefSpec * MenuDefSpecPtr;
  1318. /*--------------------------------------------------------------------------------------*/
  1319. /* o Menu Manager Initialization */
  1320. /*--------------------------------------------------------------------------------------*/
  1321. #if CALL_NOT_IN_CARBON
  1322. /*
  1323. * InitProcMenu()
  1324. *
  1325. * Availability:
  1326. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1327. * CarbonLib: not available
  1328. * Mac OS X: not available
  1329. */
  1330. EXTERN_API( void )
  1331. InitProcMenu(short resID) ONEWORDINLINE(0xA808);
  1332. /*
  1333. * InitMenus()
  1334. *
  1335. * Availability:
  1336. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1337. * CarbonLib: not available
  1338. * Mac OS X: not available
  1339. */
  1340. EXTERN_API( void )
  1341. InitMenus(void) ONEWORDINLINE(0xA930);
  1342. /*--------------------------------------------------------------------------------------*/
  1343. /* o Menu Manipulation */
  1344. /*--------------------------------------------------------------------------------------*/
  1345. #endif /* CALL_NOT_IN_CARBON */
  1346. /*
  1347. * NewMenu()
  1348. *
  1349. * Availability:
  1350. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1351. * CarbonLib: in CarbonLib 1.0 and later
  1352. * Mac OS X: in version 10.0 and later
  1353. */
  1354. EXTERN_API( MenuRef )
  1355. NewMenu(
  1356. MenuID menuID,
  1357. ConstStr255Param menuTitle) ONEWORDINLINE(0xA931);
  1358. /*
  1359. * [Mac]GetMenu()
  1360. *
  1361. * Availability:
  1362. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1363. * CarbonLib: in CarbonLib 1.0 and later
  1364. * Mac OS X: in version 10.0 and later
  1365. */
  1366. #if TARGET_OS_MAC
  1367. #define MacGetMenu GetMenu
  1368. #endif
  1369. EXTERN_API( MenuRef )
  1370. MacGetMenu(short resourceID) ONEWORDINLINE(0xA9BF);
  1371. /*
  1372. * DisposeMenu()
  1373. *
  1374. * Availability:
  1375. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1376. * CarbonLib: in CarbonLib 1.0 and later
  1377. * Mac OS X: in version 10.0 and later
  1378. */
  1379. EXTERN_API( void )
  1380. DisposeMenu(MenuRef theMenu) ONEWORDINLINE(0xA932);
  1381. /*
  1382. * CalcMenuSize()
  1383. *
  1384. * Availability:
  1385. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1386. * CarbonLib: in CarbonLib 1.0 and later
  1387. * Mac OS X: in version 10.0 and later
  1388. */
  1389. EXTERN_API( void )
  1390. CalcMenuSize(MenuRef theMenu) ONEWORDINLINE(0xA948);
  1391. #if CALL_NOT_IN_CARBON
  1392. /*
  1393. * CountMItems()
  1394. *
  1395. * Summary:
  1396. * Renamed to CountMenuItems in Carbon
  1397. *
  1398. * Availability:
  1399. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1400. * CarbonLib: not available
  1401. * Mac OS X: not available
  1402. */
  1403. EXTERN_API( UInt16 )
  1404. CountMItems(MenuRef theMenu) ONEWORDINLINE(0xA950);
  1405. #endif /* CALL_NOT_IN_CARBON */
  1406. /*
  1407. * CountMenuItems()
  1408. *
  1409. * Availability:
  1410. * Non-Carbon CFM: in CarbonAccessors.o 1.3 and later or as macro/inline
  1411. * CarbonLib: in CarbonLib 1.0 and later
  1412. * Mac OS X: in version 10.0 and later
  1413. */
  1414. EXTERN_API( UInt16 )
  1415. CountMenuItems(MenuRef theMenu) ONEWORDINLINE(0xA950);
  1416. #if CALL_NOT_IN_CARBON && !TARGET_CPU_68K
  1417. #ifdef __cplusplus
  1418. inline DEFINE_API(UInt16 ) CountMenuItems(MenuRef theMenu) { return CountMItems(theMenu); }
  1419. #else
  1420. #define CountMenuItems(theMenu) (CountMItems(theMenu))
  1421. #endif
  1422. #endif
  1423. /* Routines available in Mac OS 8.5 and later, and on Mac OS 8.1 and later using CarbonLib 1.1 and later*/
  1424. /*
  1425. * GetMenuFont()
  1426. *
  1427. * Availability:
  1428. * Non-Carbon CFM: in MenusLib 8.5 and later
  1429. * CarbonLib: in CarbonLib 1.0 and later
  1430. * Mac OS X: in version 10.0 and later
  1431. */
  1432. EXTERN_API( OSStatus )
  1433. GetMenuFont(
  1434. MenuRef menu,
  1435. SInt16 * outFontID,
  1436. UInt16 * outFontSize);
  1437. /*
  1438. * SetMenuFont()
  1439. *
  1440. * Availability:
  1441. * Non-Carbon CFM: in MenusLib 8.5 and later
  1442. * CarbonLib: in CarbonLib 1.0 and later
  1443. * Mac OS X: in version 10.0 and later
  1444. */
  1445. EXTERN_API( OSStatus )
  1446. SetMenuFont(
  1447. MenuRef menu,
  1448. SInt16 inFontID,
  1449. UInt16 inFontSize);
  1450. /*
  1451. * GetMenuExcludesMarkColumn()
  1452. *
  1453. * Availability:
  1454. * Non-Carbon CFM: in MenusLib 8.5 and later
  1455. * CarbonLib: in CarbonLib 1.0 and later
  1456. * Mac OS X: in version 10.0 and later
  1457. */
  1458. EXTERN_API( Boolean )
  1459. GetMenuExcludesMarkColumn(MenuRef menu);
  1460. /*
  1461. * SetMenuExcludesMarkColumn()
  1462. *
  1463. * Availability:
  1464. * Non-Carbon CFM: in MenusLib 8.5 and later
  1465. * CarbonLib: in CarbonLib 1.0 and later
  1466. * Mac OS X: in version 10.0 and later
  1467. */
  1468. EXTERN_API( OSStatus )
  1469. SetMenuExcludesMarkColumn(
  1470. MenuRef menu,
  1471. Boolean excludesMark);
  1472. /*
  1473. * RegisterMenuDefinition()
  1474. *
  1475. * Summary:
  1476. * Registers or unregisters a binding between a resource ID and a
  1477. * menu definition function.
  1478. *
  1479. * Discussion:
  1480. * In the Mac OS 8.x Menu Manager, a 'MENU' resource can contain an
  1481. * embedded MDEF procID that is used by the Menu Manager as the
  1482. * resource ID of an 'MDEF' resource to measure and draw the menu.
  1483. * The 'MDEF' resource is loaded by the Menu Manager when you load
  1484. * the menu with GetMenu. Since MDEFs can no longer be packaged as
  1485. * code resources on Carbon, the procID can no longer refer directly
  1486. * to an MDEF resource. However, using RegisterMenuDefinition you
  1487. * can instead specify a UniversalProcPtr pointing to code in your
  1488. * application code fragment.
  1489. *
  1490. * Parameters:
  1491. *
  1492. * inResID:
  1493. * An MDEF proc ID, as used in a 'MENU' resource.
  1494. *
  1495. * inDefSpec:
  1496. * Specifies the MenuDefUPP that should be used for menus with the
  1497. * given MDEF proc ID. Passing NULL allows you to unregister the
  1498. * menu definition that had been associated with the given MDEF
  1499. * proc ID.
  1500. *
  1501. * Availability:
  1502. * Non-Carbon CFM: not available
  1503. * CarbonLib: in CarbonLib 1.0 and later
  1504. * Mac OS X: in version 10.0 and later
  1505. */
  1506. EXTERN_API( OSStatus )
  1507. RegisterMenuDefinition(
  1508. SInt16 inResID,
  1509. MenuDefSpecPtr inDefSpec);
  1510. /*
  1511. * CreateNewMenu()
  1512. *
  1513. * Summary:
  1514. * Creates a new, untitled, empty menu.
  1515. *
  1516. * Discussion:
  1517. * CreateNewMenu is preferred over NewMenu because it allows you to
  1518. * specify the menu's attributes and it does not require you to
  1519. * specify a Str255-based menu title. To set the menu title, you can
  1520. * use either SetMenuTitle or SetMenuTitleWithCFString.
  1521. *
  1522. * Parameters:
  1523. *
  1524. * inMenuID:
  1525. * The menu ID to use for the new menu.
  1526. *
  1527. * inMenuAttributes:
  1528. * The menu attributes to use for the new menu.
  1529. *
  1530. * outMenuRef:
  1531. * On exit, contains the new menu.
  1532. *
  1533. * Availability:
  1534. * Non-Carbon CFM: not available
  1535. * CarbonLib: in CarbonLib 1.0 and later
  1536. * Mac OS X: in version 10.0 and later
  1537. */
  1538. EXTERN_API( OSStatus )
  1539. CreateNewMenu(
  1540. MenuID inMenuID,
  1541. MenuAttributes inMenuAttributes,
  1542. MenuRef * outMenuRef);
  1543. /*
  1544. * CreateCustomMenu()
  1545. *
  1546. * Summary:
  1547. * Creates a new, untitled, empty menu using a custom menu
  1548. * definition function.
  1549. *
  1550. * Discussion:
  1551. * Similar to CreateNewMenu, but also allows you to specify a custom
  1552. * menu definition function.
  1553. *
  1554. * Parameters:
  1555. *
  1556. * inDefSpec:
  1557. * Specifies a custom menu definition function. defSpec->defType
  1558. * must be kMenuDefProcPtr.
  1559. *
  1560. * inMenuID:
  1561. * The menu ID to use for the new menu.
  1562. *
  1563. * inMenuAttributes:
  1564. * The menu attributes to use for the new menu.
  1565. *
  1566. * outMenuRef:
  1567. * On exit, contains the new menu.
  1568. *
  1569. * Availability:
  1570. * Non-Carbon CFM: not available
  1571. * CarbonLib: in CarbonLib 1.0 and later
  1572. * Mac OS X: in version 10.0 and later
  1573. */
  1574. EXTERN_API( OSStatus )
  1575. CreateCustomMenu(
  1576. const MenuDefSpec * inDefSpec,
  1577. MenuID inMenuID,
  1578. MenuAttributes inMenuAttributes,
  1579. MenuRef * outMenuRef);
  1580. /*
  1581. * IsValidMenu()
  1582. *
  1583. * Summary:
  1584. * Determines if a menu is valid.
  1585. *
  1586. * Parameters:
  1587. *
  1588. * inMenu:
  1589. * The menu to check for validity.
  1590. *
  1591. * Result:
  1592. * Indicates whether the menu is valid.
  1593. *
  1594. * Availability:
  1595. * Non-Carbon CFM: not available
  1596. * CarbonLib: in CarbonLib 1.1 and later
  1597. * Mac OS X: in version 10.0 and later
  1598. */
  1599. EXTERN_API( Boolean )
  1600. IsValidMenu(MenuRef inMenu);
  1601. /*
  1602. * GetMenuRetainCount()
  1603. *
  1604. * Summary:
  1605. * Returns the retain count of this menu.
  1606. *
  1607. * Parameters:
  1608. *
  1609. * inMenu:
  1610. * The menu whose retain count to increment.
  1611. *
  1612. * Availability:
  1613. * Non-Carbon CFM: not available
  1614. * CarbonLib: in CarbonLib 1.1 and later
  1615. * Mac OS X: in version 10.0 and later
  1616. */
  1617. EXTERN_API( ItemCount )
  1618. GetMenuRetainCount(MenuRef inMenu);
  1619. /*
  1620. * RetainMenu()
  1621. *
  1622. * Summary:
  1623. * Increments the retain count of a menu.
  1624. *
  1625. * Discussion:
  1626. * RetainMenu does not create a new menu. It simply adds one to the
  1627. * retain count. If called on a menu that was not created by
  1628. * CarbonLib, it will not affect the menu's retain count.
  1629. *
  1630. * Parameters:
  1631. *
  1632. * inMenu:
  1633. * The menu whose retain count to increment.
  1634. *
  1635. * Availability:
  1636. * Non-Carbon CFM: not available
  1637. * CarbonLib: in CarbonLib 1.1 and later
  1638. * Mac OS X: in version 10.0 and later
  1639. */
  1640. EXTERN_API( OSStatus )
  1641. RetainMenu(MenuRef inMenu);
  1642. /*
  1643. * ReleaseMenu()
  1644. *
  1645. * Summary:
  1646. * Decrements the retain count of a menu.
  1647. *
  1648. * Discussion:
  1649. * If called on a menu that was not created by CarbonLib, it will
  1650. * not affect the menu's retain count.
  1651. *
  1652. * Parameters:
  1653. *
  1654. * inMenu:
  1655. * The menu whose retain count to decrement. If the retain count
  1656. * falls to zero, the menu is destroyed.
  1657. *
  1658. * Availability:
  1659. * Non-Carbon CFM: not available
  1660. * CarbonLib: in CarbonLib 1.1 and later
  1661. * Mac OS X: in version 10.0 and later
  1662. */
  1663. EXTERN_API( OSStatus )
  1664. ReleaseMenu(MenuRef inMenu);
  1665. /*
  1666. * DuplicateMenu()
  1667. *
  1668. * Summary:
  1669. * Creates a new menu that is a copy of another menu.
  1670. *
  1671. * Discussion:
  1672. * Unlike RetainMenu, DuplicateMenu creates an entirely new menu
  1673. * that is an exact copy of the original menu. The MDEF for the new
  1674. * menu will receive an init message after the menu has been fully
  1675. * created.
  1676. *
  1677. * Parameters:
  1678. *
  1679. * inSourceMenu:
  1680. * The menu to duplicate.
  1681. *
  1682. * outMenu:
  1683. * On exit, a copy of the source menu.
  1684. *
  1685. * Availability:
  1686. * Non-Carbon CFM: not available
  1687. * CarbonLib: in CarbonLib 1.1 and later
  1688. * Mac OS X: in version 10.0 and later
  1689. */
  1690. EXTERN_API( OSStatus )
  1691. DuplicateMenu(
  1692. MenuRef inSourceMenu,
  1693. MenuRef * outMenu);
  1694. /*
  1695. * CopyMenuTitleAsCFString()
  1696. *
  1697. * Summary:
  1698. * Returns a CFString containing the title of a menu.
  1699. *
  1700. * Parameters:
  1701. *
  1702. * inMenu:
  1703. * The menu whose title to return.
  1704. *
  1705. * outString:
  1706. * On exit, a CFString containing the menu's title. This string
  1707. * must be released by the caller.
  1708. *
  1709. * Availability:
  1710. * Non-Carbon CFM: not available
  1711. * CarbonLib: in CarbonLib 1.1 and later
  1712. * Mac OS X: in version 10.0 and later
  1713. */
  1714. EXTERN_API( OSStatus )
  1715. CopyMenuTitleAsCFString(
  1716. MenuRef inMenu,
  1717. CFStringRef * outString);
  1718. /*
  1719. * SetMenuTitleWithCFString()
  1720. *
  1721. * Summary:
  1722. * Sets the title of a menu to the text contained in a CFString.
  1723. *
  1724. * Discussion:
  1725. * The Menu Manager will either make its own copy or just increment
  1726. * the refcount of the CFString before returning from
  1727. * SetMenuTitleWithCFString, depending on whether the string is
  1728. * mutable or immutable. If the string is mutable, modifying the
  1729. * string after calling SetMenuTitleWithCFString will have no effect
  1730. * on the menu's actual title. The caller may release the string
  1731. * after calling SetMenuTitleWithCFString.
  1732. *
  1733. * Parameters:
  1734. *
  1735. * inMenu:
  1736. * The menu whose title to set.
  1737. *
  1738. * inString:
  1739. * The string containing the new menu title text.
  1740. *
  1741. * Availability:
  1742. * Non-Carbon CFM: not available
  1743. * CarbonLib: in CarbonLib 1.1 and later
  1744. * Mac OS X: in version 10.0 and later
  1745. */
  1746. EXTERN_API( OSStatus )
  1747. SetMenuTitleWithCFString(
  1748. MenuRef inMenu,
  1749. CFStringRef inString);
  1750. /*
  1751. * SetMenuTitleIcon()
  1752. *
  1753. * Summary:
  1754. * Sets the title of a menu to be an icon.
  1755. *
  1756. * Discussion:
  1757. * The Menu Manager takes ownership of the supplied icon after this
  1758. * call. When a menu with an title icon is disposed, the Menu
  1759. * Manager will dispose the icon also; the Menu Manager will also
  1760. * dispose of the current title icon when a new text or icon title
  1761. * is supplied for a menu. If an IconRef is specified, the Menu
  1762. * Manager will increment its refcount, so you may freely release
  1763. * your reference to the IconRef without invalidating the Menu
  1764. * Manager's copy. The menubar will be invalidated by this call, and
  1765. * redrawn at the next opportunity.
  1766. *
  1767. * Parameters:
  1768. *
  1769. * inMenu:
  1770. * The menu whose title to set.
  1771. *
  1772. * inType:
  1773. * The type of icon being used to specify the icon title; use
  1774. * kMenuNoIcon to remove the icon from the menu title. The
  1775. * supported types are kMenuIconSuiteType and kMenuIconRefType.
  1776. *
  1777. * inIcon:
  1778. * The icon; must be NULL if inType is kMenuNoIcon. The supported
  1779. * icon formats are IconSuiteRef and IconRef.
  1780. *
  1781. * Availability:
  1782. * Non-Carbon CFM: not available
  1783. * CarbonLib: in CarbonLib 1.1 and later
  1784. * Mac OS X: in version 10.0 and later
  1785. */
  1786. EXTERN_API( OSStatus )
  1787. SetMenuTitleIcon(
  1788. MenuRef inMenu,
  1789. UInt32 inType,
  1790. void * inIcon);
  1791. /*
  1792. * GetMenuTitleIcon()
  1793. *
  1794. * Summary:
  1795. * Retrieves the icon, if any, being used as the title of a menu.
  1796. *
  1797. * Discussion:
  1798. * This API does not increment a refcount on the returned icon. The
  1799. * caller should not release the icon.
  1800. *
  1801. * Parameters:
  1802. *
  1803. * inMenu:
  1804. * The menu whose icon title to retrieve.
  1805. *
  1806. * outType:
  1807. * On exit, contains the type of icon being used as the title of
  1808. * the menu. Contains kMenuNoIcon if the menu does not have an
  1809. * icon title.
  1810. *
  1811. * outIcon:
  1812. * On exit, contains the IconSuiteRef or IconRef being used as the
  1813. * title of the menu, or NULL if the menu does not have an icon
  1814. * title. May be NULL.
  1815. *
  1816. * Availability:
  1817. * Non-Carbon CFM: not available
  1818. * CarbonLib: in CarbonLib 1.1 and later
  1819. * Mac OS X: in version 10.0 and later
  1820. */
  1821. EXTERN_API( OSStatus )
  1822. GetMenuTitleIcon(
  1823. MenuRef inMenu,
  1824. UInt32 * outType, /* can be NULL */
  1825. void ** outIcon); /* can be NULL */
  1826. /*
  1827. * InvalidateMenuSize()
  1828. *
  1829. * Summary:
  1830. * Invalidates the menu size so that it will be recalculated when
  1831. * next displayed.
  1832. *
  1833. * Discussion:
  1834. * The pre-Carbon technique for invalidating the menu size was to
  1835. * set the width and height to -1. Although this technique still
  1836. * works, for best compatibility it's preferable to use the
  1837. * InvalidateMenuSize API so that the Menu Manager has explicit
  1838. * notification that the menu is invalid.
  1839. *
  1840. * Parameters:
  1841. *
  1842. * inMenu:
  1843. * The menu whose size to invalidate.
  1844. *
  1845. * Availability:
  1846. * Non-Carbon CFM: not available
  1847. * CarbonLib: in CarbonLib 1.1 and later
  1848. * Mac OS X: in version 10.0 and later
  1849. */
  1850. EXTERN_API( OSStatus )
  1851. InvalidateMenuSize(MenuRef inMenu);
  1852. /*
  1853. * IsMenuSizeInvalid()
  1854. *
  1855. * Summary:
  1856. * Determines if a menu's size is invalid and should be recalculated.
  1857. *
  1858. * Discussion:
  1859. * The pre-Carbon technique for determining if a menu's size is
  1860. * invalid was to check if the width or height was -1. This
  1861. * technique is not always reliable on Carbon due to implementation
  1862. * changes in the Menu Manager. You should now use IsMenuSizeInvalid
  1863. * instead.
  1864. *
  1865. * Parameters:
  1866. *
  1867. * inMenu:
  1868. * The menu whose size to examine.
  1869. *
  1870. * Availability:
  1871. * Non-Carbon CFM: not available
  1872. * CarbonLib: in CarbonLib 1.1 and later
  1873. * Mac OS X: in version 10.0 and later
  1874. */
  1875. EXTERN_API( Boolean )
  1876. IsMenuSizeInvalid(MenuRef inMenu);
  1877. /*--------------------------------------------------------------------------------------*/
  1878. /* o.MDEF support */
  1879. /*--------------------------------------------------------------------------------------*/
  1880. /*
  1881. * EraseMenuBackground()
  1882. *
  1883. * Summary:
  1884. * Erases a portion of a menu background in preparation for further
  1885. * drawing.
  1886. *
  1887. * Discussion:
  1888. * It is necessary to erase the menu background before calling
  1889. * DrawThemeMenuBackground because some themes (such as Aqua on Mac
  1890. * OS X) draw the menu background using the alpha channel, and if
  1891. * the area underneath the menu background is not erased, portions
  1892. * of the old image will show through the menu background.
  1893. *
  1894. * Parameters:
  1895. *
  1896. * inMenu:
  1897. * The menu whose background to erase.
  1898. *
  1899. * inEraseRect:
  1900. * The bounds of the area to erase, in local coordinates to the
  1901. * current port.
  1902. *
  1903. * inContext:
  1904. * The CG context to erase. If NULL, EraseMenuBackground will
  1905. * create a context based on the current port.
  1906. *
  1907. * Availability:
  1908. * Non-Carbon CFM: not available
  1909. * CarbonLib: in CarbonLib 1.5 and later
  1910. * Mac OS X: in version 10.1 and later
  1911. */
  1912. EXTERN_API_C( OSStatus )
  1913. EraseMenuBackground(
  1914. MenuRef inMenu,
  1915. const Rect * inEraseRect,
  1916. CGContextRef inContext); /* can be NULL */
  1917. /*
  1918. * ScrollMenuImage()
  1919. *
  1920. * Summary:
  1921. * Scrolls a portion of the menu image.
  1922. *
  1923. * Discussion:
  1924. * Menus on Mac OS X use an alpha channel, and QuickDraw does not
  1925. * support alpha channels. Therefore, scrolling a menu image with
  1926. * ScrollRect or other QuickDraw APIs does not work correctly; it
  1927. * results in the destruction of the alpha channel data. The
  1928. * ScrollMenuImage API uses CoreGraphics to move the menu image,
  1929. * preserving the alpha channel.
  1930. *
  1931. * Parameters:
  1932. *
  1933. * inMenu:
  1934. * The menu whose image to scroll.
  1935. *
  1936. * inScrollRect:
  1937. * The bounds of the rect to scroll.
  1938. *
  1939. * inHScroll:
  1940. * The distance to scroll horizontally.
  1941. *
  1942. * inVScroll:
  1943. * The distance to scroll vertically.
  1944. *
  1945. * inContext:
  1946. * The CG context to erase. If NULL, ScrollMenuImage will create a
  1947. * context based on the current port.
  1948. *
  1949. * Availability:
  1950. * Non-Carbon CFM: not available
  1951. * CarbonLib: in CarbonLib 1.5 and later
  1952. * Mac OS X: in version 10.1 and later
  1953. */
  1954. EXTERN_API_C( OSStatus )
  1955. ScrollMenuImage(
  1956. MenuRef inMenu,
  1957. const Rect * inScrollRect,
  1958. int inHScroll,
  1959. int inVScroll,
  1960. CGContextRef inContext); /* can be NULL */
  1961. /*--------------------------------------------------------------------------------------*/
  1962. /* o Menu Item Insertion */
  1963. /*--------------------------------------------------------------------------------------*/
  1964. /*
  1965. * [Mac]AppendMenu()
  1966. *
  1967. * Availability:
  1968. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1969. * CarbonLib: in CarbonLib 1.0 and later
  1970. * Mac OS X: in version 10.0 and later
  1971. */
  1972. #if TARGET_OS_MAC
  1973. #define MacAppendMenu AppendMenu
  1974. #endif
  1975. EXTERN_API( void )
  1976. MacAppendMenu(
  1977. MenuRef menu,
  1978. ConstStr255Param data) ONEWORDINLINE(0xA933);
  1979. /*
  1980. * InsertResMenu()
  1981. *
  1982. * Availability:
  1983. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1984. * CarbonLib: in CarbonLib 1.0 and later
  1985. * Mac OS X: in version 10.0 and later
  1986. */
  1987. EXTERN_API( void )
  1988. InsertResMenu(
  1989. MenuRef theMenu,
  1990. ResType theType,
  1991. short afterItem) ONEWORDINLINE(0xA951);
  1992. /*
  1993. * AppendResMenu()
  1994. *
  1995. * Availability:
  1996. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1997. * CarbonLib: in CarbonLib 1.0 and later
  1998. * Mac OS X: in version 10.0 and later
  1999. */
  2000. EXTERN_API( void )
  2001. AppendResMenu(
  2002. MenuRef theMenu,
  2003. ResType theType) ONEWORDINLINE(0xA94D);
  2004. /*
  2005. * [Mac]InsertMenuItem()
  2006. *
  2007. * Availability:
  2008. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2009. * CarbonLib: in CarbonLib 1.0 and later
  2010. * Mac OS X: in version 10.0 and later
  2011. */
  2012. #if TARGET_OS_MAC
  2013. #define MacInsertMenuItem InsertMenuItem
  2014. #endif
  2015. EXTERN_API( void )
  2016. MacInsertMenuItem(
  2017. MenuRef theMenu,
  2018. ConstStr255Param itemString,
  2019. short afterItem) ONEWORDINLINE(0xA826);
  2020. /*
  2021. * DeleteMenuItem()
  2022. *
  2023. * Availability:
  2024. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2025. * CarbonLib: in CarbonLib 1.0 and later
  2026. * Mac OS X: in version 10.0 and later
  2027. */
  2028. EXTERN_API( void )
  2029. DeleteMenuItem(
  2030. MenuRef theMenu,
  2031. short item) ONEWORDINLINE(0xA952);
  2032. /*
  2033. * InsertFontResMenu()
  2034. *
  2035. * Availability:
  2036. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2037. * CarbonLib: in CarbonLib 1.0 and later
  2038. * Mac OS X: in version 10.0 and later
  2039. */
  2040. EXTERN_API( void )
  2041. InsertFontResMenu(
  2042. MenuRef theMenu,
  2043. short afterItem,
  2044. short scriptFilter) THREEWORDINLINE(0x303C, 0x0400, 0xA825);
  2045. /*
  2046. * InsertIntlResMenu()
  2047. *
  2048. * Availability:
  2049. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2050. * CarbonLib: in CarbonLib 1.0 and later
  2051. * Mac OS X: in version 10.0 and later
  2052. */
  2053. EXTERN_API( void )
  2054. InsertIntlResMenu(
  2055. MenuRef theMenu,
  2056. ResType theType,
  2057. short afterItem,
  2058. short scriptFilter) THREEWORDINLINE(0x303C, 0x0601, 0xA825);
  2059. /*
  2060. * AppendMenuItemText()
  2061. *
  2062. * Availability:
  2063. * Non-Carbon CFM: in MenusLib 8.5 and later
  2064. * CarbonLib: in CarbonLib 1.0 and later
  2065. * Mac OS X: in version 10.0 and later
  2066. */
  2067. EXTERN_API( OSStatus )
  2068. AppendMenuItemText(
  2069. MenuRef menu,
  2070. ConstStr255Param inString);
  2071. /*
  2072. * InsertMenuItemText()
  2073. *
  2074. * Availability:
  2075. * Non-Carbon CFM: in MenusLib 8.5 and later
  2076. * CarbonLib: in CarbonLib 1.0 and later
  2077. * Mac OS X: in version 10.0 and later
  2078. */
  2079. EXTERN_API( OSStatus )
  2080. InsertMenuItemText(
  2081. MenuRef menu,
  2082. ConstStr255Param inString,
  2083. MenuItemIndex afterItem);
  2084. /*
  2085. * CopyMenuItems()
  2086. *
  2087. * Summary:
  2088. * Copies menu items from one menu to another.
  2089. *
  2090. * Parameters:
  2091. *
  2092. * inSourceMenu:
  2093. * The menu from which to copy items.
  2094. *
  2095. * inFirstItem:
  2096. * The first item to copy.
  2097. *
  2098. * inNumItems:
  2099. * The number of items to copy.
  2100. *
  2101. * inDestMenu:
  2102. * The menu to which to copy items.
  2103. *
  2104. * inInsertAfter:
  2105. * The menu item in the destination menu after which to insert the
  2106. * copied items.
  2107. *
  2108. * Availability:
  2109. * Non-Carbon CFM: not available
  2110. * CarbonLib: in CarbonLib 1.1 and later
  2111. * Mac OS X: in version 10.0 and later
  2112. */
  2113. EXTERN_API( OSStatus )
  2114. CopyMenuItems(
  2115. MenuRef inSourceMenu,
  2116. MenuItemIndex inFirstItem,
  2117. ItemCount inNumItems,
  2118. MenuRef inDestMenu,
  2119. MenuItemIndex inInsertAfter);
  2120. /*
  2121. * DeleteMenuItems()
  2122. *
  2123. * Summary:
  2124. * Deletes multiple menu items.
  2125. *
  2126. * Discussion:
  2127. * This API is more efficient than calling DeleteMenuItem multiple
  2128. * times.
  2129. *
  2130. * Parameters:
  2131. *
  2132. * inMenu:
  2133. * The menu from which to delete items.
  2134. *
  2135. * inFirstItem:
  2136. * The first item to delete.
  2137. *
  2138. * inNumItems:
  2139. * The number of items to delete.
  2140. *
  2141. * Availability:
  2142. * Non-Carbon CFM: not available
  2143. * CarbonLib: in CarbonLib 1.1 and later
  2144. * Mac OS X: in version 10.0 and later
  2145. */
  2146. EXTERN_API( OSStatus )
  2147. DeleteMenuItems(
  2148. MenuRef inMenu,
  2149. MenuItemIndex inFirstItem,
  2150. ItemCount inNumItems);
  2151. /*
  2152. * AppendMenuItemTextWithCFString()
  2153. *
  2154. * Summary:
  2155. * Appends a new menu item with text from a CFString.
  2156. *
  2157. * Discussion:
  2158. * The Menu Manager will either make its own copy or just increment
  2159. * the refcount of the CFString before returning from
  2160. * AppendMenuItemWithTextCFString, depending on whether the string
  2161. * is mutable or immutable. If the string is mutable, modifying the
  2162. * string after calling AppendMenuItemTextWithCFString will have no
  2163. * effect on the menu item's actual text. The caller may release the
  2164. * string after calling AppendMenuItemTextWithCFString.
  2165. *
  2166. * Parameters:
  2167. *
  2168. * inMenu:
  2169. * The menu to which to append the new item.
  2170. *
  2171. * inString:
  2172. * The text of the new item.
  2173. *
  2174. * inAttributes:
  2175. * The attributes of the new item.
  2176. *
  2177. * inCommandID:
  2178. * The command ID of the new item.
  2179. *
  2180. * outNewItem:
  2181. * On exit, the index of the new item. May be NULL if the caller
  2182. * does not need this information.
  2183. *
  2184. * Availability:
  2185. * Non-Carbon CFM: not available
  2186. * CarbonLib: in CarbonLib 1.1 and later
  2187. * Mac OS X: in version 10.0 and later
  2188. */
  2189. EXTERN_API( OSStatus )
  2190. AppendMenuItemTextWithCFString(
  2191. MenuRef inMenu,
  2192. CFStringRef inString,
  2193. MenuItemAttributes inAttributes,
  2194. MenuCommand inCommandID,
  2195. MenuItemIndex * outNewItem); /* can be NULL */
  2196. /*
  2197. * InsertMenuItemTextWithCFString()
  2198. *
  2199. * Summary:
  2200. * Inserts a new menu item with text from a CFString.
  2201. *
  2202. * Discussion:
  2203. * The Menu Manager will either make its own copy or just increment
  2204. * the refcount of the CFString before returning from
  2205. * InsertMenuItemWithCFString, depending on whether the string is
  2206. * mutable or immutable. If the string is mutable, modifying the
  2207. * string after calling InsertMenuItemWithCFString will have no
  2208. * effect on the menu item's actual text. The caller may release the
  2209. * string after calling InsertMenuItemWithCFString.
  2210. *
  2211. * Parameters:
  2212. *
  2213. * inMenu:
  2214. * The menu in which to insert the new item.
  2215. *
  2216. * inString:
  2217. * The text of the new item.
  2218. *
  2219. * inAfterItem:
  2220. * The item after which to insert the new item.
  2221. *
  2222. * inAttributes:
  2223. * The attributes of the new item.
  2224. *
  2225. * inCommandID:
  2226. * The command ID of the new item.
  2227. *
  2228. * Availability:
  2229. * Non-Carbon CFM: not available
  2230. * CarbonLib: in CarbonLib 1.1 and later
  2231. * Mac OS X: in version 10.0 and later
  2232. */
  2233. EXTERN_API( OSStatus )
  2234. InsertMenuItemTextWithCFString(
  2235. MenuRef inMenu,
  2236. CFStringRef inString,
  2237. MenuItemIndex inAfterItem,
  2238. MenuItemAttributes inAttributes,
  2239. MenuCommand inCommandID);
  2240. /*--------------------------------------------------------------------------------------*/
  2241. /* o Menu Events */
  2242. /*--------------------------------------------------------------------------------------*/
  2243. /*
  2244. * MenuKey()
  2245. *
  2246. * Availability:
  2247. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2248. * CarbonLib: in CarbonLib 1.0 and later
  2249. * Mac OS X: in version 10.0 and later
  2250. */
  2251. EXTERN_API( long )
  2252. MenuKey(CharParameter ch) ONEWORDINLINE(0xA93E);
  2253. /*
  2254. * MenuSelect()
  2255. *
  2256. * Availability:
  2257. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2258. * CarbonLib: in CarbonLib 1.0 and later
  2259. * Mac OS X: in version 10.0 and later
  2260. */
  2261. EXTERN_API( long )
  2262. MenuSelect(Point startPt) ONEWORDINLINE(0xA93D);
  2263. /*
  2264. * PopUpMenuSelect()
  2265. *
  2266. * Availability:
  2267. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2268. * CarbonLib: in CarbonLib 1.0 and later
  2269. * Mac OS X: in version 10.0 and later
  2270. */
  2271. EXTERN_API( long )
  2272. PopUpMenuSelect(
  2273. MenuRef menu,
  2274. short top,
  2275. short left,
  2276. short popUpItem) ONEWORDINLINE(0xA80B);
  2277. /*
  2278. * MenuChoice()
  2279. *
  2280. * Availability:
  2281. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2282. * CarbonLib: in CarbonLib 1.0 and later
  2283. * Mac OS X: in version 10.0 and later
  2284. */
  2285. EXTERN_API( long )
  2286. MenuChoice(void) ONEWORDINLINE(0xAA66);
  2287. /*
  2288. * MenuEvent()
  2289. *
  2290. * Availability:
  2291. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2292. * CarbonLib: in CarbonLib 1.0 and later
  2293. * Mac OS X: in version 10.0 and later
  2294. */
  2295. EXTERN_API( UInt32 )
  2296. MenuEvent(const EventRecord * inEvent) THREEWORDINLINE(0x303C, 0x020C, 0xA825);
  2297. /*
  2298. * IsMenuKeyEvent()
  2299. *
  2300. * Summary:
  2301. * Determines if an event corresponds to a menu command key.
  2302. *
  2303. * Discussion:
  2304. * By default, IsMenuKeyEvent searches the menus in the current menu
  2305. * bar and hilites the menu title of the menu containing the
  2306. * selected item.
  2307. *
  2308. * Parameters:
  2309. *
  2310. * inStartMenu:
  2311. * IsMenuKeyEvent searches for matching menu items in this menu
  2312. * and all of its submenus. May be NULL to search the current menu
  2313. * bar contents.
  2314. *
  2315. * inEvent:
  2316. * The event to match against. Non-keyboard events are ignored.
  2317. *
  2318. * inOptions:
  2319. * Options controlling how to search. Pass kNilOptions for the
  2320. * default behavior.
  2321. *
  2322. * outMenu:
  2323. * On exit, the menu containing the matching item. May be NULL.
  2324. *
  2325. * outMenuItem:
  2326. * On exit, the menu item that matched. May be NULL.
  2327. *
  2328. * Availability:
  2329. * Non-Carbon CFM: not available
  2330. * CarbonLib: in CarbonLib 1.1 and later
  2331. * Mac OS X: in version 10.0 and later
  2332. */
  2333. EXTERN_API( Boolean )
  2334. IsMenuKeyEvent(
  2335. MenuRef inStartMenu,
  2336. EventRef inEvent,
  2337. MenuEventOptions inOptions,
  2338. MenuRef * outMenu, /* can be NULL */
  2339. MenuItemIndex * outMenuItem); /* can be NULL */
  2340. /*
  2341. * InvalidateMenuEnabling()
  2342. *
  2343. * Summary:
  2344. * Causes the menu enable state to be recalculated at the next
  2345. * convenient opportunity.
  2346. *
  2347. * Discussion:
  2348. * It is common for state changes in an application (for example,
  2349. * selection of text) to cause a change in the enabling of items in
  2350. * the application's menu (for example, the Copy menu item might
  2351. * become enabled). In a Carbon-event-savvy application, menu items
  2352. * are enabled or disabled in response to an
  2353. * kEventCommandUpdateStatus event; however, this event is normally
  2354. * only sent before a command key press or a click in the menubar.
  2355. * You can request an explicit recalculation of a menu's enable
  2356. * state with the InvalidateMenuEnabling API. The Carbon Event
  2357. * Manager will automatically invalidate the enable state of all
  2358. * top-level menus when a user event is dispatched, the user focus
  2359. * changes, or the active window changes, so in many cases you will
  2360. * not need to explicitly invalidate the menu enabling state.
  2361. *
  2362. * Parameters:
  2363. *
  2364. * inMenu:
  2365. * A menu to re-enable, or NULL if all menus in the root menu
  2366. * should be re-enabled.
  2367. *
  2368. * Availability:
  2369. * Non-Carbon CFM: not available
  2370. * CarbonLib: in CarbonLib 1.3 and later
  2371. * Mac OS X: in version 10.0 and later
  2372. */
  2373. EXTERN_API( OSStatus )
  2374. InvalidateMenuEnabling(MenuRef inMenu);
  2375. /*--------------------------------------------------------------------------------------*/
  2376. /* o Menu Bar */
  2377. /*--------------------------------------------------------------------------------------*/
  2378. /*
  2379. * GetMBarHeight()
  2380. *
  2381. * Availability:
  2382. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2383. * CarbonLib: in CarbonLib 1.0 and later
  2384. * Mac OS X: in version 10.0 and later
  2385. */
  2386. EXTERN_API( short )
  2387. GetMBarHeight(void) TWOWORDINLINE(0x3EB8, 0x0BAA);
  2388. /*
  2389. * [Mac]DrawMenuBar()
  2390. *
  2391. * Availability:
  2392. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2393. * CarbonLib: in CarbonLib 1.0 and later
  2394. * Mac OS X: in version 10.0 and later
  2395. */
  2396. #if TARGET_OS_MAC
  2397. #define MacDrawMenuBar DrawMenuBar
  2398. #endif
  2399. EXTERN_API( void )
  2400. MacDrawMenuBar(void) ONEWORDINLINE(0xA937);
  2401. /*
  2402. * InvalMenuBar()
  2403. *
  2404. * Availability:
  2405. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2406. * CarbonLib: in CarbonLib 1.0 and later
  2407. * Mac OS X: in version 10.0 and later
  2408. */
  2409. EXTERN_API( void )
  2410. InvalMenuBar(void) ONEWORDINLINE(0xA81D);
  2411. /*
  2412. * IsMenuBarInvalid()
  2413. *
  2414. * Summary:
  2415. * Determines if the menubar is invalid and should be redrawn.
  2416. *
  2417. * Parameters:
  2418. *
  2419. * rootMenu:
  2420. * The root menu for the menubar to be examined. Pass NULL to
  2421. * check the state of the current menubar.
  2422. *
  2423. * Availability:
  2424. * Non-Carbon CFM: not available
  2425. * CarbonLib: in CarbonLib 1.1 and later
  2426. * Mac OS X: in version 10.0 and later
  2427. */
  2428. EXTERN_API( Boolean )
  2429. IsMenuBarInvalid(MenuRef rootMenu);
  2430. /*
  2431. * HiliteMenu()
  2432. *
  2433. * Availability:
  2434. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2435. * CarbonLib: in CarbonLib 1.0 and later
  2436. * Mac OS X: in version 10.0 and later
  2437. */
  2438. EXTERN_API( void )
  2439. HiliteMenu(MenuID menuID) ONEWORDINLINE(0xA938);
  2440. /*
  2441. * GetNewMBar()
  2442. *
  2443. * Availability:
  2444. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2445. * CarbonLib: in CarbonLib 1.0 and later
  2446. * Mac OS X: in version 10.0 and later
  2447. */
  2448. EXTERN_API( MenuBarHandle )
  2449. GetNewMBar(short menuBarID) ONEWORDINLINE(0xA9C0);
  2450. /*
  2451. * GetMenuBar()
  2452. *
  2453. * Availability:
  2454. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2455. * CarbonLib: in CarbonLib 1.0 and later
  2456. * Mac OS X: in version 10.0 and later
  2457. */
  2458. EXTERN_API( MenuBarHandle )
  2459. GetMenuBar(void) ONEWORDINLINE(0xA93B);
  2460. /*
  2461. * SetMenuBar()
  2462. *
  2463. * Availability:
  2464. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2465. * CarbonLib: in CarbonLib 1.0 and later
  2466. * Mac OS X: in version 10.0 and later
  2467. */
  2468. EXTERN_API( void )
  2469. SetMenuBar(MenuBarHandle mbar) ONEWORDINLINE(0xA93C);
  2470. /*
  2471. * DuplicateMenuBar()
  2472. *
  2473. * Summary:
  2474. * Duplicates a menubar handle.
  2475. *
  2476. * Discussion:
  2477. * This API should be used in Carbon applications when duplicating a
  2478. * handle returned from GetMenuBar or GetNewMBar. You should not use
  2479. * Memory Manager APIs (HandToHand, NewHandle, etc) to duplicate
  2480. * such a handle. This is necessary in Carbon so that the refcounts
  2481. * of the menus in the menubar handle can be incremented when the
  2482. * handle is duplicated.
  2483. *
  2484. * Parameters:
  2485. *
  2486. * inMbar:
  2487. * The menubar handle to duplicate.
  2488. *
  2489. * outMbar:
  2490. * On exit, contains the new menubar handle.
  2491. *
  2492. * Availability:
  2493. * Non-Carbon CFM: not available
  2494. * CarbonLib: in CarbonLib 1.0.2 and later
  2495. * Mac OS X: in version 10.0 and later
  2496. */
  2497. EXTERN_API( OSStatus )
  2498. DuplicateMenuBar(
  2499. MenuBarHandle inMbar,
  2500. MenuBarHandle * outMbar);
  2501. /*
  2502. * DisposeMenuBar()
  2503. *
  2504. * Summary:
  2505. * Releases a menubar handle.
  2506. *
  2507. * Discussion:
  2508. * This API should be used in Carbon applications when releasing a
  2509. * handle returned from GetMenuBar or GetNewMBar. You should not use
  2510. * DisposeHandle to release such a handle. This is necessary in
  2511. * Carbon so that the refcounts of the menus in the menubar handle
  2512. * can be decremented when the handle is released.
  2513. *
  2514. * Parameters:
  2515. *
  2516. * inMbar:
  2517. * The menubar handle to release.
  2518. *
  2519. * Availability:
  2520. * Non-Carbon CFM: not available
  2521. * CarbonLib: in CarbonLib 1.0.2 and later
  2522. * Mac OS X: in version 10.0 and later
  2523. */
  2524. EXTERN_API( OSStatus )
  2525. DisposeMenuBar(MenuBarHandle inMbar);
  2526. /*
  2527. * GetMenuHandle()
  2528. *
  2529. * Availability:
  2530. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2531. * CarbonLib: in CarbonLib 1.0 and later
  2532. * Mac OS X: in version 10.0 and later
  2533. */
  2534. EXTERN_API( MenuRef )
  2535. GetMenuHandle(MenuID menuID) ONEWORDINLINE(0xA949);
  2536. #define GetMenuRef GetMenuHandle
  2537. /*
  2538. * [Mac]InsertMenu()
  2539. *
  2540. * Availability:
  2541. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2542. * CarbonLib: in CarbonLib 1.0 and later
  2543. * Mac OS X: in version 10.0 and later
  2544. */
  2545. #if TARGET_OS_MAC
  2546. #define MacInsertMenu InsertMenu
  2547. #endif
  2548. EXTERN_API( void )
  2549. MacInsertMenu(
  2550. MenuRef theMenu,
  2551. MenuID beforeID) ONEWORDINLINE(0xA935);
  2552. /*
  2553. * [Mac]DeleteMenu()
  2554. *
  2555. * Availability:
  2556. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2557. * CarbonLib: in CarbonLib 1.0 and later
  2558. * Mac OS X: in version 10.0 and later
  2559. */
  2560. #if TARGET_OS_MAC
  2561. #define MacDeleteMenu DeleteMenu
  2562. #endif
  2563. EXTERN_API( void )
  2564. MacDeleteMenu(MenuID menuID) ONEWORDINLINE(0xA936);
  2565. /*
  2566. * ClearMenuBar()
  2567. *
  2568. * Availability:
  2569. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2570. * CarbonLib: in CarbonLib 1.0 and later
  2571. * Mac OS X: in version 10.0 and later
  2572. */
  2573. EXTERN_API( void )
  2574. ClearMenuBar(void) ONEWORDINLINE(0xA934);
  2575. #if CALL_NOT_IN_CARBON
  2576. /*
  2577. * SetMenuFlash()
  2578. *
  2579. * Summary:
  2580. * Renamed to SetMenuFlashCount in Carbon
  2581. *
  2582. * Availability:
  2583. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2584. * CarbonLib: not available
  2585. * Mac OS X: not available
  2586. */
  2587. EXTERN_API( void )
  2588. SetMenuFlash(short count) ONEWORDINLINE(0xA94A);
  2589. #endif /* CALL_NOT_IN_CARBON */
  2590. /*
  2591. * SetMenuFlashCount()
  2592. *
  2593. * Availability:
  2594. * Non-Carbon CFM: in CarbonAccessors.o 1.3 and later or as macro/inline
  2595. * CarbonLib: in CarbonLib 1.0 and later
  2596. * Mac OS X: in version 10.0 and later
  2597. */
  2598. EXTERN_API( void )
  2599. SetMenuFlashCount(short count) ONEWORDINLINE(0xA94A);
  2600. #if CALL_NOT_IN_CARBON && !TARGET_CPU_68K
  2601. #ifdef __cplusplus
  2602. inline DEFINE_API(void) SetMenuFlashCount(short count) { SetMenuFlash(count); }
  2603. #else
  2604. #define SetMenuFlashCount(count) (SetMenuFlash(count))
  2605. #endif
  2606. #endif
  2607. /*
  2608. * FlashMenuBar()
  2609. *
  2610. * Availability:
  2611. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2612. * CarbonLib: in CarbonLib 1.0 and later
  2613. * Mac OS X: in version 10.0 and later
  2614. */
  2615. EXTERN_API( void )
  2616. FlashMenuBar(MenuID menuID) ONEWORDINLINE(0xA94C);
  2617. /* These are obsolete because Carbon does not support desk accessories.*/
  2618. #if CALL_NOT_IN_CARBON
  2619. /*
  2620. * SystemEdit()
  2621. *
  2622. * Availability:
  2623. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2624. * CarbonLib: not available
  2625. * Mac OS X: not available
  2626. */
  2627. EXTERN_API( Boolean )
  2628. SystemEdit(short editCmd) ONEWORDINLINE(0xA9C2);
  2629. /*
  2630. * SystemMenu()
  2631. *
  2632. * Availability:
  2633. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2634. * CarbonLib: not available
  2635. * Mac OS X: not available
  2636. */
  2637. EXTERN_API( void )
  2638. SystemMenu(long menuResult) ONEWORDINLINE(0xA9B5);
  2639. #endif /* CALL_NOT_IN_CARBON */
  2640. /*
  2641. * IsMenuBarVisible()
  2642. *
  2643. * Availability:
  2644. * Non-Carbon CFM: in MenusLib 8.5 and later
  2645. * CarbonLib: in CarbonLib 1.0 and later
  2646. * Mac OS X: in version 10.0 and later
  2647. */
  2648. EXTERN_API( Boolean )
  2649. IsMenuBarVisible(void);
  2650. /*
  2651. * ShowMenuBar()
  2652. *
  2653. * Availability:
  2654. * Non-Carbon CFM: in MenusLib 8.5 and later
  2655. * CarbonLib: in CarbonLib 1.0 and later
  2656. * Mac OS X: in version 10.0 and later
  2657. */
  2658. EXTERN_API( void )
  2659. ShowMenuBar(void);
  2660. /*
  2661. * HideMenuBar()
  2662. *
  2663. * Availability:
  2664. * Non-Carbon CFM: in MenusLib 8.5 and later
  2665. * CarbonLib: in CarbonLib 1.0 and later
  2666. * Mac OS X: in version 10.0 and later
  2667. */
  2668. EXTERN_API( void )
  2669. HideMenuBar(void);
  2670. /*
  2671. * AcquireRootMenu()
  2672. *
  2673. * Summary:
  2674. * Get the menu whose contents are displayed in the menubar.
  2675. *
  2676. * Discussion:
  2677. * The refcount of the root menu is incremented by this API. The
  2678. * caller should release a refcount with ReleaseMenu when it's done
  2679. * with the menu.
  2680. *
  2681. * Availability:
  2682. * Non-Carbon CFM: not available
  2683. * CarbonLib: in CarbonLib 1.1 and later
  2684. * Mac OS X: in version 10.0 and later
  2685. */
  2686. EXTERN_API( MenuRef )
  2687. AcquireRootMenu(void);
  2688. /*
  2689. * SetRootMenu()
  2690. *
  2691. * Summary:
  2692. * Sets the menu whose contents are displayed in the menubar.
  2693. *
  2694. * Discussion:
  2695. * The refcount of the root menu is incremented by this API. The
  2696. * caller may release the menu after calling SetRootMenu.
  2697. *
  2698. * Parameters:
  2699. *
  2700. * inMenu:
  2701. * The new root menu.
  2702. *
  2703. * Availability:
  2704. * Non-Carbon CFM: not available
  2705. * CarbonLib: in CarbonLib 1.1 and later
  2706. * Mac OS X: in version 10.0 and later
  2707. */
  2708. EXTERN_API( OSStatus )
  2709. SetRootMenu(MenuRef inMenu);
  2710. /*--------------------------------------------------------------------------------------*/
  2711. /* o Menu Item Accessors */
  2712. /*--------------------------------------------------------------------------------------*/
  2713. #if CALL_NOT_IN_CARBON
  2714. /*
  2715. * CheckItem()
  2716. *
  2717. * Summary:
  2718. * Renamed to CheckMenuItem in Carbon
  2719. *
  2720. * Availability:
  2721. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2722. * CarbonLib: not available
  2723. * Mac OS X: not available
  2724. */
  2725. EXTERN_API( void )
  2726. CheckItem(
  2727. MenuRef theMenu,
  2728. short item,
  2729. Boolean checked) ONEWORDINLINE(0xA945);
  2730. #endif /* CALL_NOT_IN_CARBON */
  2731. /*
  2732. * [Mac]CheckMenuItem()
  2733. *
  2734. * Availability:
  2735. * Non-Carbon CFM: in CarbonAccessors.o 1.3 and later or as macro/inline
  2736. * CarbonLib: in CarbonLib 1.0 and later
  2737. * Mac OS X: in version 10.0 and later
  2738. */
  2739. #if TARGET_OS_MAC
  2740. #define MacCheckMenuItem CheckMenuItem
  2741. #endif
  2742. EXTERN_API( void )
  2743. MacCheckMenuItem(
  2744. MenuRef theMenu,
  2745. short item,
  2746. Boolean checked) ONEWORDINLINE(0xA945);
  2747. #if CALL_NOT_IN_CARBON && !TARGET_CPU_68K
  2748. #ifdef __cplusplus
  2749. inline DEFINE_API(void) MacCheckMenuItem(MenuRef theMenu, short item, Boolean checked) { CheckItem(theMenu, item, checked); }
  2750. #else
  2751. #if TARGET_OS_MAC
  2752. #define CheckMenuItem(theMenu, item, checked) (CheckItem(theMenu, item, checked))
  2753. #else
  2754. #define MacCheckMenuItem(theMenu, item, checked) (CheckItem(theMenu, item, checked))
  2755. #endif
  2756. #endif
  2757. #endif
  2758. /*
  2759. * SetMenuItemText()
  2760. *
  2761. * Availability:
  2762. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2763. * CarbonLib: in CarbonLib 1.0 and later
  2764. * Mac OS X: in version 10.0 and later
  2765. */
  2766. EXTERN_API( void )
  2767. SetMenuItemText(
  2768. MenuRef theMenu,
  2769. short item,
  2770. ConstStr255Param itemString) ONEWORDINLINE(0xA947);
  2771. /*
  2772. * GetMenuItemText()
  2773. *
  2774. * Availability:
  2775. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2776. * CarbonLib: in CarbonLib 1.0 and later
  2777. * Mac OS X: in version 10.0 and later
  2778. */
  2779. EXTERN_API( void )
  2780. GetMenuItemText(
  2781. MenuRef theMenu,
  2782. short item,
  2783. Str255 itemString) ONEWORDINLINE(0xA946);
  2784. /*
  2785. * SetItemMark()
  2786. *
  2787. * Availability:
  2788. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2789. * CarbonLib: in CarbonLib 1.0 and later
  2790. * Mac OS X: in version 10.0 and later
  2791. */
  2792. EXTERN_API( void )
  2793. SetItemMark(
  2794. MenuRef theMenu,
  2795. short item,
  2796. CharParameter markChar) ONEWORDINLINE(0xA944);
  2797. /*
  2798. * GetItemMark()
  2799. *
  2800. * Availability:
  2801. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2802. * CarbonLib: in CarbonLib 1.0 and later
  2803. * Mac OS X: in version 10.0 and later
  2804. */
  2805. EXTERN_API( void )
  2806. GetItemMark(
  2807. MenuRef theMenu,
  2808. short item,
  2809. CharParameter * markChar) ONEWORDINLINE(0xA943);
  2810. /*
  2811. * SetItemCmd()
  2812. *
  2813. * Availability:
  2814. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2815. * CarbonLib: in CarbonLib 1.0 and later
  2816. * Mac OS X: in version 10.0 and later
  2817. */
  2818. EXTERN_API( void )
  2819. SetItemCmd(
  2820. MenuRef theMenu,
  2821. short item,
  2822. CharParameter cmdChar) ONEWORDINLINE(0xA84F);
  2823. /*
  2824. * GetItemCmd()
  2825. *
  2826. * Availability:
  2827. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2828. * CarbonLib: in CarbonLib 1.0 and later
  2829. * Mac OS X: in version 10.0 and later
  2830. */
  2831. EXTERN_API( void )
  2832. GetItemCmd(
  2833. MenuRef theMenu,
  2834. short item,
  2835. CharParameter * cmdChar) ONEWORDINLINE(0xA84E);
  2836. /*
  2837. * SetItemIcon()
  2838. *
  2839. * Availability:
  2840. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2841. * CarbonLib: in CarbonLib 1.0 and later
  2842. * Mac OS X: in version 10.0 and later
  2843. */
  2844. EXTERN_API( void )
  2845. SetItemIcon(
  2846. MenuRef theMenu,
  2847. short item,
  2848. short iconIndex) ONEWORDINLINE(0xA940);
  2849. /* icon is returned in high byte of 16-bit iconIndex */
  2850. /*
  2851. * GetItemIcon()
  2852. *
  2853. * Availability:
  2854. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2855. * CarbonLib: in CarbonLib 1.0 and later
  2856. * Mac OS X: in version 10.0 and later
  2857. */
  2858. EXTERN_API( void )
  2859. GetItemIcon(
  2860. MenuRef theMenu,
  2861. short item,
  2862. short * iconIndex) ONEWORDINLINE(0xA93F);
  2863. /*
  2864. * SetItemStyle()
  2865. *
  2866. * Availability:
  2867. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2868. * CarbonLib: in CarbonLib 1.0 and later
  2869. * Mac OS X: in version 10.0 and later
  2870. */
  2871. EXTERN_API( void )
  2872. SetItemStyle(
  2873. MenuRef theMenu,
  2874. short item,
  2875. StyleParameter chStyle) ONEWORDINLINE(0xA942);
  2876. /*
  2877. * GetItemStyle()
  2878. *
  2879. * Availability:
  2880. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2881. * CarbonLib: in CarbonLib 1.0 and later
  2882. * Mac OS X: in version 10.0 and later
  2883. */
  2884. EXTERN_API( void )
  2885. GetItemStyle(
  2886. MenuRef theMenu,
  2887. short item,
  2888. Style * chStyle);
  2889. /* These APIs are not supported in Carbon. Please use EnableMenuItem and */
  2890. /* DisableMenuItem (available back through Mac OS 8.5) instead. */
  2891. #if CALL_NOT_IN_CARBON
  2892. /*
  2893. * DisableItem()
  2894. *
  2895. * Availability:
  2896. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2897. * CarbonLib: not available
  2898. * Mac OS X: not available
  2899. */
  2900. EXTERN_API( void )
  2901. DisableItem(
  2902. MenuRef theMenu,
  2903. short item) ONEWORDINLINE(0xA93A);
  2904. /*
  2905. * EnableItem()
  2906. *
  2907. * Availability:
  2908. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2909. * CarbonLib: not available
  2910. * Mac OS X: not available
  2911. */
  2912. EXTERN_API( void )
  2913. EnableItem(
  2914. MenuRef theMenu,
  2915. short item) ONEWORDINLINE(0xA939);
  2916. #endif /* CALL_NOT_IN_CARBON */
  2917. /*
  2918. * SetMenuItemCommandID()
  2919. *
  2920. * Availability:
  2921. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2922. * CarbonLib: in CarbonLib 1.0 and later
  2923. * Mac OS X: in version 10.0 and later
  2924. */
  2925. EXTERN_API( OSErr )
  2926. SetMenuItemCommandID(
  2927. MenuRef inMenu,
  2928. SInt16 inItem,
  2929. MenuCommand inCommandID) THREEWORDINLINE(0x303C, 0x0502, 0xA825);
  2930. /*
  2931. * GetMenuItemCommandID()
  2932. *
  2933. * Availability:
  2934. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2935. * CarbonLib: in CarbonLib 1.0 and later
  2936. * Mac OS X: in version 10.0 and later
  2937. */
  2938. EXTERN_API( OSErr )
  2939. GetMenuItemCommandID(
  2940. MenuRef inMenu,
  2941. SInt16 inItem,
  2942. MenuCommand * outCommandID) THREEWORDINLINE(0x303C, 0x0503, 0xA825);
  2943. /*
  2944. * SetMenuItemModifiers()
  2945. *
  2946. * Availability:
  2947. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2948. * CarbonLib: in CarbonLib 1.0 and later
  2949. * Mac OS X: in version 10.0 and later
  2950. */
  2951. EXTERN_API( OSErr )
  2952. SetMenuItemModifiers(
  2953. MenuRef inMenu,
  2954. SInt16 inItem,
  2955. UInt8 inModifiers) THREEWORDINLINE(0x303C, 0x0404, 0xA825);
  2956. /*
  2957. * GetMenuItemModifiers()
  2958. *
  2959. * Availability:
  2960. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2961. * CarbonLib: in CarbonLib 1.0 and later
  2962. * Mac OS X: in version 10.0 and later
  2963. */
  2964. EXTERN_API( OSErr )
  2965. GetMenuItemModifiers(
  2966. MenuRef inMenu,
  2967. SInt16 inItem,
  2968. UInt8 * outModifiers) THREEWORDINLINE(0x303C, 0x0505, 0xA825);
  2969. /*
  2970. * SetMenuItemIconHandle()
  2971. *
  2972. * Availability:
  2973. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2974. * CarbonLib: in CarbonLib 1.0 and later
  2975. * Mac OS X: in version 10.0 and later
  2976. */
  2977. EXTERN_API( OSErr )
  2978. SetMenuItemIconHandle(
  2979. MenuRef inMenu,
  2980. SInt16 inItem,
  2981. UInt8 inIconType,
  2982. Handle inIconHandle) THREEWORDINLINE(0x303C, 0x0606, 0xA825);
  2983. /*
  2984. * GetMenuItemIconHandle()
  2985. *
  2986. * Availability:
  2987. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2988. * CarbonLib: in CarbonLib 1.0 and later
  2989. * Mac OS X: in version 10.0 and later
  2990. */
  2991. EXTERN_API( OSErr )
  2992. GetMenuItemIconHandle(
  2993. MenuRef inMenu,
  2994. SInt16 inItem,
  2995. UInt8 * outIconType,
  2996. Handle * outIconHandle) THREEWORDINLINE(0x303C, 0x0707, 0xA825);
  2997. /*
  2998. * SetMenuItemTextEncoding()
  2999. *
  3000. * Availability:
  3001. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3002. * CarbonLib: in CarbonLib 1.0 and later
  3003. * Mac OS X: in version 10.0 and later
  3004. */
  3005. EXTERN_API( OSErr )
  3006. SetMenuItemTextEncoding(
  3007. MenuRef inMenu,
  3008. SInt16 inItem,
  3009. TextEncoding inScriptID) THREEWORDINLINE(0x303C, 0x0408, 0xA825);
  3010. /*
  3011. * GetMenuItemTextEncoding()
  3012. *
  3013. * Availability:
  3014. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3015. * CarbonLib: in CarbonLib 1.0 and later
  3016. * Mac OS X: in version 10.0 and later
  3017. */
  3018. EXTERN_API( OSErr )
  3019. GetMenuItemTextEncoding(
  3020. MenuRef inMenu,
  3021. SInt16 inItem,
  3022. TextEncoding * outScriptID) THREEWORDINLINE(0x303C, 0x0509, 0xA825);
  3023. /*
  3024. * SetMenuItemHierarchicalID()
  3025. *
  3026. * Availability:
  3027. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3028. * CarbonLib: in CarbonLib 1.0 and later
  3029. * Mac OS X: in version 10.0 and later
  3030. */
  3031. EXTERN_API( OSErr )
  3032. SetMenuItemHierarchicalID(
  3033. MenuRef inMenu,
  3034. SInt16 inItem,
  3035. MenuID inHierID) THREEWORDINLINE(0x303C, 0x040D, 0xA825);
  3036. /*
  3037. * GetMenuItemHierarchicalID()
  3038. *
  3039. * Availability:
  3040. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3041. * CarbonLib: in CarbonLib 1.0 and later
  3042. * Mac OS X: in version 10.0 and later
  3043. */
  3044. EXTERN_API( OSErr )
  3045. GetMenuItemHierarchicalID(
  3046. MenuRef inMenu,
  3047. SInt16 inItem,
  3048. MenuID * outHierID) THREEWORDINLINE(0x303C, 0x050E, 0xA825);
  3049. /*
  3050. * SetMenuItemFontID()
  3051. *
  3052. * Availability:
  3053. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3054. * CarbonLib: in CarbonLib 1.0 and later
  3055. * Mac OS X: in version 10.0 and later
  3056. */
  3057. EXTERN_API( OSErr )
  3058. SetMenuItemFontID(
  3059. MenuRef inMenu,
  3060. SInt16 inItem,
  3061. SInt16 inFontID) THREEWORDINLINE(0x303C, 0x040F, 0xA825);
  3062. /*
  3063. * GetMenuItemFontID()
  3064. *
  3065. * Availability:
  3066. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3067. * CarbonLib: in CarbonLib 1.0 and later
  3068. * Mac OS X: in version 10.0 and later
  3069. */
  3070. EXTERN_API( OSErr )
  3071. GetMenuItemFontID(
  3072. MenuRef inMenu,
  3073. SInt16 inItem,
  3074. SInt16 * outFontID) THREEWORDINLINE(0x303C, 0x0510, 0xA825);
  3075. /*
  3076. * SetMenuItemRefCon()
  3077. *
  3078. * Availability:
  3079. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3080. * CarbonLib: in CarbonLib 1.0 and later
  3081. * Mac OS X: in version 10.0 and later
  3082. */
  3083. EXTERN_API( OSErr )
  3084. SetMenuItemRefCon(
  3085. MenuRef inMenu,
  3086. SInt16 inItem,
  3087. UInt32 inRefCon) THREEWORDINLINE(0x303C, 0x050A, 0xA825);
  3088. /*
  3089. * GetMenuItemRefCon()
  3090. *
  3091. * Availability:
  3092. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3093. * CarbonLib: in CarbonLib 1.0 and later
  3094. * Mac OS X: in version 10.0 and later
  3095. */
  3096. EXTERN_API( OSErr )
  3097. GetMenuItemRefCon(
  3098. MenuRef inMenu,
  3099. SInt16 inItem,
  3100. UInt32 * outRefCon) THREEWORDINLINE(0x303C, 0x050B, 0xA825);
  3101. /* Please use the menu item property APIs in Carbon.*/
  3102. #if CALL_NOT_IN_CARBON
  3103. /*
  3104. * SetMenuItemRefCon2()
  3105. *
  3106. * Availability:
  3107. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3108. * CarbonLib: not available
  3109. * Mac OS X: not available
  3110. */
  3111. EXTERN_API( OSErr )
  3112. SetMenuItemRefCon2(
  3113. MenuRef inMenu,
  3114. SInt16 inItem,
  3115. UInt32 inRefCon2) THREEWORDINLINE(0x303C, 0x0511, 0xA825);
  3116. /*
  3117. * GetMenuItemRefCon2()
  3118. *
  3119. * Availability:
  3120. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3121. * CarbonLib: not available
  3122. * Mac OS X: not available
  3123. */
  3124. EXTERN_API( OSErr )
  3125. GetMenuItemRefCon2(
  3126. MenuRef inMenu,
  3127. SInt16 inItem,
  3128. UInt32 * outRefCon2) THREEWORDINLINE(0x303C, 0x0512, 0xA825);
  3129. #endif /* CALL_NOT_IN_CARBON */
  3130. /*
  3131. * SetMenuItemKeyGlyph()
  3132. *
  3133. * Availability:
  3134. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3135. * CarbonLib: in CarbonLib 1.0 and later
  3136. * Mac OS X: in version 10.0 and later
  3137. */
  3138. EXTERN_API( OSErr )
  3139. SetMenuItemKeyGlyph(
  3140. MenuRef inMenu,
  3141. SInt16 inItem,
  3142. SInt16 inGlyph) THREEWORDINLINE(0x303C, 0x0513, 0xA825);
  3143. /*
  3144. * GetMenuItemKeyGlyph()
  3145. *
  3146. * Availability:
  3147. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3148. * CarbonLib: in CarbonLib 1.0 and later
  3149. * Mac OS X: in version 10.0 and later
  3150. */
  3151. EXTERN_API( OSErr )
  3152. GetMenuItemKeyGlyph(
  3153. MenuRef inMenu,
  3154. SInt16 inItem,
  3155. SInt16 * outGlyph) THREEWORDINLINE(0x303C, 0x0514, 0xA825);
  3156. /* Routines available in Mac OS 8.5 and later (supporting enabling/disabling of > 31 items)*/
  3157. /*
  3158. * [Mac]EnableMenuItem()
  3159. *
  3160. * Availability:
  3161. * Non-Carbon CFM: in MenusLib 8.5 and later
  3162. * CarbonLib: in CarbonLib 1.0 and later
  3163. * Mac OS X: in version 10.0 and later
  3164. */
  3165. #if TARGET_OS_MAC
  3166. #define MacEnableMenuItem EnableMenuItem
  3167. #endif
  3168. EXTERN_API( void )
  3169. MacEnableMenuItem(
  3170. MenuRef theMenu,
  3171. MenuItemIndex item);
  3172. /*
  3173. * DisableMenuItem()
  3174. *
  3175. * Availability:
  3176. * Non-Carbon CFM: in MenusLib 8.5 and later
  3177. * CarbonLib: in CarbonLib 1.0 and later
  3178. * Mac OS X: in version 10.0 and later
  3179. */
  3180. EXTERN_API( void )
  3181. DisableMenuItem(
  3182. MenuRef theMenu,
  3183. MenuItemIndex item);
  3184. /*
  3185. * IsMenuItemEnabled()
  3186. *
  3187. * Availability:
  3188. * Non-Carbon CFM: in MenusLib 8.5 and later
  3189. * CarbonLib: in CarbonLib 1.0 and later
  3190. * Mac OS X: in version 10.0 and later
  3191. */
  3192. EXTERN_API( Boolean )
  3193. IsMenuItemEnabled(
  3194. MenuRef menu,
  3195. MenuItemIndex item);
  3196. /*
  3197. * EnableMenuItemIcon()
  3198. *
  3199. * Availability:
  3200. * Non-Carbon CFM: in MenusLib 8.5 and later
  3201. * CarbonLib: in CarbonLib 1.0 and later
  3202. * Mac OS X: in version 10.0 and later
  3203. */
  3204. EXTERN_API( void )
  3205. EnableMenuItemIcon(
  3206. MenuRef theMenu,
  3207. MenuItemIndex item) THREEWORDINLINE(0x303C, 0x0019, 0xA825);
  3208. /*
  3209. * DisableMenuItemIcon()
  3210. *
  3211. * Availability:
  3212. * Non-Carbon CFM: in MenusLib 8.5 and later
  3213. * CarbonLib: in CarbonLib 1.0 and later
  3214. * Mac OS X: in version 10.0 and later
  3215. */
  3216. EXTERN_API( void )
  3217. DisableMenuItemIcon(
  3218. MenuRef theMenu,
  3219. MenuItemIndex item) THREEWORDINLINE(0x303C, 0x0020, 0xA825);
  3220. /*
  3221. * IsMenuItemIconEnabled()
  3222. *
  3223. * Availability:
  3224. * Non-Carbon CFM: in MenusLib 8.5 and later
  3225. * CarbonLib: in CarbonLib 1.0 and later
  3226. * Mac OS X: in version 10.0 and later
  3227. */
  3228. EXTERN_API( Boolean )
  3229. IsMenuItemIconEnabled(
  3230. MenuRef menu,
  3231. MenuItemIndex item) THREEWORDINLINE(0x303C, 0x0018, 0xA825);
  3232. /*
  3233. * SetMenuItemHierarchicalMenu()
  3234. *
  3235. * Summary:
  3236. * Attaches a submenu to a menu item.
  3237. *
  3238. * Discussion:
  3239. * Using SetMenuItemHierarchicalMenu, it is possible to directly
  3240. * specify the submenu for a menu item without specifying its menu
  3241. * ID. It is not necessary to insert the submenu into the
  3242. * hierarchical portion of the menubar, and it is not necessary for
  3243. * the submenu to have a unique menu ID; it is recommended that you
  3244. * use 0 as the menu ID for the submenu, and identify selections
  3245. * from the menu by command ID. The Menu Manager will increment the
  3246. * refcount of the submenu that you specify, and the submenu's
  3247. * refcount will be decremented automatically when the parent menu
  3248. * item is deleted or the parent menu is disposed.
  3249. *
  3250. * Parameters:
  3251. *
  3252. * inMenu:
  3253. * The parent menu.
  3254. *
  3255. * inItem:
  3256. * The parent item.
  3257. *
  3258. * inHierMenu:
  3259. * The submenu. You may pass NULL to remove any existing submenu.
  3260. *
  3261. * Availability:
  3262. * Non-Carbon CFM: not available
  3263. * CarbonLib: in CarbonLib 1.1 and later
  3264. * Mac OS X: in version 10.0 and later
  3265. */
  3266. EXTERN_API( OSStatus )
  3267. SetMenuItemHierarchicalMenu(
  3268. MenuRef inMenu,
  3269. MenuItemIndex inItem,
  3270. MenuRef inHierMenu); /* can be NULL */
  3271. /*
  3272. * GetMenuItemHierarchicalMenu()
  3273. *
  3274. * Summary:
  3275. * Returns the submenu attached to a menu item.
  3276. *
  3277. * Discussion:
  3278. * GetMenuItemHierarchicalMenu will return the submenu attached to a
  3279. * menu item regardless of how the submenu was specified. If the
  3280. * submenu was specified by menu ID (using SetItemCmd or
  3281. * SetMenuItemHierarchicalID), GetMenuItemHierarchicalMenu will
  3282. * return the currently installed menu with that ID, if any. The
  3283. * only case where GetMenuItemHierarchicalMenu will fail to return
  3284. * the item's submenu is when the submenu is specified by menu ID,
  3285. * but the submenu is not currently inserted in the menu bar.
  3286. *
  3287. * Parameters:
  3288. *
  3289. * inMenu:
  3290. * The parent menu.
  3291. *
  3292. * inItem:
  3293. * The parent item.
  3294. *
  3295. * outHierMenu:
  3296. * On exit, the item's submenu, or NULL if it does not have one.
  3297. *
  3298. * Availability:
  3299. * Non-Carbon CFM: not available
  3300. * CarbonLib: in CarbonLib 1.1 and later
  3301. * Mac OS X: in version 10.0 and later
  3302. */
  3303. EXTERN_API( OSStatus )
  3304. GetMenuItemHierarchicalMenu(
  3305. MenuRef inMenu,
  3306. MenuItemIndex inItem,
  3307. MenuRef * outHierMenu);
  3308. /*
  3309. * CopyMenuItemTextAsCFString()
  3310. *
  3311. * Summary:
  3312. * Returns a CFString containing the text of a menu item.
  3313. *
  3314. * Parameters:
  3315. *
  3316. * inMenu:
  3317. * The menu containing the item.
  3318. *
  3319. * inItem:
  3320. * The item whose text to return.
  3321. *
  3322. * outString:
  3323. * On exit, a CFString containing the item's text. This string
  3324. * must be released by the caller.
  3325. *
  3326. * Availability:
  3327. * Non-Carbon CFM: not available
  3328. * CarbonLib: in CarbonLib 1.1 and later
  3329. * Mac OS X: in version 10.0 and later
  3330. */
  3331. EXTERN_API( OSStatus )
  3332. CopyMenuItemTextAsCFString(
  3333. MenuRef inMenu,
  3334. MenuItemIndex inItem,
  3335. CFStringRef * outString);
  3336. /*
  3337. * SetMenuItemTextWithCFString()
  3338. *
  3339. * Summary:
  3340. * Sets the text of a menu item to the text contained in a CFString.
  3341. *
  3342. * Discussion:
  3343. * The Menu Manager will either make its own copy or just increment
  3344. * the refcount of the CFString before returning from
  3345. * SetMenuItemTextWithCFString, depending on whether the string is
  3346. * mutable or immutable. If the string is mutable, modifying the
  3347. * string after calling SetMenuItemTextWithCFString will have no
  3348. * effect on the menu item's actual text. The caller may release the
  3349. * string after calling SetMenuItemTextWithCFString.
  3350. *
  3351. * Parameters:
  3352. *
  3353. * inMenu:
  3354. * The menu containing the item.
  3355. *
  3356. * inItem:
  3357. * The item whose text to return.
  3358. *
  3359. * inString:
  3360. * The string containing the new menu item text.
  3361. *
  3362. * Availability:
  3363. * Non-Carbon CFM: not available
  3364. * CarbonLib: in CarbonLib 1.1 and later
  3365. * Mac OS X: in version 10.0 and later
  3366. */
  3367. EXTERN_API( OSStatus )
  3368. SetMenuItemTextWithCFString(
  3369. MenuRef inMenu,
  3370. MenuItemIndex inItem,
  3371. CFStringRef inString);
  3372. /*
  3373. * GetMenuItemIndent()
  3374. *
  3375. * Summary:
  3376. * Gets the indent level of a menu item.
  3377. *
  3378. * Discussion:
  3379. * The indent level of an item is an amount of extra space added to
  3380. * the left of the item's icon or checkmark. The level is simply a
  3381. * number, starting at zero, which the Menu Manager multiplies by a
  3382. * constant to get the indent in pixels. The default indent level is
  3383. * zero.
  3384. *
  3385. * Parameters:
  3386. *
  3387. * inMenu:
  3388. * The menu containing the item.
  3389. *
  3390. * inItem:
  3391. * The item whose indent to retrieve.
  3392. *
  3393. * outIndent:
  3394. * On exit, the indent level of the item.
  3395. *
  3396. * Availability:
  3397. * Non-Carbon CFM: not available
  3398. * CarbonLib: in CarbonLib 1.1 and later
  3399. * Mac OS X: in version 10.0 and later
  3400. */
  3401. EXTERN_API( OSStatus )
  3402. GetMenuItemIndent(
  3403. MenuRef inMenu,
  3404. MenuItemIndex inItem,
  3405. UInt32 * outIndent);
  3406. /*
  3407. * SetMenuItemIndent()
  3408. *
  3409. * Summary:
  3410. * Sets the indent level of a menu item.
  3411. *
  3412. * Discussion:
  3413. * The indent level of an item is an amount of extra space added to
  3414. * the left of the item's icon or checkmark. The level is simply a
  3415. * number, starting at zero, which the Menu Manager multiplies by a
  3416. * constant to get the indent in pixels. The default indent level is
  3417. * zero.
  3418. *
  3419. * Parameters:
  3420. *
  3421. * inMenu:
  3422. * The menu containing the item.
  3423. *
  3424. * inItem:
  3425. * The item whose indent to set.
  3426. *
  3427. * inIndent:
  3428. * The new indent level of the item.
  3429. *
  3430. * Availability:
  3431. * Non-Carbon CFM: not available
  3432. * CarbonLib: in CarbonLib 1.1 and later
  3433. * Mac OS X: in version 10.0 and later
  3434. */
  3435. EXTERN_API( OSStatus )
  3436. SetMenuItemIndent(
  3437. MenuRef inMenu,
  3438. MenuItemIndex inItem,
  3439. UInt32 inIndent);
  3440. /*
  3441. * GetMenuItemCommandKey()
  3442. *
  3443. * Summary:
  3444. * Gets the keyboard equivalent of a menu item.
  3445. *
  3446. * Discussion:
  3447. * A menu item's keyboard equivalent may be either a character code
  3448. * or a virtual keycode. An item's character code and virtual
  3449. * keycode are stored separately and may contain different values,
  3450. * but only one is used by the Menu Manager at any given time. When
  3451. * requesting a menu item's virtual keycode equivalent, you should
  3452. * first check that the item is using a virtual keycode by testing
  3453. * the kMenuItemAttrUseVirtualKey attribute for that item. If this
  3454. * attribute is not set, the item's virtual keycode is ignored by
  3455. * the Menu Manager. Note that zero is a valid virtual keycode, so
  3456. * you cannot test the returned keycode against zero to determine if
  3457. * the item is using a virtual keycode equivalent. You must test the
  3458. * kMenuItemAttrUseVirtualKey attribute.
  3459. *
  3460. * Parameters:
  3461. *
  3462. * inMenu:
  3463. * The menu containing the item.
  3464. *
  3465. * inItem:
  3466. * The item whose keyboard equivalent to retrieve.
  3467. *
  3468. * inGetVirtualKey:
  3469. * Indicates whether to retrieve the item's character code or
  3470. * virtual keycode equivalent.
  3471. *
  3472. * outKey:
  3473. * On exit, the keyboard equivalent of the item.
  3474. *
  3475. * Availability:
  3476. * Non-Carbon CFM: not available
  3477. * CarbonLib: in CarbonLib 1.1 and later
  3478. * Mac OS X: in version 10.0 and later
  3479. */
  3480. EXTERN_API( OSStatus )
  3481. GetMenuItemCommandKey(
  3482. MenuRef inMenu,
  3483. MenuItemIndex inItem,
  3484. Boolean inGetVirtualKey,
  3485. UInt16 * outKey);
  3486. /*
  3487. * SetMenuItemCommandKey()
  3488. *
  3489. * Summary:
  3490. * Sets the keyboard equivalent of a menu item.
  3491. *
  3492. * Discussion:
  3493. * A menu item's keyboard equivalent may be either a character code
  3494. * or a virtual keycode. The character code is always used to draw
  3495. * the item's keyboard equivalent in the menu, but either may be
  3496. * used for keyboard equivalent matching by MenuEvent and
  3497. * IsMenuKeyEvent, depending on whether the
  3498. * kMenuItemAttrUseVirtualKey item attribute is set. If
  3499. * SetMenuItemCommandKey is used to set the virtual keycode
  3500. * equivalent for a menu item, it also automatically sets the
  3501. * kMenuItemAttrUseVirtualKey item attribute. To make the menu item
  3502. * stop using the virtual keycode equivalent and use the character
  3503. * code equivalent instead, use ChangeMenuItemAttributes to clear
  3504. * the kMenuItemAttrUseVirtualKey item attribute.
  3505. *
  3506. * Parameters:
  3507. *
  3508. * inMenu:
  3509. * The menu containing the item.
  3510. *
  3511. * inItem:
  3512. * The item whose keyboard equivalent to set.
  3513. *
  3514. * inSetVirtualKey:
  3515. * Indicates whether to set the item's character code or virtual
  3516. * keycode equivalent.
  3517. *
  3518. * inKey:
  3519. * The item's new character code or virtual keycode equivalent.
  3520. *
  3521. * Availability:
  3522. * Non-Carbon CFM: not available
  3523. * CarbonLib: in CarbonLib 1.1 and later
  3524. * Mac OS X: in version 10.0 and later
  3525. */
  3526. EXTERN_API( OSStatus )
  3527. SetMenuItemCommandKey(
  3528. MenuRef inMenu,
  3529. MenuItemIndex inItem,
  3530. Boolean inSetVirtualKey,
  3531. UInt16 inKey);
  3532. /*--------------------------------------------------------------------------------------*/
  3533. /* o Menu Item Color Tables */
  3534. /* */
  3535. /* Menu color manipulation is considered deprecated with the advent of the Appearance */
  3536. /* Manager. Avoid using these routines if possible */
  3537. /*--------------------------------------------------------------------------------------*/
  3538. /*
  3539. * DeleteMCEntries()
  3540. *
  3541. * Availability:
  3542. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3543. * CarbonLib: in CarbonLib 1.0 and later
  3544. * Mac OS X: in version 10.0 and later
  3545. */
  3546. EXTERN_API( void )
  3547. DeleteMCEntries(
  3548. MenuID menuID,
  3549. short menuItem) ONEWORDINLINE(0xAA60);
  3550. /*
  3551. * GetMCInfo()
  3552. *
  3553. * Availability:
  3554. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3555. * CarbonLib: in CarbonLib 1.0 and later
  3556. * Mac OS X: in version 10.0 and later
  3557. */
  3558. EXTERN_API( MCTableHandle )
  3559. GetMCInfo(void) ONEWORDINLINE(0xAA61);
  3560. /*
  3561. * SetMCInfo()
  3562. *
  3563. * Availability:
  3564. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3565. * CarbonLib: in CarbonLib 1.0 and later
  3566. * Mac OS X: in version 10.0 and later
  3567. */
  3568. EXTERN_API( void )
  3569. SetMCInfo(MCTableHandle menuCTbl) ONEWORDINLINE(0xAA62);
  3570. /*
  3571. * DisposeMCInfo()
  3572. *
  3573. * Availability:
  3574. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3575. * CarbonLib: in CarbonLib 1.0 and later
  3576. * Mac OS X: in version 10.0 and later
  3577. */
  3578. EXTERN_API( void )
  3579. DisposeMCInfo(MCTableHandle menuCTbl) ONEWORDINLINE(0xAA63);
  3580. /*
  3581. * GetMCEntry()
  3582. *
  3583. * Availability:
  3584. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3585. * CarbonLib: in CarbonLib 1.0 and later
  3586. * Mac OS X: in version 10.0 and later
  3587. */
  3588. EXTERN_API( MCEntryPtr )
  3589. GetMCEntry(
  3590. MenuID menuID,
  3591. short menuItem) ONEWORDINLINE(0xAA64);
  3592. /*
  3593. * SetMCEntries()
  3594. *
  3595. * Availability:
  3596. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3597. * CarbonLib: in CarbonLib 1.0 and later
  3598. * Mac OS X: in version 10.0 and later
  3599. */
  3600. EXTERN_API( void )
  3601. SetMCEntries(
  3602. short numEntries,
  3603. MCTablePtr menuCEntries) ONEWORDINLINE(0xAA65);
  3604. /*--------------------------------------------------------------------------------------*/
  3605. /* o Properties (Mac OS 8.5 and later) */
  3606. /* */
  3607. /* With the following property APIs, you can attach any piece of data you'd like to a */
  3608. /* menu or menu item. Passing zero for the item number parameter indicates you'd like */
  3609. /* to attach the data to the menu itself, and not to any specific menu item. */
  3610. /*--------------------------------------------------------------------------------------*/
  3611. enum {
  3612. kMenuPropertyPersistent = 0x00000001 /* whether this property gets saved when flattening the menu*/
  3613. };
  3614. /*
  3615. * GetMenuItemProperty()
  3616. *
  3617. * Availability:
  3618. * Non-Carbon CFM: in MenusLib 8.5 and later
  3619. * CarbonLib: in CarbonLib 1.0 and later
  3620. * Mac OS X: in version 10.0 and later
  3621. */
  3622. EXTERN_API( OSStatus )
  3623. GetMenuItemProperty(
  3624. MenuRef menu,
  3625. MenuItemIndex item,
  3626. OSType propertyCreator,
  3627. OSType propertyTag,
  3628. UInt32 bufferSize,
  3629. UInt32 * actualSize,
  3630. void * propertyBuffer);
  3631. /*
  3632. * GetMenuItemPropertySize()
  3633. *
  3634. * Availability:
  3635. * Non-Carbon CFM: in MenusLib 8.5 and later
  3636. * CarbonLib: in CarbonLib 1.0 and later
  3637. * Mac OS X: in version 10.0 and later
  3638. */
  3639. EXTERN_API( OSStatus )
  3640. GetMenuItemPropertySize(
  3641. MenuRef menu,
  3642. MenuItemIndex item,
  3643. OSType propertyCreator,
  3644. OSType propertyTag,
  3645. UInt32 * size);
  3646. /*
  3647. * SetMenuItemProperty()
  3648. *
  3649. * Availability:
  3650. * Non-Carbon CFM: in MenusLib 8.5 and later
  3651. * CarbonLib: in CarbonLib 1.0 and later
  3652. * Mac OS X: in version 10.0 and later
  3653. */
  3654. EXTERN_API( OSStatus )
  3655. SetMenuItemProperty(
  3656. MenuRef menu,
  3657. MenuItemIndex item,
  3658. OSType propertyCreator,
  3659. OSType propertyTag,
  3660. UInt32 propertySize,
  3661. const void * propertyData);
  3662. /*
  3663. * RemoveMenuItemProperty()
  3664. *
  3665. * Availability:
  3666. * Non-Carbon CFM: in MenusLib 8.5 and later
  3667. * CarbonLib: in CarbonLib 1.0 and later
  3668. * Mac OS X: in version 10.0 and later
  3669. */
  3670. EXTERN_API( OSStatus )
  3671. RemoveMenuItemProperty(
  3672. MenuRef menu,
  3673. MenuItemIndex item,
  3674. OSType propertyCreator,
  3675. OSType propertyTag);
  3676. /*
  3677. * GetMenuItemPropertyAttributes()
  3678. *
  3679. * Summary:
  3680. * Gets the attributes of a menu item property.
  3681. *
  3682. * Parameters:
  3683. *
  3684. * menu:
  3685. * The menu.
  3686. *
  3687. * item:
  3688. * The menu item.
  3689. *
  3690. * propertyCreator:
  3691. * The creator code of the property.
  3692. *
  3693. * propertyTag:
  3694. * The property tag.
  3695. *
  3696. * attributes:
  3697. * On exit, contains the attributes of the property.
  3698. *
  3699. * Availability:
  3700. * Non-Carbon CFM: not available
  3701. * CarbonLib: in CarbonLib 1.0 and later
  3702. * Mac OS X: in version 10.0 and later
  3703. */
  3704. EXTERN_API( OSStatus )
  3705. GetMenuItemPropertyAttributes(
  3706. MenuRef menu,
  3707. MenuItemIndex item,
  3708. OSType propertyCreator,
  3709. OSType propertyTag,
  3710. UInt32 * attributes);
  3711. /*
  3712. * ChangeMenuItemPropertyAttributes()
  3713. *
  3714. * Summary:
  3715. * Changes the attributes of a menu item property.
  3716. *
  3717. * Parameters:
  3718. *
  3719. * menu:
  3720. * The menu.
  3721. *
  3722. * item:
  3723. * The menu item.
  3724. *
  3725. * propertyCreator:
  3726. * The creator code of the property.
  3727. *
  3728. * propertyTag:
  3729. * The property tag.
  3730. *
  3731. * attributesToSet:
  3732. * The attributes to add to the menu item property.
  3733. *
  3734. * attributesToClear:
  3735. * The attributes to remove from the menu item property.
  3736. *
  3737. * Availability:
  3738. * Non-Carbon CFM: not available
  3739. * CarbonLib: in CarbonLib 1.0 and later
  3740. * Mac OS X: in version 10.0 and later
  3741. */
  3742. EXTERN_API( OSStatus )
  3743. ChangeMenuItemPropertyAttributes(
  3744. MenuRef menu,
  3745. MenuItemIndex item,
  3746. OSType propertyCreator,
  3747. OSType propertyTag,
  3748. UInt32 attributesToSet,
  3749. UInt32 attributesToClear);
  3750. /*--------------------------------------------------------------------------------------*/
  3751. /* o Attributes (Carbon and later) */
  3752. /* */
  3753. /* Each menu and menu item has attribute flags. */
  3754. /*--------------------------------------------------------------------------------------*/
  3755. /*
  3756. * GetMenuAttributes()
  3757. *
  3758. * Summary:
  3759. * Gets the attributes of a menu.
  3760. *
  3761. * Parameters:
  3762. *
  3763. * menu:
  3764. * The menu.
  3765. *
  3766. * outAttributes:
  3767. * On exit, contains the attributes of the menu.
  3768. *
  3769. * Availability:
  3770. * Non-Carbon CFM: not available
  3771. * CarbonLib: in CarbonLib 1.0 and later
  3772. * Mac OS X: in version 10.0 and later
  3773. */
  3774. EXTERN_API( OSStatus )
  3775. GetMenuAttributes(
  3776. MenuRef menu,
  3777. MenuAttributes * outAttributes);
  3778. /*
  3779. * ChangeMenuAttributes()
  3780. *
  3781. * Summary:
  3782. * Changes the attributes of a menu.
  3783. *
  3784. * Parameters:
  3785. *
  3786. * menu:
  3787. * The menu.
  3788. *
  3789. * setTheseAttributes:
  3790. * The attributes to add to the menu.
  3791. *
  3792. * clearTheseAttributes:
  3793. * The attributes to remove from the menu.
  3794. *
  3795. * Availability:
  3796. * Non-Carbon CFM: not available
  3797. * CarbonLib: in CarbonLib 1.0 and later
  3798. * Mac OS X: in version 10.0 and later
  3799. */
  3800. EXTERN_API( OSStatus )
  3801. ChangeMenuAttributes(
  3802. MenuRef menu,
  3803. MenuAttributes setTheseAttributes,
  3804. MenuAttributes clearTheseAttributes);
  3805. /*
  3806. * GetMenuItemAttributes()
  3807. *
  3808. * Summary:
  3809. * Gets the attributes of a menu item.
  3810. *
  3811. * Parameters:
  3812. *
  3813. * menu:
  3814. * The menu.
  3815. *
  3816. * item:
  3817. * The menu item.
  3818. *
  3819. * outAttributes:
  3820. * On exit, contains the attributes of the menu item.
  3821. *
  3822. * Availability:
  3823. * Non-Carbon CFM: not available
  3824. * CarbonLib: in CarbonLib 1.0 and later
  3825. * Mac OS X: in version 10.0 and later
  3826. */
  3827. EXTERN_API( OSStatus )
  3828. GetMenuItemAttributes(
  3829. MenuRef menu,
  3830. MenuItemIndex item,
  3831. MenuItemAttributes * outAttributes);
  3832. /*
  3833. * ChangeMenuItemAttributes()
  3834. *
  3835. * Summary:
  3836. * Changes the attributes of a menu item.
  3837. *
  3838. * Parameters:
  3839. *
  3840. * menu:
  3841. * The menu.
  3842. *
  3843. * item:
  3844. * The menu item.
  3845. *
  3846. * setTheseAttributes:
  3847. * The attributes to add to the menu item.
  3848. *
  3849. * clearTheseAttributes:
  3850. * The attributes to remove from the menu item.
  3851. *
  3852. * Availability:
  3853. * Non-Carbon CFM: not available
  3854. * CarbonLib: in CarbonLib 1.0 and later
  3855. * Mac OS X: in version 10.0 and later
  3856. */
  3857. EXTERN_API( OSStatus )
  3858. ChangeMenuItemAttributes(
  3859. MenuRef menu,
  3860. MenuItemIndex item,
  3861. MenuItemAttributes setTheseAttributes,
  3862. MenuItemAttributes clearTheseAttributes);
  3863. /*--------------------------------------------------------------------------------------*/
  3864. /* o Mass menu item enabling and disabling (Carbon and later) */
  3865. /* */
  3866. /* Useful when rewriting code that modifies the enableFlags field directly. */
  3867. /*--------------------------------------------------------------------------------------*/
  3868. /*
  3869. * DisableAllMenuItems()
  3870. *
  3871. * Summary:
  3872. * Disables all items in a menu.
  3873. *
  3874. * Discussion:
  3875. * This API is equivalent to pre-Carbon code that masked the
  3876. * enableFlags field of the MenuInfo with 0x01. It disables all
  3877. * items (including items past item 31) but does not affect the
  3878. * state of the menu title.
  3879. *
  3880. * Parameters:
  3881. *
  3882. * theMenu:
  3883. * The menu whose items to disable.
  3884. *
  3885. * Availability:
  3886. * Non-Carbon CFM: not available
  3887. * CarbonLib: in CarbonLib 1.0 and later
  3888. * Mac OS X: in version 10.0 and later
  3889. */
  3890. EXTERN_API( void )
  3891. DisableAllMenuItems(MenuRef theMenu);
  3892. /*
  3893. * EnableAllMenuItems()
  3894. *
  3895. * Summary:
  3896. * Enables all items in a menu.
  3897. *
  3898. * Discussion:
  3899. * This API is equivalent to pre-Carbon code that or'd the
  3900. * enableFlags field of the MenuInfo with 0xFFFFFFFE. It enables all
  3901. * items (including items past item 31) but does not affect the
  3902. * state of the menu title.
  3903. *
  3904. * Parameters:
  3905. *
  3906. * theMenu:
  3907. * The menu whose items to enable.
  3908. *
  3909. * Availability:
  3910. * Non-Carbon CFM: not available
  3911. * CarbonLib: in CarbonLib 1.0 and later
  3912. * Mac OS X: in version 10.0 and later
  3913. */
  3914. EXTERN_API( void )
  3915. EnableAllMenuItems(MenuRef theMenu);
  3916. /*
  3917. * MenuHasEnabledItems()
  3918. *
  3919. * Summary:
  3920. * Determines if any items in a menu are enabled.
  3921. *
  3922. * Discussion:
  3923. * This API is equivalent to pre-Carbon code that compared the
  3924. * enableFlags field of the MenuInfo with 0. It checks the enable
  3925. * state of all items to see if any are enabled, but ignores the
  3926. * state of the menu title. It will return true even if the menu
  3927. * title is disabled.
  3928. *
  3929. * Parameters:
  3930. *
  3931. * theMenu:
  3932. * The menu whose items to examine.
  3933. *
  3934. * Availability:
  3935. * Non-Carbon CFM: not available
  3936. * CarbonLib: in CarbonLib 1.0 and later
  3937. * Mac OS X: in version 10.0 and later
  3938. */
  3939. EXTERN_API( Boolean )
  3940. MenuHasEnabledItems(MenuRef theMenu);
  3941. /*--------------------------------------------------------------------------------------*/
  3942. /* o Menu tracking status (Carbon and later) */
  3943. /* */
  3944. /* Get info about the selected menu item during menu tracking. Replaces direct access */
  3945. /* to low-mem globals that previously held this info. */
  3946. /*--------------------------------------------------------------------------------------*/
  3947. /*
  3948. * GetMenuTrackingData()
  3949. *
  3950. * Summary:
  3951. * Gets information about the menu currently selected by the user.
  3952. *
  3953. * Discussion:
  3954. * This API replaces direct access to the low-memory globals
  3955. * TopMenuItem, AtMenuBottom, MenuDisable, and mbSaveLoc. It is only
  3956. * valid to call this API while menu tracking is occurring. This API
  3957. * will most commonly be used by custom MDEFs.
  3958. *
  3959. * Parameters:
  3960. *
  3961. * theMenu:
  3962. * The menu about which to get tracking information. May be NULL
  3963. * to get information about the menu that the user is currently
  3964. * selecting. If the menu is not currently open, menuNotFoundErr
  3965. * is returned.
  3966. *
  3967. * outData:
  3968. * On exit, contains tracking data about the menu. On CarbonLib,
  3969. * the itemRect field is not supported and is always set to an
  3970. * empty rect.
  3971. *
  3972. * Availability:
  3973. * Non-Carbon CFM: not available
  3974. * CarbonLib: in CarbonLib 1.0 and later
  3975. * Mac OS X: in version 10.0 and later
  3976. */
  3977. EXTERN_API( OSStatus )
  3978. GetMenuTrackingData(
  3979. MenuRef theMenu,
  3980. MenuTrackingData * outData);
  3981. /*
  3982. * GetMenuType()
  3983. *
  3984. * Summary:
  3985. * Gets the display type (pulldown, hierarchical, or popup) of a
  3986. * menu.
  3987. *
  3988. * Discussion:
  3989. * This API may only be called when the menu is displayed. If the
  3990. * menu is not currently open, an error is returned. The display
  3991. * type of a menu may vary from one menu tracking session to
  3992. * another; for example, the same menu might be displayed as a
  3993. * pulldown menu and as a popup menu.
  3994. *
  3995. * Parameters:
  3996. *
  3997. * theMenu:
  3998. * The menu whose type to get.
  3999. *
  4000. * outType:
  4001. * On exit, the type of the menu. The returned value will be one
  4002. * of the ThemeMenuType constants: kThemeMenuTypePullDown, PopUp,
  4003. * or Hierarchical. The kThemeMenuTypeInactive bit will never be
  4004. * set.
  4005. *
  4006. * Availability:
  4007. * Non-Carbon CFM: not available
  4008. * CarbonLib: in CarbonLib 1.1 and later
  4009. * Mac OS X: in version 10.0 and later
  4010. */
  4011. EXTERN_API( OSStatus )
  4012. GetMenuType(
  4013. MenuRef theMenu,
  4014. UInt16 * outType);
  4015. /*--------------------------------------------------------------------------------------*/
  4016. /* o.Universal command ID access (Carbon and later) */
  4017. /* */
  4018. /* These APIs allow you to operate on menu items strictly by command ID, with no */
  4019. /* knowledge of a menu item's index. */
  4020. /*--------------------------------------------------------------------------------------*/
  4021. /*
  4022. * CountMenuItemsWithCommandID()
  4023. *
  4024. * Summary:
  4025. * Counts the menu items with a specified command ID.
  4026. *
  4027. * Discussion:
  4028. * In CarbonLib 1.0.x and 1.1, this API always returns zero or one;
  4029. * it stops after finding the first menu item with the specified
  4030. * command ID. In CarbonLib 1.2 and Mac OS X 10.0 and later, it
  4031. * counts all menu items with the specified command ID. In Mac OS X
  4032. * 10.0 and CarbonLib 1.0 through 1.4, this API only searches
  4033. * top-level menus (menus visible in the menubar) and submenus of
  4034. * top-level menus. It does not search hierarchical menus that are
  4035. * inserted in the menubar but are not submenus of a top-level menus
  4036. * (for example, it does not search menus that are inserted for use
  4037. * in a popup menu control). In Mac OS X 10.1 and CarbonLib 1.5 and
  4038. * later, this API also searches inserted hierarchical menus.
  4039. *
  4040. * Parameters:
  4041. *
  4042. * inMenu:
  4043. * The menu in which to begin searching for items with the
  4044. * specified command ID. Pass NULL to hegin searching with the
  4045. * root menu. The search will descend into all submenus of this
  4046. * menu.
  4047. *
  4048. * inCommandID:
  4049. * The command ID for which to search.
  4050. *
  4051. * Availability:
  4052. * Non-Carbon CFM: not available
  4053. * CarbonLib: in CarbonLib 1.0 and later
  4054. * Mac OS X: in version 10.0 and later
  4055. */
  4056. EXTERN_API( ItemCount )
  4057. CountMenuItemsWithCommandID(
  4058. MenuRef inMenu,
  4059. MenuCommand inCommandID);
  4060. /*
  4061. * GetIndMenuItemWithCommandID()
  4062. *
  4063. * Summary:
  4064. * Finds a menu item with a specified command ID.
  4065. *
  4066. * Discussion:
  4067. * This API searches the specified menu and its submenus for the
  4068. * n'th menu item with the specified command ID. In CarbonLib 1.0.x
  4069. * and 1.1, only the first menu item is returned. In CarbonLib 1.2
  4070. * and Mac OS X 10.0 and later, this API iterates over all menu
  4071. * items with the specified command ID. In Mac OS X 10.0 and
  4072. * CarbonLib 1.0 through 1.4, this API only searches top-level menus
  4073. * (menus visible in the menubar) and submenus of top-level menus.
  4074. * It does not search hierarchical menus that are inserted in the
  4075. * menubar but are not submenus of a top-level menus (for example,
  4076. * it does not search menus that are inserted for use in a popup
  4077. * menu control). In Mac OS X 10.1 and CarbonLib 1.5 and later, this
  4078. * API also searches inserted hierarchical menus.
  4079. *
  4080. * Parameters:
  4081. *
  4082. * inMenu:
  4083. * The menu in which to begin searching for items with the
  4084. * specified command ID. Pass NULL to hegin searching with the
  4085. * root menu. The search will descend into all submenus of this
  4086. * menu.
  4087. *
  4088. * inCommandID:
  4089. * The command ID for which to search.
  4090. *
  4091. * inItemIndex:
  4092. * The 1-based index of the menu item to retrieve. In CarbonLib
  4093. * 1.0.x and 1.1, this parameter must be 1. In CarbonLib 1.2 and
  4094. * Mac OS X 10.0, this parameter may vary from 1 to the number of
  4095. * menu items with the specified command ID.
  4096. *
  4097. * outMenu:
  4098. * On exit, the menu containing the menu item with the specified
  4099. * command ID.
  4100. *
  4101. * outIndex:
  4102. * On exit, the item index of the menu item with the specified
  4103. * command ID.
  4104. *
  4105. * Availability:
  4106. * Non-Carbon CFM: not available
  4107. * CarbonLib: in CarbonLib 1.0 and later
  4108. * Mac OS X: in version 10.0 and later
  4109. */
  4110. EXTERN_API( OSStatus )
  4111. GetIndMenuItemWithCommandID(
  4112. MenuRef inMenu,
  4113. MenuCommand inCommandID,
  4114. UInt32 inItemIndex,
  4115. MenuRef * outMenu, /* can be NULL */
  4116. MenuItemIndex * outIndex); /* can be NULL */
  4117. /*
  4118. * EnableMenuCommand()
  4119. *
  4120. * Summary:
  4121. * Enables the menu item with a specified command ID.
  4122. *
  4123. * Parameters:
  4124. *
  4125. * inMenu:
  4126. * The menu in which to begin searching for the item. Pass NULL to
  4127. * begin searching with the root menu. The search will descend
  4128. * into all submenus of this menu.
  4129. *
  4130. * inCommandID:
  4131. * The command ID of the menu item to be enabled. If more than one
  4132. * item has this command ID, only the first will be enabled.
  4133. *
  4134. * Availability:
  4135. * Non-Carbon CFM: not available
  4136. * CarbonLib: in CarbonLib 1.0 and later
  4137. * Mac OS X: in version 10.0 and later
  4138. */
  4139. EXTERN_API( void )
  4140. EnableMenuCommand(
  4141. MenuRef inMenu,
  4142. MenuCommand inCommandID);
  4143. /*
  4144. * DisableMenuCommand()
  4145. *
  4146. * Summary:
  4147. * Disables the menu item with a specified command ID.
  4148. *
  4149. * Parameters:
  4150. *
  4151. * inMenu:
  4152. * The menu in which to begin searching for the item. Pass NULL to
  4153. * begin searching with the root menu. The search will descend
  4154. * into all submenus of this menu.
  4155. *
  4156. * inCommandID:
  4157. * The command ID of the menu item to be disabled. If more than
  4158. * one item has this command ID, only the first will be disabled.
  4159. *
  4160. * Availability:
  4161. * Non-Carbon CFM: not available
  4162. * CarbonLib: in CarbonLib 1.0 and later
  4163. * Mac OS X: in version 10.0 and later
  4164. */
  4165. EXTERN_API( void )
  4166. DisableMenuCommand(
  4167. MenuRef inMenu,
  4168. MenuCommand inCommandID);
  4169. /*
  4170. * IsMenuCommandEnabled()
  4171. *
  4172. * Summary:
  4173. * Determines if the menu item with a specified command ID is
  4174. * enabled.
  4175. *
  4176. * Parameters:
  4177. *
  4178. * inMenu:
  4179. * The menu in which to begin searching for the item. Pass NULL to
  4180. * begin searching with the root menu. The search will descend
  4181. * into all submenus of this menu.
  4182. *
  4183. * inCommandID:
  4184. * The command ID of the menu item to examine. If more than one
  4185. * item has this command ID, only the first will be examined.
  4186. *
  4187. * Availability:
  4188. * Non-Carbon CFM: not available
  4189. * CarbonLib: in CarbonLib 1.0 and later
  4190. * Mac OS X: in version 10.0 and later
  4191. */
  4192. EXTERN_API( Boolean )
  4193. IsMenuCommandEnabled(
  4194. MenuRef inMenu,
  4195. MenuCommand inCommandID);
  4196. /*
  4197. * SetMenuCommandMark()
  4198. *
  4199. * Summary:
  4200. * Locates the menu item with a specified command ID and sets its
  4201. * mark character.
  4202. *
  4203. * Parameters:
  4204. *
  4205. * inMenu:
  4206. * The menu in which to begin searching for the item. Pass NULL to
  4207. * begin searching with the root menu. The search will descend
  4208. * into all submenus of this menu.
  4209. *
  4210. * inCommandID:
  4211. * The command ID of the menu item to be modified. If more than
  4212. * one item has this command ID, only the first will be modified.
  4213. *
  4214. * inMark:
  4215. * The new mark character. This is a Unicode character. On Mac OS
  4216. * 8.x, the low byte of this character will be used as the mark
  4217. * character. On Mac OS X, the entire UniChar will be used and
  4218. * drawn.
  4219. *
  4220. * Availability:
  4221. * Non-Carbon CFM: not available
  4222. * CarbonLib: in CarbonLib 1.1 and later
  4223. * Mac OS X: in version 10.0 and later
  4224. */
  4225. EXTERN_API( OSStatus )
  4226. SetMenuCommandMark(
  4227. MenuRef inMenu,
  4228. MenuCommand inCommandID,
  4229. UniChar inMark);
  4230. /*
  4231. * GetMenuCommandMark()
  4232. *
  4233. * Summary:
  4234. * Locates the menu item with a specified command ID and returns its
  4235. * mark character.
  4236. *
  4237. * Parameters:
  4238. *
  4239. * inMenu:
  4240. * The menu in which to begin searching for the item. Pass NULL to
  4241. * begin searching with the root menu. The search will descend
  4242. * into all submenus of this menu.
  4243. *
  4244. * inCommandID:
  4245. * The command ID of the menu item to be examined. If more than
  4246. * one item has this command ID, only the first will be examined.
  4247. *
  4248. * outMark:
  4249. * On exit, the menu item's mark character.
  4250. *
  4251. * Availability:
  4252. * Non-Carbon CFM: not available
  4253. * CarbonLib: in CarbonLib 1.1 and later
  4254. * Mac OS X: in version 10.0 and later
  4255. */
  4256. EXTERN_API( OSStatus )
  4257. GetMenuCommandMark(
  4258. MenuRef inMenu,
  4259. MenuCommand inCommandID,
  4260. UniChar * outMark);
  4261. /*
  4262. * GetMenuCommandProperty()
  4263. *
  4264. * Summary:
  4265. * Retrives property data for a menu item with a specified command
  4266. * ID.
  4267. *
  4268. * Parameters:
  4269. *
  4270. * inMenu:
  4271. * The menu in which to begin searching for the item. Pass NULL to
  4272. * begin searching with the root menu. The search will descend
  4273. * into all submenus of this menu.
  4274. *
  4275. * inCommandID:
  4276. * The command ID of the menu item containing the property. If
  4277. * more than one item has this command ID, only the first will be
  4278. * used.
  4279. *
  4280. * inPropertyCreator:
  4281. * The property creator.
  4282. *
  4283. * inPropertyTag:
  4284. * The property tag.
  4285. *
  4286. * inBufferSize:
  4287. * The size of the output buffer, in bytes.
  4288. *
  4289. * outActualSize:
  4290. * On exit, contains the actual size of the property data. May be
  4291. * NULL if you do not need this information.
  4292. *
  4293. * inPropertyBuffer:
  4294. * The address of a buffer in which to place the property data.
  4295. *
  4296. * Availability:
  4297. * Non-Carbon CFM: not available
  4298. * CarbonLib: in CarbonLib 1.0 and later
  4299. * Mac OS X: in version 10.0 and later
  4300. */
  4301. EXTERN_API( OSStatus )
  4302. GetMenuCommandProperty(
  4303. MenuRef inMenu,
  4304. MenuCommand inCommandID,
  4305. OSType inPropertyCreator,
  4306. OSType inPropertyTag,
  4307. ByteCount inBufferSize,
  4308. ByteCount * outActualSize, /* can be NULL */
  4309. void * inPropertyBuffer);
  4310. /*
  4311. * GetMenuCommandPropertySize()
  4312. *
  4313. * Summary:
  4314. * Retrives the size of property data for a menu item with a
  4315. * specified command ID.
  4316. *
  4317. * Parameters:
  4318. *
  4319. * inMenu:
  4320. * The menu in which to begin searching for the item. Pass NULL to
  4321. * begin searching with the root menu. The search will descend
  4322. * into all submenus of this menu.
  4323. *
  4324. * inCommandID:
  4325. * The command ID of the menu item containing the property. If
  4326. * more than one item has this command ID, only the first will be
  4327. * used.
  4328. *
  4329. * inPropertyCreator:
  4330. * The property creator.
  4331. *
  4332. * inPropertyTag:
  4333. * The property tag.
  4334. *
  4335. * outSize:
  4336. * On exit, contains the size of the property data.
  4337. *
  4338. * Availability:
  4339. * Non-Carbon CFM: not available
  4340. * CarbonLib: in CarbonLib 1.0 and later
  4341. * Mac OS X: in version 10.0 and later
  4342. */
  4343. EXTERN_API( OSStatus )
  4344. GetMenuCommandPropertySize(
  4345. MenuRef inMenu,
  4346. MenuCommand inCommandID,
  4347. OSType inPropertyCreator,
  4348. OSType inPropertyTag,
  4349. ByteCount * outSize);
  4350. /*
  4351. * SetMenuCommandProperty()
  4352. *
  4353. * Summary:
  4354. * Sets property data for a menu item with a specified command ID.
  4355. *
  4356. * Parameters:
  4357. *
  4358. * inMenu:
  4359. * The menu in which to begin searching for the item. Pass NULL to
  4360. * begin searching with the root menu. The search will descend
  4361. * into all submenus of this menu.
  4362. *
  4363. * inCommandID:
  4364. * The command ID of the menu item that will receive the property.
  4365. * If more than one item has this command ID, only the first will
  4366. * be modified.
  4367. *
  4368. * inPropertyCreator:
  4369. * The property creator.
  4370. *
  4371. * inPropertyTag:
  4372. * The property tag.
  4373. *
  4374. * inPropertySize:
  4375. * The size of the property data, in bytes.
  4376. *
  4377. * inPropertyData:
  4378. * The address of the property data.
  4379. *
  4380. * Availability:
  4381. * Non-Carbon CFM: not available
  4382. * CarbonLib: in CarbonLib 1.0 and later
  4383. * Mac OS X: in version 10.0 and later
  4384. */
  4385. EXTERN_API( OSStatus )
  4386. SetMenuCommandProperty(
  4387. MenuRef inMenu,
  4388. MenuCommand inCommandID,
  4389. OSType inPropertyCreator,
  4390. OSType inPropertyTag,
  4391. ByteCount inPropertySize,
  4392. const void * inPropertyData);
  4393. /*
  4394. * RemoveMenuCommandProperty()
  4395. *
  4396. * Summary:
  4397. * Removes a property from a menu item with a specified command ID.
  4398. *
  4399. * Parameters:
  4400. *
  4401. * inMenu:
  4402. * The menu in which to begin searching for the item. Pass NULL to
  4403. * begin searching with the root menu. The search will descend
  4404. * into all submenus of this menu.
  4405. *
  4406. * inCommandID:
  4407. * The command ID of the menu item from which the property will be
  4408. * removed. If more than one item has this command ID, only the
  4409. * first will be modified.
  4410. *
  4411. * inPropertyCreator:
  4412. * The property creator.
  4413. *
  4414. * inPropertyTag:
  4415. * The property tag.
  4416. *
  4417. * Availability:
  4418. * Non-Carbon CFM: not available
  4419. * CarbonLib: in CarbonLib 1.0 and later
  4420. * Mac OS X: in version 10.0 and later
  4421. */
  4422. EXTERN_API( OSStatus )
  4423. RemoveMenuCommandProperty(
  4424. MenuRef inMenu,
  4425. MenuCommand inCommandID,
  4426. OSType inPropertyCreator,
  4427. OSType inPropertyTag);
  4428. /*
  4429. * CopyMenuItemData()
  4430. *
  4431. * Summary:
  4432. * Returns multiple attributes of a menu item at once.
  4433. *
  4434. * Discussion:
  4435. * This function is used to retrieve many attributes of a menu item
  4436. * simultaneously; for example, it might be used by a menu
  4437. * definition function that needs to know how to draw a menu item.
  4438. * It is more efficient to use this function than to use the
  4439. * accessor functions for the individual attributes of the menu.
  4440. * This function returns a copy of the data in the menu, so any data
  4441. * in the MenuItemDataRec that is dynamically allocated (for
  4442. * example, the CFString item text) should be released by the caller.
  4443. *
  4444. * Parameters:
  4445. *
  4446. * inMenu:
  4447. * The menu from which to copy data. If inIsCommandID is true, you
  4448. * may pass NULL for this parameter to search for an item in the
  4449. * root menu; if inIsCommandID is false, this parameter must be a
  4450. * valid MenuRef.
  4451. *
  4452. * inItem:
  4453. * The item or command ID from which to copy data.
  4454. *
  4455. * inIsCommandID:
  4456. * Indicates whether inItem is a MenuItemIndex or MenuCommand. If
  4457. * inIsCommandID is true, the inItem parameter is interpreted as a
  4458. * menu command ID, and data is copied from the first item in the
  4459. * menu with that command ID. If inIsCommandID is false, the
  4460. * inItem parameter is interpreted as a menu item index, and data
  4461. * is copied for that item in the specified menu.
  4462. *
  4463. * ioData:
  4464. * Data is copied from the item and placed here. On entry, the
  4465. * whichData field of this structure should be initialized to
  4466. * indicate which data the caller would like returned. Individual
  4467. * fields of the MenuItemDataRec structure may require
  4468. * pre-initialization also; see the individual MenuItemDataFlags
  4469. * documentation for details.
  4470. *
  4471. * Availability:
  4472. * Non-Carbon CFM: not available
  4473. * CarbonLib: in CarbonLib 1.1 and later
  4474. * Mac OS X: in version 10.0 and later
  4475. */
  4476. EXTERN_API( OSStatus )
  4477. CopyMenuItemData(
  4478. MenuRef inMenu, /* can be NULL */
  4479. MenuItemID inItem,
  4480. Boolean inIsCommandID,
  4481. MenuItemDataPtr ioData);
  4482. /*
  4483. * SetMenuItemData()
  4484. *
  4485. * Summary:
  4486. * Sets multiple attributes of a menu item at once.
  4487. *
  4488. * Discussion:
  4489. * This function is used to set many attributes of a menu item
  4490. * simultaneously. It is more efficient to use this function than to
  4491. * use the accessor functions for the individual attributes of the
  4492. * menu.
  4493. *
  4494. * Parameters:
  4495. *
  4496. * inMenu:
  4497. * The menu to modify.
  4498. *
  4499. * inItem:
  4500. * The item or command ID to modify.
  4501. *
  4502. * inIsCommandID:
  4503. * Indicates whether inItem is a MenuItemIndex or MenuCommand. If
  4504. * inIsCommandID is true, the inItem parameter is interpreted as a
  4505. * menu command ID, and the first item in the menu with that
  4506. * command ID. is modified. If inIsCommandID is false, the inItem
  4507. * parameter is interpreted as a menu item index, and the item
  4508. * with that index in the specified menu is modified.
  4509. *
  4510. * inData:
  4511. * The data to set. The caller should set the whichData field of
  4512. * this structure to indicate which data should be set. Only the
  4513. * fields of the structure corresponding to the non-zero whichData
  4514. * flags must be initialized; other fields are ignored.
  4515. *
  4516. * Availability:
  4517. * Non-Carbon CFM: not available
  4518. * CarbonLib: in CarbonLib 1.1 and later
  4519. * Mac OS X: in version 10.0 and later
  4520. */
  4521. EXTERN_API( OSStatus )
  4522. SetMenuItemData(
  4523. MenuRef inMenu,
  4524. MenuItemID inItem,
  4525. Boolean inIsCommandID,
  4526. const MenuItemDataRec * inData);
  4527. /*--------------------------------------------------------------------------------------*/
  4528. /* o Dynamic menu item support (CarbonLib 1.1 and Carbon for Mac OS X, and later) */
  4529. /* */
  4530. /* Dynamic menu item support allows a menu item to be redrawn while the menu is open */
  4531. /* and visible to the user. Carbon contains automatic support for dynamic items based */
  4532. /* on keyboard modifier state. If you need to implement your own variable item state */
  4533. /* based on other system state, you can use these APIs to implement it. */
  4534. /* */
  4535. /* To use the built-in support for dynamic items, you should create a menu containing */
  4536. /* several contiguous items with the same command key but different text and modifier */
  4537. /* keys. For example, you might have: */
  4538. /* */
  4539. /* Close cmd-W */
  4540. /* Close All cmd-option-W */
  4541. /* */
  4542. /* In your MENU resource, you would create the Close and Close All items and give */
  4543. /* them each the letter 'W' as the command key; using an associated xmnu resource, */
  4544. /* you would specify kMenuOptionModifier as the modifier for the Close All item. */
  4545. /* */
  4546. /* After loading your menu from the resource, you must set the kMenuItemAttrDynamic */
  4547. /* flag for each dynamic item. In this example, you would use: */
  4548. /* */
  4549. /* ChangeMenuItemAttributes( menu, kCloseItem, kMenuItemAttrDynamic, 0 ); */
  4550. /* ChangeMenuItemAttributes( menu, kCloseAllItem, kMenuItemAttrDynamic, 0 ); */
  4551. /* */
  4552. /* The Menu Manager will now automatically display the correct item depending on */
  4553. /* whether the Option key is pressed. The result from MenuSelect will be the item */
  4554. /* number of the item that was visible when the menu closed. */
  4555. /* */
  4556. /* If the Menu Manager's built-in support is not sufficient, you can also change the */
  4557. /* attributes of an item yourself and use the UpdateInvalidMenuItems API to cause */
  4558. /* the menu to redraw. Changes to a menu item (changing text, command key, style, */
  4559. /* etc.) that occur while the menu is open will cause the menu item to be invalidated, */
  4560. /* but not redrawn. If you need to invalidate the item explicitly yourself, perhaps */
  4561. /* because you have a custom MDEF that depends on state not accessed using Menu */
  4562. /* Manager APIs, you can use the InvalidateMenuItems API. UpdateInvalidMenuItems will */
  4563. /* scan the menu for invalid items and redraw each, clearing its invalid flag */
  4564. /* afterwards. */
  4565. /* */
  4566. /* If you need to change menu contents based on modifier key state without using the */
  4567. /* built-in support in the Menu Manager, we recommend that you install a Carbon event */
  4568. /* handler on your menu for the [kEventClassKeyboard, kEventRawKeyModifiersChanged] */
  4569. /* event. Modifier key events are passed to the currently open menu before being sent */
  4570. /* to the user focus target. */
  4571. /*--------------------------------------------------------------------------------------*/
  4572. /*
  4573. * IsMenuItemInvalid()
  4574. *
  4575. * Summary:
  4576. * Determines if a menu item is invalid and should be redrawn.
  4577. *
  4578. * Parameters:
  4579. *
  4580. * inMenu:
  4581. * The menu whose item to examine.
  4582. *
  4583. * inItem:
  4584. * The item to examine.
  4585. *
  4586. * Availability:
  4587. * Non-Carbon CFM: not available
  4588. * CarbonLib: in CarbonLib 1.1 and later
  4589. * Mac OS X: in version 10.0 and later
  4590. */
  4591. EXTERN_API( Boolean )
  4592. IsMenuItemInvalid(
  4593. MenuRef inMenu,
  4594. MenuItemIndex inItem);
  4595. /*
  4596. * InvalidateMenuItems()
  4597. *
  4598. * Summary:
  4599. * Invalidates a group of menu items so that they will be redrawn
  4600. * when UpdateInvalidMenuItems is next called.
  4601. *
  4602. * Discussion:
  4603. * Menu items are automatically invalidated when their contents are
  4604. * changed using Menu Manager APIs while the menu is open. However,
  4605. * you might need to use this API if you have a custom MDEF that
  4606. * draws using state not contained in the menu.
  4607. *
  4608. * Parameters:
  4609. *
  4610. * inMenu:
  4611. * The menu whose items to invalidate.
  4612. *
  4613. * inFirstItem:
  4614. * The first item to invalidate.
  4615. *
  4616. * inNumItems:
  4617. * The number of items to invalidate.
  4618. *
  4619. * Availability:
  4620. * Non-Carbon CFM: not available
  4621. * CarbonLib: in CarbonLib 1.1 and later
  4622. * Mac OS X: in version 10.0 and later
  4623. */
  4624. EXTERN_API( OSStatus )
  4625. InvalidateMenuItems(
  4626. MenuRef inMenu,
  4627. MenuItemIndex inFirstItem,
  4628. ItemCount inNumItems);
  4629. /*
  4630. * UpdateInvalidMenuItems()
  4631. *
  4632. * Summary:
  4633. * Redraws the invalid items of an open menu.
  4634. *
  4635. * Discussion:
  4636. * It is not necessary to use UpdateInvalidMenuItems if you are
  4637. * using Carbon's built-in support for dynamic items based on
  4638. * modifier key state. However, if you are modifying items
  4639. * dynamically using your own implementation, you should call
  4640. * UpdateInvalidMenuItems after completing your modifications for a
  4641. * single menu. It will redraw any items that have been marked as
  4642. * invalid, and clear the invalid flag for those items.
  4643. *
  4644. * Parameters:
  4645. *
  4646. * inMenu:
  4647. * The menu to update.
  4648. *
  4649. * Availability:
  4650. * Non-Carbon CFM: not available
  4651. * CarbonLib: in CarbonLib 1.1 and later
  4652. * Mac OS X: in version 10.0 and later
  4653. */
  4654. EXTERN_API( OSStatus )
  4655. UpdateInvalidMenuItems(MenuRef inMenu);
  4656. /*--------------------------------------------------------------------------------------*/
  4657. /* o.Standard font menu (Carbon and later) */
  4658. /* */
  4659. /* These APIs allow you to create and use the standard font menu. */
  4660. /*--------------------------------------------------------------------------------------*/
  4661. enum {
  4662. kHierarchicalFontMenuOption = 0x00000001
  4663. };
  4664. /*
  4665. * CreateStandardFontMenu()
  4666. *
  4667. * Availability:
  4668. * Non-Carbon CFM: not available
  4669. * CarbonLib: in CarbonLib 1.0 and later
  4670. * Mac OS X: in version 10.0 and later
  4671. */
  4672. EXTERN_API( OSStatus )
  4673. CreateStandardFontMenu(
  4674. MenuRef menu,
  4675. MenuItemIndex afterItem,
  4676. MenuID firstHierMenuID,
  4677. OptionBits options,
  4678. ItemCount * outHierMenuCount);
  4679. /*
  4680. * UpdateStandardFontMenu()
  4681. *
  4682. * Availability:
  4683. * Non-Carbon CFM: not available
  4684. * CarbonLib: in CarbonLib 1.0 and later
  4685. * Mac OS X: in version 10.0 and later
  4686. */
  4687. EXTERN_API( OSStatus )
  4688. UpdateStandardFontMenu(
  4689. MenuRef menu,
  4690. ItemCount * outHierMenuCount);
  4691. /*
  4692. * GetFontFamilyFromMenuSelection()
  4693. *
  4694. * Availability:
  4695. * Non-Carbon CFM: not available
  4696. * CarbonLib: in CarbonLib 1.0 and later
  4697. * Mac OS X: in version 10.0 and later
  4698. */
  4699. EXTERN_API( OSStatus )
  4700. GetFontFamilyFromMenuSelection(
  4701. MenuRef menu,
  4702. MenuItemIndex item,
  4703. FMFontFamily * outFontFamily,
  4704. FMFontStyle * outStyle);
  4705. /*--------------------------------------------------------------------------------------*/
  4706. /* o Contextual Menu routines and constants */
  4707. /* available with Conxtextual Menu extension 1.0 and later */
  4708. /*--------------------------------------------------------------------------------------*/
  4709. /* Gestalt Selector for classic 68K apps only. */
  4710. /* CFM apps should weak link and check the symbols. */
  4711. enum {
  4712. gestaltContextualMenuAttr = FOUR_CHAR_CODE('cmnu'),
  4713. gestaltContextualMenuUnusedBit = 0,
  4714. gestaltContextualMenuTrapAvailable = 1,
  4715. gestaltContextualMenuHasAttributeAndModifierKeys = 2, /* Contextual Menu Manager supports keyContextualMenuAttributes and keyContextualMenuModifiers */
  4716. gestaltContextualMenuHasUnicodeSupport = 3 /* Contextual Menu Manager supports typeUnicodeText and typeCFStringRef */
  4717. };
  4718. /*
  4719. * Summary:
  4720. * Values indicating what kind of help the application supports
  4721. */
  4722. enum {
  4723. /*
  4724. * The application does not support any help. The Menu Manager will
  4725. * put an appropriate help string into the contextual menu and
  4726. * disable the Help item.
  4727. */
  4728. kCMHelpItemNoHelp = 0,
  4729. /*
  4730. * The application supports Apple Guide help. The Menu Manager will
  4731. * put the name of the main Guide file into the contextual menu and
  4732. * enable the Help item.
  4733. */
  4734. kCMHelpItemAppleGuide = 1,
  4735. /*
  4736. * The application supports some other form of help. In this case,
  4737. * the application must also pass a valid string into the
  4738. * inHelpItemString parameter of ContextualMenuSelect. This string
  4739. * will be the text of the Help item in the contextual menu, and the
  4740. * Help item will be enabled.
  4741. */
  4742. kCMHelpItemOtherHelp = 2,
  4743. /*
  4744. * The application does not support any help. The Menu Manager will
  4745. * remove the Help item from the contextual menu. This constant is
  4746. * available in Mac OS X and CarbonLib 1.6, and later; however, in
  4747. * CarbonLib it is translated to kCMHelpItemNoHelp, and the Help item
  4748. * is only disabled, not removed.
  4749. */
  4750. kCMHelpItemRemoveHelp = 3
  4751. };
  4752. /*
  4753. * Summary:
  4754. * Values indicating what was chosen from a contextual menu
  4755. */
  4756. enum {
  4757. /*
  4758. * The user did not choose an item from the contextual menu and the
  4759. * application should do no further processing of the event.
  4760. */
  4761. kCMNothingSelected = 0,
  4762. /*
  4763. * The user chose one of the application's items from the menu. The
  4764. * application can examine the outMenuID and outMenuItem parameters
  4765. * of ContextualMenuSelect to see what the menu selection was, and it
  4766. * should then handle the selection appropriately.
  4767. */
  4768. kCMMenuItemSelected = 1,
  4769. /*
  4770. * The user chose the Help item from the menu. The application should
  4771. * open an Apple Guide database to a section appropriate for the
  4772. * selection. If the application supports some other form of help, it
  4773. * should be presented instead.
  4774. */
  4775. kCMShowHelpSelected = 3
  4776. };
  4777. /*
  4778. * Summary:
  4779. * AERecord keywords used by the ExamineContext method of a
  4780. * Contextual Menu plugin to specify menu item contents.
  4781. */
  4782. enum {
  4783. /*
  4784. * Specifies the text of an item in a contextual menu. Data for this
  4785. * parameter can be in one of several formats. In Mac OS 7/8/9.x and
  4786. * Mac OS X 10.0 and 10.1, typeChar and typeIntlText are supported.
  4787. * In Mac OS X after 10.1, typeStyledText, typeAEText,
  4788. * typeUnicodeText, and typeCFStringRef are also supported. If you
  4789. * provide data as typeCFStringRef, the Contextual Menu Manager will
  4790. * automatically release the CFStringRef once the menu has been
  4791. * displayed. If you need the CFStringRef to have a longer timetime,
  4792. * your plugin should retain the CFStringRef before inserting it into
  4793. * the AERecord.
  4794. */
  4795. keyContextualMenuName = FOUR_CHAR_CODE('pnam'),
  4796. /*
  4797. * Specifies the command ID of an item in a contextual menu. Data for
  4798. * this parameter should be typeLongInteger.
  4799. */
  4800. keyContextualMenuCommandID = FOUR_CHAR_CODE('cmcd'),
  4801. /*
  4802. * Specifies a contextual menu item with a submenu. Typically used
  4803. * with AEPutKeyDesc to add an entire AEDesc containing the submenu
  4804. * as the data for the parameter.
  4805. */
  4806. keyContextualMenuSubmenu = FOUR_CHAR_CODE('cmsb'),
  4807. /*
  4808. * Specifies the menu item attributes of an item in a contextual
  4809. * menu. Data for this parameter should be typeLongInteger. Available
  4810. * in Mac OS X after 10.1.
  4811. */
  4812. keyContextualMenuAttributes = FOUR_CHAR_CODE('cmat'),
  4813. /*
  4814. * Specifies the modifier keys of an item in a contextual menu (see
  4815. * kMenuShiftModifier, kMenuControlModifier, etc.) Data for this
  4816. * parameter should be typeLongInteger. Using this parameter together
  4817. * with the keyContextualMenuAttributes parameter, it is possible to
  4818. * create a contextual menu with dynamic items which change according
  4819. * to the modifier keys pressed by the user. Available in Mac OS X
  4820. * after 10.1.
  4821. */
  4822. keyContextualMenuModifiers = FOUR_CHAR_CODE('cmmd')
  4823. };
  4824. /*
  4825. * InitContextualMenus()
  4826. *
  4827. * Summary:
  4828. * Adds the current process to the system registry of contextual
  4829. * menu clients.
  4830. *
  4831. * Discussion:
  4832. * On Mac OS 8.x and 9.x, your program should call the
  4833. * InitContextualMenus function early in your startup code to
  4834. * register your application as a contextual menu client. If you do
  4835. * not register your program, some system-level functions may
  4836. * respond as though your program does not use contextual menus. Not
  4837. * registering your program may also cause
  4838. * ProcessIsContextualMenuClient to return an incorrect value. On
  4839. * Mac OS X, it is not necessary to call InitContextualMenus.
  4840. *
  4841. * Availability:
  4842. * Non-Carbon CFM: in ContextualMenu 1.0 and later
  4843. * CarbonLib: in CarbonLib 1.0 and later
  4844. * Mac OS X: in version 10.0 and later
  4845. */
  4846. EXTERN_API( OSStatus )
  4847. InitContextualMenus(void) TWOWORDINLINE(0x7001, 0xAA72);
  4848. /*
  4849. * IsShowContextualMenuClick()
  4850. *
  4851. * Summary:
  4852. * Determines whether a particular EventRecord could invoke a
  4853. * contextual menu.
  4854. *
  4855. * Discussion:
  4856. * Applications should call IsShowContextualMenuClick when they
  4857. * receive non-null events. If IsShowContextualMenuClick returns
  4858. * true, your application should generate its own menu and Apple
  4859. * Event descriptor (AEDesc), and then call ContextualMenuSelect to
  4860. * display and track the contextual menu, and then handle the user's
  4861. * choice. Some users may choose to use a two-button mouse with
  4862. * their Macintosh computer. This API does not return true for a
  4863. * right-click unless the mouse manufacturer has provided driver
  4864. * software that returns a control-left click in place of a right
  4865. * click. For proper recognition of a right-click gesture, you must
  4866. * use the IsShowContextualMenuEvent API.
  4867. *
  4868. * Parameters:
  4869. *
  4870. * inEvent:
  4871. * The event to examine.
  4872. *
  4873. * Result:
  4874. * Returns true if the application should display a contextual menu,
  4875. * false if not.
  4876. *
  4877. * Availability:
  4878. * Non-Carbon CFM: in ContextualMenu 1.0 and later
  4879. * CarbonLib: in CarbonLib 1.0 and later
  4880. * Mac OS X: in version 10.0 and later
  4881. */
  4882. EXTERN_API( Boolean )
  4883. IsShowContextualMenuClick(const EventRecord * inEvent) TWOWORDINLINE(0x7002, 0xAA72);
  4884. /*
  4885. * IsShowContextualMenuEvent()
  4886. *
  4887. * Summary:
  4888. * Determines whether a particular EventRef could invoke a
  4889. * contextual menu.
  4890. *
  4891. * Discussion:
  4892. * This API is similar to IsShowContextualMenuClick, but takes a
  4893. * Carbon EventRef as its parameter instead of an EventRecord.
  4894. * EventRecords cannot express a right-mouse-click, but EventRefs
  4895. * can, so this API will return true for a right- click where
  4896. * IsShowContextualMenuClick will not.
  4897. *
  4898. * Parameters:
  4899. *
  4900. * inEvent:
  4901. * The event to examine.
  4902. *
  4903. * Result:
  4904. * Returns true if the application should display a contextual menu,
  4905. * false if not.
  4906. *
  4907. * Availability:
  4908. * Non-Carbon CFM: not available
  4909. * CarbonLib: in CarbonLib 1.1 and later
  4910. * Mac OS X: in version 10.0 and later
  4911. */
  4912. EXTERN_API( Boolean )
  4913. IsShowContextualMenuEvent(EventRef inEvent);
  4914. /*
  4915. * ContextualMenuSelect()
  4916. *
  4917. * Summary:
  4918. * Displays a contextual menu.
  4919. *
  4920. * Discussion:
  4921. * If IsShowContextualMenuClick returns true, you should call the
  4922. * ContextualMenuSelect API after generating your own menu and
  4923. * preparing an Apple Event descriptor (AEDesc) that describes the
  4924. * item for which your application is displaying a contextual menu.
  4925. * This descriptor may contain an object specifier or raw data and
  4926. * will be passed to all contextual menu plug-ins. The system will
  4927. * add other items before displaying the contextual menu, and it
  4928. * will remove those items before returning, leaving the menu in its
  4929. * original state. After all the system commands are added, the
  4930. * contextual menu is displayed and tracked. If the user selects one
  4931. * of the system items, it is handled by the system and the call
  4932. * returns as though the user didn't select anything from the menu.
  4933. * If the user selects any other item (or no item at all), the Menu
  4934. * Manager passes back appropriate values in the parameters
  4935. * outUserSelectionType, outMenuID, and outMenuItem. Your
  4936. * application should provide visual feedback indicating the item
  4937. * that was clicked upon. For example, a click on an icon should
  4938. * highlight the icon, while a click on editable text should not
  4939. * eliminate the current selection. If the outUserSelectionType
  4940. * parameter contains kCMMenuItemSelected, you should look at the
  4941. * outMenuID and outMenuItem parameters to determine what menu item
  4942. * the user chose and handle it appropriately. If the user selected
  4943. * kCMHelpItemSelected, you should open the proper Apple Guide
  4944. * sequence or other form of custom help.
  4945. *
  4946. * Parameters:
  4947. *
  4948. * inMenu:
  4949. * A menu containing application commands to display. The caller
  4950. * creates this menu based on the current context, the mouse
  4951. * location, and the current selection (if it was the target of
  4952. * the mouse). If you pass nil, only system commands will be
  4953. * displayed. The menu should be added to the menu list as a
  4954. * pop-up menu (using the InsertMenu function).
  4955. *
  4956. * inGlobalLocation:
  4957. * The location (in global coordinates) of the mouse near which
  4958. * the menu is to be displayed.
  4959. *
  4960. * inReserved:
  4961. * Reserved for future use. Pass false for this parameter.
  4962. *
  4963. * inHelpType:
  4964. * An identifier specifying the type of help to be provided by the
  4965. * application; see kCMHelpItem constants.
  4966. *
  4967. * inHelpItemString:
  4968. * A string containing the text to be displayed for the help menu
  4969. * item. This string is unused unless you also pass the constant
  4970. * kCMHelpItemOtherHelp in the inHelpType parameter.
  4971. *
  4972. * inSelection:
  4973. * An object specifier for the current selection. This allows he
  4974. * system to examine the selection and add special system commands
  4975. * accordingly. Passing a value of nil indicates that no selection
  4976. * should be examined, and most likely, no special system actions
  4977. * will be included.
  4978. *
  4979. * outUserSelectionType:
  4980. * On exit, the value indicates what the user selected from the
  4981. * contextual menu; see kCMNothingSelected, kCMMenuItemSelected,
  4982. * and kCMShowHelpSelected.
  4983. *
  4984. * outMenuID:
  4985. * On exit, if outUserSelectionType is set to kCMMenuItemSelected,
  4986. * the value is set to the menu ID of the chosen item.
  4987. *
  4988. * outMenuItem:
  4989. * On exit, if outUserSelectionType is set to kCMMenuItemSelected,
  4990. * the value is set to the menu item chosen.
  4991. *
  4992. * Result:
  4993. * An OSStatus result code. ContextualMenuSelect returns the result
  4994. * code userCanceledErr and sets outUserSelectionType to
  4995. * kCMNothingSelected to indicate that the user did not select
  4996. * anything from the contextual menu and no further processing is
  4997. * needed.
  4998. *
  4999. * Availability:
  5000. * Non-Carbon CFM: in ContextualMenu 1.0 and later
  5001. * CarbonLib: in CarbonLib 1.0 and later
  5002. * Mac OS X: in version 10.0 and later
  5003. */
  5004. EXTERN_API( OSStatus )
  5005. ContextualMenuSelect(
  5006. MenuRef inMenu,
  5007. Point inGlobalLocation,
  5008. Boolean inReserved,
  5009. UInt32 inHelpType,
  5010. ConstStr255Param inHelpItemString, /* can be NULL */
  5011. const AEDesc * inSelection, /* can be NULL */
  5012. UInt32 * outUserSelectionType,
  5013. SInt16 * outMenuID,
  5014. MenuItemIndex * outMenuItem) TWOWORDINLINE(0x7003, 0xAA72);
  5015. /*
  5016. * ProcessIsContextualMenuClient()
  5017. *
  5018. * Summary:
  5019. * Determines whether the specified process is a contextual menu
  5020. * client.
  5021. *
  5022. * Discussion:
  5023. * On Mac OS 9, this API consults a global table of all processes
  5024. * that have registered with the Contextual Menu Manager by calling
  5025. * InitContextualMenus. On Mac OS X, this API ignores the inPSN
  5026. * parameter and always returns whether the current process is
  5027. * registered with the Contextual Menu Manager.
  5028. *
  5029. * Parameters:
  5030. *
  5031. * inPSN:
  5032. * The process to examine.
  5033. *
  5034. * Result:
  5035. * Whether the specified process (or, on Mac OS X, the current
  5036. * process) is registered with the Contextual Menu Manager.
  5037. *
  5038. * Availability:
  5039. * Non-Carbon CFM: in ContextualMenu 1.0 and later
  5040. * CarbonLib: in CarbonLib 1.0 and later
  5041. * Mac OS X: in version 10.0 and later
  5042. */
  5043. EXTERN_API( Boolean )
  5044. ProcessIsContextualMenuClient(ProcessSerialNumber * inPSN) TWOWORDINLINE(0x7004, 0xAA72);
  5045. /*--------------------------------------------------------------------------------------*/
  5046. /* Contextual Menu Plugin Interface */
  5047. /* */
  5048. /* For Mac OS X 10.1, we support a new type of Contextual Menu Plugin: the CFPlugIn */
  5049. /* based plugin. Each plugin must be in a CFPlugIn in the Contextual Menu Items */
  5050. /* folder in one of these paths: */
  5051. /* /System/Library/Contextual Menu Items/ */
  5052. /* /Library/Contextual Menu Items/ */
  5053. /* ~/Library/Contextual Menu Items/ */
  5054. /* */
  5055. /* It must export the following functions using the following interface or a C++ */
  5056. /* interface inheriting from IUnknown and including similar functions. */
  5057. /*--------------------------------------------------------------------------------------*/
  5058. /* The Contextual Menu Manager will only load CFPlugIns of type kContextualMenuTypeID */
  5059. #define kContextualMenuTypeID ( CFUUIDGetConstantUUIDWithBytes( NULL, \
  5060. 0x2F, 0x65, 0x22, 0xE9, 0x3E, 0x66, 0x11, 0xD5, \
  5061. 0x80, 0xA7, 0x00, 0x30, 0x65, 0xB3, 0x00, 0xBC ) )
  5062. /* 2F6522E9-3E66-11D5-80A7-003065B300BC */
  5063. /* Contextual Menu Plugins must implement this Contexual Menu Plugin Interface */
  5064. #define kContextualMenuInterfaceID ( CFUUIDGetConstantUUIDWithBytes( NULL, \
  5065. 0x32, 0x99, 0x7B, 0x62, 0x3E, 0x66, 0x11, 0xD5, \
  5066. 0xBE, 0xAB, 0x00, 0x30, 0x65, 0xB3, 0x00, 0xBC ) )
  5067. /* 32997B62-3E66-11D5-BEAB-003065B300BC */
  5068. #define CM_IUNKNOWN_C_GUTS \
  5069. void *_reserved; \
  5070. SInt32 (*QueryInterface)(void *thisPointer, CFUUIDBytes iid, void ** ppv); \
  5071. UInt32 (*AddRef)(void *thisPointer); \
  5072. UInt32 (*Release)(void *thisPointer)
  5073. /* The function table for the interface */
  5074. struct ContextualMenuInterfaceStruct
  5075. {
  5076. CM_IUNKNOWN_C_GUTS;
  5077. OSStatus ( *ExamineContext )(
  5078. void* thisInstance,
  5079. const AEDesc* inContext,
  5080. AEDescList* outCommandPairs );
  5081. OSStatus ( *HandleSelection )(
  5082. void* thisInstance,
  5083. AEDesc* inContext,
  5084. SInt32 inCommandID );
  5085. void ( *PostMenuCleanup )(
  5086. void* thisInstance );
  5087. };
  5088. typedef struct ContextualMenuInterfaceStruct ContextualMenuInterfaceStruct;
  5089. /*
  5090. * CMPluginExamineContext()
  5091. *
  5092. * Availability:
  5093. * Implemented by client
  5094. */
  5095. EXTERN_API_C( OSStatus )
  5096. CMPluginExamineContext(
  5097. void * thisInstance,
  5098. const AEDesc * inContext,
  5099. AEDescList * outCommandPairs);
  5100. /*
  5101. * CMPluginHandleSelection()
  5102. *
  5103. * Availability:
  5104. * Implemented by client
  5105. */
  5106. EXTERN_API_C( OSStatus )
  5107. CMPluginHandleSelection(
  5108. void * thisInstance,
  5109. AEDesc * inContext,
  5110. SInt32 inCommandID);
  5111. /*
  5112. * CMPluginPostMenuCleanup()
  5113. *
  5114. * Availability:
  5115. * Implemented by client
  5116. */
  5117. EXTERN_API_C( void )
  5118. CMPluginPostMenuCleanup(void * thisInstance);
  5119. /* previously in LowMem.h. This functions return the menu ID of the hilited menu */
  5120. /*
  5121. * LMGetTheMenu()
  5122. *
  5123. * Availability:
  5124. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  5125. * CarbonLib: in CarbonLib 1.0 and later
  5126. * Mac OS X: in version 10.0 and later
  5127. */
  5128. EXTERN_API( SInt16 )
  5129. LMGetTheMenu(void) TWOWORDINLINE(0x3EB8, 0x0A26);
  5130. #if CALL_NOT_IN_CARBON
  5131. /*
  5132. * newmenu()
  5133. *
  5134. * Availability:
  5135. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  5136. * CarbonLib: not available
  5137. * Mac OS X: not available
  5138. */
  5139. EXTERN_API_C( MenuRef )
  5140. newmenu(
  5141. MenuID menuID,
  5142. const char * menuTitle);
  5143. /*
  5144. * appendmenu()
  5145. *
  5146. * Availability:
  5147. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  5148. * CarbonLib: not available
  5149. * Mac OS X: not available
  5150. */
  5151. EXTERN_API_C( void )
  5152. appendmenu(
  5153. MenuRef menu,
  5154. const char * data);
  5155. /*
  5156. * insertmenuitem()
  5157. *
  5158. * Availability:
  5159. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  5160. * CarbonLib: not available
  5161. * Mac OS X: not available
  5162. */
  5163. EXTERN_API_C( void )
  5164. insertmenuitem(
  5165. MenuRef theMenu,
  5166. const char * itemString,
  5167. short afterItem);
  5168. /*
  5169. * menuselect()
  5170. *
  5171. * Availability:
  5172. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  5173. * CarbonLib: not available
  5174. * Mac OS X: not available
  5175. */
  5176. EXTERN_API_C( long )
  5177. menuselect(const Point * startPt);
  5178. /*
  5179. * setmenuitemtext()
  5180. *
  5181. * Availability:
  5182. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  5183. * CarbonLib: not available
  5184. * Mac OS X: not available
  5185. */
  5186. EXTERN_API_C( void )
  5187. setmenuitemtext(
  5188. MenuRef menu,
  5189. short item,
  5190. const char * itemString);
  5191. /*
  5192. * getmenuitemtext()
  5193. *
  5194. * Availability:
  5195. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  5196. * CarbonLib: not available
  5197. * Mac OS X: not available
  5198. */
  5199. EXTERN_API_C( void )
  5200. getmenuitemtext(
  5201. MenuRef menu,
  5202. short item,
  5203. char * itemString);
  5204. #endif /* CALL_NOT_IN_CARBON */
  5205. #if OLDROUTINENAMES
  5206. #define AddResMenu(theMenu, theType) AppendResMenu(theMenu, theType)
  5207. #define InsMenuItem(theMenu, itemString, afterItem) InsertMenuItem(theMenu, itemString, afterItem)
  5208. #define DelMenuItem( theMenu, item ) DeleteMenuItem( theMenu, item )
  5209. #if TARGET_OS_MAC
  5210. #define SetItem MacSetItem
  5211. #define GetItem MacGetItem
  5212. #endif
  5213. #define MacSetItem(theMenu, item, itemString) SetMenuItemText(theMenu, item, itemString)
  5214. #define MacGetItem(theMenu, item, itemString) GetMenuItemText(theMenu, item, itemString)
  5215. #define GetMHandle(menuID) GetMenuHandle(menuID)
  5216. #define DelMCEntries(menuID, menuItem) DeleteMCEntries(menuID, menuItem)
  5217. #define DispMCInfo(menuCTbl) DisposeMCInfo(menuCTbl)
  5218. #if CALL_NOT_IN_CARBON
  5219. #define addresmenu(menu, data) appendresmenu(menu, data)
  5220. #define getitem(menu, item, itemString) getmenuitemtext(menu, item, itemString)
  5221. #define setitem(menu, item, itemString) setmenuitemtext(menu, item, itemString)
  5222. #define insmenuitem(theMenu, itemString, afterItem) insertmenuitem(theMenu, itemString, afterItem)
  5223. #endif
  5224. #endif /* OLDROUTINENAMES */
  5225. #if ACCESSOR_CALLS_ARE_FUNCTIONS
  5226. /* Getters */
  5227. /*
  5228. * GetMenuID()
  5229. *
  5230. * Availability:
  5231. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5232. * CarbonLib: in CarbonLib 1.0 and later
  5233. * Mac OS X: in version 10.0 and later
  5234. */
  5235. EXTERN_API( MenuID )
  5236. GetMenuID(MenuRef menu);
  5237. /*
  5238. * GetMenuWidth()
  5239. *
  5240. * Availability:
  5241. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5242. * CarbonLib: in CarbonLib 1.0 and later
  5243. * Mac OS X: in version 10.0 and later
  5244. */
  5245. EXTERN_API( SInt16 )
  5246. GetMenuWidth(MenuRef menu);
  5247. /*
  5248. * GetMenuHeight()
  5249. *
  5250. * Availability:
  5251. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5252. * CarbonLib: in CarbonLib 1.0 and later
  5253. * Mac OS X: in version 10.0 and later
  5254. */
  5255. EXTERN_API( SInt16 )
  5256. GetMenuHeight(MenuRef menu);
  5257. /*
  5258. * GetMenuTitle()
  5259. *
  5260. * Availability:
  5261. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5262. * CarbonLib: in CarbonLib 1.0 and later
  5263. * Mac OS X: in version 10.0 and later
  5264. */
  5265. EXTERN_API( StringPtr )
  5266. GetMenuTitle(
  5267. MenuRef menu,
  5268. Str255 title);
  5269. /*
  5270. * GetMenuDefinition()
  5271. *
  5272. * Availability:
  5273. * Non-Carbon CFM: not available
  5274. * CarbonLib: in CarbonLib 1.0 and later
  5275. * Mac OS X: in version 10.0 and later
  5276. */
  5277. EXTERN_API( OSStatus )
  5278. GetMenuDefinition(
  5279. MenuRef menu,
  5280. MenuDefSpecPtr outDefSpec);
  5281. /* Setters */
  5282. /*
  5283. * SetMenuID()
  5284. *
  5285. * Availability:
  5286. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5287. * CarbonLib: in CarbonLib 1.0 and later
  5288. * Mac OS X: in version 10.0 and later
  5289. */
  5290. EXTERN_API( void )
  5291. SetMenuID(
  5292. MenuRef menu,
  5293. MenuID menuID);
  5294. /*
  5295. * SetMenuWidth()
  5296. *
  5297. * Availability:
  5298. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5299. * CarbonLib: in CarbonLib 1.0 and later
  5300. * Mac OS X: in version 10.0 and later
  5301. */
  5302. EXTERN_API( void )
  5303. SetMenuWidth(
  5304. MenuRef menu,
  5305. SInt16 width);
  5306. /*
  5307. * SetMenuHeight()
  5308. *
  5309. * Availability:
  5310. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5311. * CarbonLib: in CarbonLib 1.0 and later
  5312. * Mac OS X: in version 10.0 and later
  5313. */
  5314. EXTERN_API( void )
  5315. SetMenuHeight(
  5316. MenuRef menu,
  5317. SInt16 height);
  5318. /*
  5319. * SetMenuTitle()
  5320. *
  5321. * Availability:
  5322. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5323. * CarbonLib: in CarbonLib 1.0 and later
  5324. * Mac OS X: in version 10.0 and later
  5325. */
  5326. EXTERN_API( OSStatus )
  5327. SetMenuTitle(
  5328. MenuRef menu,
  5329. ConstStr255Param title);
  5330. /*
  5331. * SetMenuDefinition()
  5332. *
  5333. * Availability:
  5334. * Non-Carbon CFM: not available
  5335. * CarbonLib: in CarbonLib 1.0 and later
  5336. * Mac OS X: in version 10.0 and later
  5337. */
  5338. EXTERN_API( OSStatus )
  5339. SetMenuDefinition(
  5340. MenuRef menu,
  5341. const MenuDefSpec * defSpec);
  5342. #endif /* ACCESSOR_CALLS_ARE_FUNCTIONS */
  5343. #if TARGET_OS_WIN32
  5344. #endif /* TARGET_OS_WIN32 */
  5345. #if PRAGMA_STRUCT_ALIGN
  5346. #pragma options align=reset
  5347. #elif PRAGMA_STRUCT_PACKPUSH
  5348. #pragma pack(pop)
  5349. #elif PRAGMA_STRUCT_PACK
  5350. #pragma pack()
  5351. #endif
  5352. #ifdef PRAGMA_IMPORT_OFF
  5353. #pragma import off
  5354. #elif PRAGMA_IMPORT
  5355. #pragma import reset
  5356. #endif
  5357. #ifdef __cplusplus
  5358. }
  5359. #endif
  5360. #endif /* __MENUS__ */