1 {
2 File: HIToolbox/Menus.h
3
4 Contains: Menu Manager Interfaces.
5
6 Version: HIToolbox-624~3
7
8 Copyright: � 1985-2008 by Apple Computer, Inc., all rights reserved.
9
10 Bugs?: For bug reports, consult the following page on
11 the World Wide Web:
12
13 http://bugs.freepascal.org
14
15 }
16 { Pascal Translation Updated: Peter N Lewis, <peter@stairways.com.au>, August 2005 }
17 { Pascal Translation Updated: Jonas Maebe, <jonas@freepascal.org>, October 2009 }
18 { Pascal Translation Updated: Jonas Maebe, <jonas@freepascal.org>, October 2012 }
19 {
20 Modified for use with Free Pascal
21 Version 308
22 Please report any bugs to <gpc@microbizz.nl>
23 }
24
25 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
26 {$mode macpas}
27 {$modeswitch cblocks}
28 {$packenum 1}
29 {$macro on}
30 {$inline on}
31 {$calling mwpascal}
32
33 unit Menus;
34 interface
35 {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
36 {$setc GAP_INTERFACES_VERSION := $0308}
37
38 {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
39 {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
40 {$endc}
41
42 {$ifc defined CPUPOWERPC and defined CPUI386}
43 {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
44 {$endc}
45 {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
46 {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
47 {$endc}
48
49 {$ifc not defined __ppc__ and defined CPUPOWERPC32}
50 {$setc __ppc__ := 1}
51 {$elsec}
52 {$setc __ppc__ := 0}
53 {$endc}
54 {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
55 {$setc __ppc64__ := 1}
56 {$elsec}
57 {$setc __ppc64__ := 0}
58 {$endc}
59 {$ifc not defined __i386__ and defined CPUI386}
60 {$setc __i386__ := 1}
61 {$elsec}
62 {$setc __i386__ := 0}
63 {$endc}
64 {$ifc not defined __x86_64__ and defined CPUX86_64}
65 {$setc __x86_64__ := 1}
66 {$elsec}
67 {$setc __x86_64__ := 0}
68 {$endc}
69 {$ifc not defined __arm__ and defined CPUARM}
70 {$setc __arm__ := 1}
71 {$elsec}
72 {$setc __arm__ := 0}
73 {$endc}
74 {$ifc not defined __arm64__ and defined CPUAARCH64}
75 {$setc __arm64__ := 1}
76 {$elsec}
77 {$setc __arm64__ := 0}
78 {$endc}
79
80 {$ifc defined cpu64}
81 {$setc __LP64__ := 1}
82 {$elsec}
83 {$setc __LP64__ := 0}
84 {$endc}
85
86
87 {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
88 {$error Conflicting definitions for __ppc__ and __i386__}
89 {$endc}
90
91 {$ifc defined __ppc__ and __ppc__}
92 {$setc TARGET_CPU_PPC := TRUE}
93 {$setc TARGET_CPU_PPC64 := FALSE}
94 {$setc TARGET_CPU_X86 := FALSE}
95 {$setc TARGET_CPU_X86_64 := FALSE}
96 {$setc TARGET_CPU_ARM := FALSE}
97 {$setc TARGET_CPU_ARM64 := FALSE}
98 {$setc TARGET_OS_MAC := TRUE}
99 {$setc TARGET_OS_IPHONE := FALSE}
100 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
101 {$setc TARGET_OS_EMBEDDED := FALSE}
102 {$elifc defined __ppc64__ and __ppc64__}
103 {$setc TARGET_CPU_PPC := FALSE}
104 {$setc TARGET_CPU_PPC64 := TRUE}
105 {$setc TARGET_CPU_X86 := FALSE}
106 {$setc TARGET_CPU_X86_64 := FALSE}
107 {$setc TARGET_CPU_ARM := FALSE}
108 {$setc TARGET_CPU_ARM64 := FALSE}
109 {$setc TARGET_OS_MAC := TRUE}
110 {$setc TARGET_OS_IPHONE := FALSE}
111 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
112 {$setc TARGET_OS_EMBEDDED := FALSE}
113 {$elifc defined __i386__ and __i386__}
114 {$setc TARGET_CPU_PPC := FALSE}
115 {$setc TARGET_CPU_PPC64 := FALSE}
116 {$setc TARGET_CPU_X86 := TRUE}
117 {$setc TARGET_CPU_X86_64 := FALSE}
118 {$setc TARGET_CPU_ARM := FALSE}
119 {$setc TARGET_CPU_ARM64 := FALSE}
120 {$ifc defined iphonesim}
121 {$setc TARGET_OS_MAC := FALSE}
122 {$setc TARGET_OS_IPHONE := TRUE}
123 {$setc TARGET_IPHONE_SIMULATOR := TRUE}
124 {$elsec}
125 {$setc TARGET_OS_MAC := TRUE}
126 {$setc TARGET_OS_IPHONE := FALSE}
127 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
128 {$endc}
129 {$setc TARGET_OS_EMBEDDED := FALSE}
130 {$elifc defined __x86_64__ and __x86_64__}
131 {$setc TARGET_CPU_PPC := FALSE}
132 {$setc TARGET_CPU_PPC64 := FALSE}
133 {$setc TARGET_CPU_X86 := FALSE}
134 {$setc TARGET_CPU_X86_64 := TRUE}
135 {$setc TARGET_CPU_ARM := FALSE}
136 {$setc TARGET_CPU_ARM64 := FALSE}
137 {$ifc defined iphonesim}
138 {$setc TARGET_OS_MAC := FALSE}
139 {$setc TARGET_OS_IPHONE := TRUE}
140 {$setc TARGET_IPHONE_SIMULATOR := TRUE}
141 {$elsec}
142 {$setc TARGET_OS_MAC := TRUE}
143 {$setc TARGET_OS_IPHONE := FALSE}
144 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
145 {$endc}
146 {$setc TARGET_OS_EMBEDDED := FALSE}
147 {$elifc defined __arm__ and __arm__}
148 {$setc TARGET_CPU_PPC := FALSE}
149 {$setc TARGET_CPU_PPC64 := FALSE}
150 {$setc TARGET_CPU_X86 := FALSE}
151 {$setc TARGET_CPU_X86_64 := FALSE}
152 {$setc TARGET_CPU_ARM := TRUE}
153 {$setc TARGET_CPU_ARM64 := FALSE}
154 {$setc TARGET_OS_MAC := FALSE}
155 {$setc TARGET_OS_IPHONE := TRUE}
156 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
157 {$setc TARGET_OS_EMBEDDED := TRUE}
158 {$elifc defined __arm64__ and __arm64__}
159 {$setc TARGET_CPU_PPC := FALSE}
160 {$setc TARGET_CPU_PPC64 := FALSE}
161 {$setc TARGET_CPU_X86 := FALSE}
162 {$setc TARGET_CPU_X86_64 := FALSE}
163 {$setc TARGET_CPU_ARM := FALSE}
164 {$setc TARGET_CPU_ARM64 := TRUE}
165 {$ifc defined ios}
166 {$setc TARGET_OS_MAC := FALSE}
167 {$setc TARGET_OS_IPHONE := TRUE}
168 {$setc TARGET_OS_EMBEDDED := TRUE}
169 {$elsec}
170 {$setc TARGET_OS_MAC := TRUE}
171 {$setc TARGET_OS_IPHONE := FALSE}
172 {$setc TARGET_OS_EMBEDDED := FALSE}
173 {$endc}
174 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
175 {$elsec}
176 {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
177 {$endc}
178
179 {$ifc defined __LP64__ and __LP64__ }
180 {$setc TARGET_CPU_64 := TRUE}
181 {$elsec}
182 {$setc TARGET_CPU_64 := FALSE}
183 {$endc}
184
185 {$ifc defined FPC_BIG_ENDIAN}
186 {$setc TARGET_RT_BIG_ENDIAN := TRUE}
187 {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
188 {$elifc defined FPC_LITTLE_ENDIAN}
189 {$setc TARGET_RT_BIG_ENDIAN := FALSE}
190 {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
191 {$elsec}
192 {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
193 {$endc}
194 {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
195 {$setc CALL_NOT_IN_CARBON := FALSE}
196 {$setc OLDROUTINENAMES := FALSE}
197 {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
198 {$setc OPAQUE_UPP_TYPES := TRUE}
199 {$setc OTCARBONAPPLICATION := TRUE}
200 {$setc OTKERNEL := FALSE}
201 {$setc PM_USE_SESSION_APIS := TRUE}
202 {$setc TARGET_API_MAC_CARBON := TRUE}
203 {$setc TARGET_API_MAC_OS8 := FALSE}
204 {$setc TARGET_API_MAC_OSX := TRUE}
205 {$setc TARGET_CARBON := TRUE}
206 {$setc TARGET_CPU_68K := FALSE}
207 {$setc TARGET_CPU_MIPS := FALSE}
208 {$setc TARGET_CPU_SPARC := FALSE}
209 {$setc TARGET_OS_UNIX := FALSE}
210 {$setc TARGET_OS_WIN32 := FALSE}
211 {$setc TARGET_RT_MAC_68881 := FALSE}
212 {$setc TARGET_RT_MAC_CFM := FALSE}
213 {$setc TARGET_RT_MAC_MACHO := TRUE}
214 {$setc TYPED_FUNCTION_POINTERS := TRUE}
215 {$setc TYPE_BOOL := FALSE}
216 {$setc TYPE_EXTENDED := FALSE}
217 {$setc TYPE_LONGLONG := TRUE}
218 uses MacTypes,AEDataModel,Appearance,CFBase,CFArray,CFAttributedString,CGContext,CTFont,ATSTypes,Events,QuickdrawTypes,TextCommon,Collections,CarbonEventsCore,HIObject;
219 {$endc} {not MACOSALLINCLUDE}
220
221
222 {$ifc TARGET_OS_MAC}
223
224 {$ALIGN MAC68K}
225
226
227 {
228 * Menu Manager
229 }
230 {��������������������������������������������������������������������������������������}
231 { � Menu Constants }
232 {��������������������������������������������������������������������������������������}
233
234 const
235 {
236 * Proc ID for a normal text menu. This constant is not typically
237 * used.
238 }
239 textMenuProc = 0;
240
241 {
242 * This value may be passed to InsertMenuItem, InsertMenuItemText,
243 * and InsertMenuItemTextWithCFString to indicate that the new item
244 * should be inserted at the end of the menu. Note that you can also
245 * just call AppendMenu[ItemText][WithCFString].
246 }
247 kHIMenuAppendItem = $0000FFFF;
248
249 const
250 noMark = 0; { mark symbol for SetItemMark; other mark symbols are defined in Fonts.h }
251
252 { Constants for use with MacOS 8.0 (Appearance 1.0) and later}
253 const
254 kMenuStdMenuProc = 63;
255 kMenuStdMenuBarProc = 63;
256
257 { For use with Get/SetMenuItemModifiers}
258 const
259 kMenuNoModifiers = 0; { Mask for no modifiers}
260 kMenuShiftModifier = 1 shl 0; { Mask for shift key modifier}
261 kMenuOptionModifier = 1 shl 1; { Mask for option key modifier}
262 kMenuControlModifier = 1 shl 2; { Mask for control key modifier}
263 kMenuNoCommandModifier = 1 shl 3; { Mask for no command key modifier}
264
265 { For use with Get/SetMenuItemIconHandle}
266 const
267 kMenuNoIcon = 0; { No icon}
268 kMenuIconType = 1; { Type for ICON}
269 kMenuShrinkIconType = 2; { Type for ICON plotted 16 x 16}
270 kMenuSmallIconType = 3; { Type for SICN}
271 kMenuColorIconType = 4; { Type for cicn}
272 kMenuIconSuiteType = 5; { Type for Icon Suite}
273 kMenuIconRefType = 6; { Type for Icon Ref}
274 kMenuCGImageRefType = 7; { Type for a CGImageRef (Mac OS X only)}
275 kMenuSystemIconSelectorType = 8; { Type for an OSType identifying an IconRef registered with Icon Services under kSystemIconsCreator (Mac OS X 10.1 and later only)}
276 kMenuIconResourceType = 9; { Type for a CFStringRef with the full name of a .icns resource in the main bundle of the process (Mac OS X 10.1 and later only)}
277
278 { For use with Get/SetMenuItemKeyGlyph}
279 const
280 kMenuNullGlyph = $00; { Null (always glyph 1)}
281 kMenuTabRightGlyph = $02; { Tab to the right key (for left-to-right script systems)}
282 kMenuTabLeftGlyph = $03; { Tab to the left key (for right-to-left script systems)}
283 kMenuEnterGlyph = $04; { Enter key}
284 kMenuShiftGlyph = $05; { Shift key}
285 kMenuControlGlyph = $06; { Control key}
286 kMenuOptionGlyph = $07; { Option key}
287 kMenuSpaceGlyph = $09; { Space (always glyph 3) key}
288 kMenuDeleteRightGlyph = $0A; { Delete to the right key (for right-to-left script systems)}
289 kMenuReturnGlyph = $0B; { Return key (for left-to-right script systems)}
290 kMenuReturnR2LGlyph = $0C; { Return key (for right-to-left script systems)}
291 kMenuNonmarkingReturnGlyph = $0D; { Nonmarking return key}
292 kMenuPencilGlyph = $0F; { Pencil key}
293 kMenuDownwardArrowDashedGlyph = $10; { Downward dashed arrow key}
294 kMenuCommandGlyph = $11; { Command key}
295 kMenuCheckmarkGlyph = $12; { Checkmark key}
296 kMenuDiamondGlyph = $13; { Diamond key}
297 kMenuAppleLogoFilledGlyph = $14; { Apple logo key (filled)}
298 kMenuParagraphKoreanGlyph = $15; { Unassigned (paragraph in Korean)}
299 kMenuDeleteLeftGlyph = $17; { Delete to the left key (for left-to-right script systems)}
300 kMenuLeftArrowDashedGlyph = $18; { Leftward dashed arrow key}
301 kMenuUpArrowDashedGlyph = $19; { Upward dashed arrow key}
302 kMenuRightArrowDashedGlyph = $1A; { Rightward dashed arrow key}
303 kMenuEscapeGlyph = $1B; { Escape key}
304 kMenuClearGlyph = $1C; { Clear key}
305 kMenuLeftDoubleQuotesJapaneseGlyph = $1D; { Unassigned (left double quotes in Japanese)}
306 kMenuRightDoubleQuotesJapaneseGlyph = $1E; { Unassigned (right double quotes in Japanese)}
307 kMenuTrademarkJapaneseGlyph = $1F; { Unassigned (trademark in Japanese)}
308 kMenuBlankGlyph = $61; { Blank key}
309 kMenuPageUpGlyph = $62; { Page up key}
310 kMenuCapsLockGlyph = $63; { Caps lock key}
311 kMenuLeftArrowGlyph = $64; { Left arrow key}
312 kMenuRightArrowGlyph = $65; { Right arrow key}
313 kMenuNorthwestArrowGlyph = $66; { Northwest arrow key}
314 kMenuHelpGlyph = $67; { Help key}
315 kMenuUpArrowGlyph = $68; { Up arrow key}
316 kMenuSoutheastArrowGlyph = $69; { Southeast arrow key}
317 kMenuDownArrowGlyph = $6A; { Down arrow key}
318 kMenuPageDownGlyph = $6B; { Page down key}
319 kMenuAppleLogoOutlineGlyph = $6C; { Apple logo key (outline)}
320 kMenuContextualMenuGlyph = $6D; { Contextual menu key}
321 kMenuPowerGlyph = $6E; { Power key}
322 kMenuF1Glyph = $6F; { F1 key}
323 kMenuF2Glyph = $70; { F2 key}
324 kMenuF3Glyph = $71; { F3 key}
325 kMenuF4Glyph = $72; { F4 key}
326 kMenuF5Glyph = $73; { F5 key}
327 kMenuF6Glyph = $74; { F6 key}
328 kMenuF7Glyph = $75; { F7 key}
329 kMenuF8Glyph = $76; { F8 key}
330 kMenuF9Glyph = $77; { F9 key}
331 kMenuF10Glyph = $78; { F10 key}
332 kMenuF11Glyph = $79; { F11 key}
333 kMenuF12Glyph = $7A; { F12 key}
334 kMenuF13Glyph = $87; { F13 key}
335 kMenuF14Glyph = $88; { F14 key}
336 kMenuF15Glyph = $89; { F15 key}
337 kMenuControlISOGlyph = $8A; { Control key (ISO standard)}
338 kMenuEjectGlyph = $8C; { Eject key (available on Mac OS X 10.2 and later)}
339 kMenuEisuGlyph = $8D; { Japanese eisu key (available in Mac OS X 10.4 and later)}
340 kMenuKanaGlyph = $8E; { Japanese kana key (available in Mac OS X 10.4 and later)}
341 kMenuF16Glyph = $8F; { F16 key (available in SnowLeopard and later)}
342 kMenuF17Glyph = $90; { F17 key (available in SnowLeopard and later)}
343 kMenuF18Glyph = $91; { F18 key (available in SnowLeopard and later)}
344 kMenuF19Glyph = $92; { F19 key (available in SnowLeopard and later)}
345
346
347 {
348 * MenuAttributes
349 *
350 * Summary:
351 * Menu attributes control behavior of the entire menu. They are
352 * used with the Get/ChangeMenuAttributes APIs.
353 }
354 type
355 MenuAttributes = UInt32;
356 const
357 {
358 * No column space is allocated for the mark character when this menu
359 * is drawn.
360 }
361 kMenuAttrExcludesMarkColumn = 1 shl 0;
362
363 {
364 * The menu title is automatically disabled when all items are
365 * disabled.
366 }
367 kMenuAttrAutoDisable = 1 shl 2;
368
369 {
370 * The pencil glyph from the Keyboard font (kMenuPencilGlyph) is used
371 * to draw the Control modifier key in menu keyboard equivalents.
372 * This appearance is typically used only by Japanese input method
373 * menus.
374 }
375 kMenuAttrUsePencilGlyph = 1 shl 3;
376
377 {
378 * The menu title is not drawn in the menubar, even when the menu is
379 * inserted in the menubar. Useful for adding command keys that don't
380 * correspond to a visible menu item; menu items with the desired
381 * command keys can be added to the menu and inserted in the menubar
382 * without making the menu visible. This attribute is available in
383 * Mac OS X 10.2 and later.
384 }
385 kMenuAttrHidden = 1 shl 4;
386
387 {
388 * If menu item separators are present at the beginning or end of the
389 * menu, or if multiple contiguous separators are present, the extra
390 * separator items are marked as hidden to avoid extra blank space in
391 * the menu. The menu is examined for extra separators whenever the
392 * menu size is recalculated. This attribute is available in Mac OS X
393 * 10.3 and later.
394 }
395 kMenuAttrCondenseSeparators = 1 shl 5;
396
397 {
398 * Disables automatic caching of the menu image by the Menu Manager.
399 * Automatic caching is provided for all menus that use an HIView to
400 * draw their content. Setting this attribute will prevent the Menu
401 * Manager from caching the menu image; instead, the menu will be
402 * drawn using the standard HIView drawing mechanism each time that
403 * it is displayed. This attribute is available in Mac OS X 10.3 and
404 * later.
405 }
406 kMenuAttrDoNotCacheImage = 1 shl 6;
407
408 {
409 * Disables substitution of command keys from the
410 * NSUserKeyEquivalents dictionary. By default, all menu items are
411 * checked for a match in the dictionary. Note that this attribute,
412 * to be effective, should be added at the time that the menu is
413 * created; once the menu has been searched for user command keys
414 * (which occurs in CalcMenuSize, in GetItemCmd and
415 * GetMenuItemCommandKey, and before command key matching), the
416 * original command keys are replaced by the user command keys and
417 * cannot be retrieved. For this reason, it is also not useful to
418 * clear this attribute; the original command keys cannot be
419 * restored. This attribute is available in Mac OS X 10.3 and later.
420 }
421 kMenuAttrDoNotUseUserCommandKeys = 1 shl 7;
422
423
424 {
425 * MenuItemAttributes
426 *
427 * Summary:
428 * Menu item attributes control behavior of individual menu items.
429 * They are used with the Get/ChangeMenuItemAttributes APIs.
430 }
431 type
432 MenuItemAttributes = UInt32;
433 const
434 {
435 * This item is disabled.
436 }
437 kMenuItemAttrDisabled = 1 shl 0;
438
439 {
440 * This item's icon is disabled.
441 }
442 kMenuItemAttrIconDisabled = 1 shl 1;
443
444 {
445 * Allows the parent item of a submenu to be selectable.
446 }
447 kMenuItemAttrSubmenuParentChoosable = 1 shl 2;
448
449 {
450 * This item changes dynamically based on modifier key state.
451 }
452 kMenuItemAttrDynamic = 1 shl 3;
453
454 {
455 * This item is not part of the same dynamic group as the previous
456 * item.
457 }
458 kMenuItemAttrNotPreviousAlternate = 1 shl 4;
459
460 {
461 * This item is not drawn when the menu is displayed. It is also not
462 * included in command key matching, unless the item also has either
463 * the Dynamic or IncludeInCmdKeyMatching attributes.
464 }
465 kMenuItemAttrHidden = 1 shl 5;
466
467 {
468 * This item is a separator; the text of the item is ignored.
469 }
470 kMenuItemAttrSeparator = 1 shl 6;
471
472 {
473 * This item is a menu section header; it is disabled and
474 * unselectable.
475 }
476 kMenuItemAttrSectionHeader = 1 shl 7;
477
478 {
479 * Metacharacters in the text of this item (such as the dash) are
480 * ignored.
481 }
482 kMenuItemAttrIgnoreMeta = 1 shl 8;
483
484 {
485 * This item is recognized by IsMenuKeyEvent when it is passed an
486 * auto-repeat keyboard event.
487 }
488 kMenuItemAttrAutoRepeat = 1 shl 9;
489
490 {
491 * When MenuEvent and IsMenuKeyEvent compare this item's keyboard
492 * equivalent against a keyboard event, they use the item's virtual
493 * keycode equivalent rather than its character code equivalent.
494 }
495 kMenuItemAttrUseVirtualKey = 1 shl 10;
496
497 {
498 * This item is drawn in a customized fashion by the application.
499 * Causes custom menu item drawing Carbon events to be sent. This
500 * attribute is available in CarbonLib 1.4 and Mac OS X 10.1, and
501 * later.
502 }
503 kMenuItemAttrCustomDraw = 1 shl 11;
504
505 {
506 * This item is examined during command key matching by MenuKey,
507 * MenuEvent, and IsMenuKeyEvent. Normally, visible menu items are
508 * included in command key matching, but hidden menu items are
509 * excluded (unless the item also has the Dynamic menu item
510 * attribute). The IncludeInCmdKeyMatching attribute can be used to
511 * force a hidden, non-dynamic menu item to be included in command
512 * key matching when it normally wouldn't. This attribute is
513 * available in CarbonLib 1.6 and Mac OS X 10.2 and later.
514 }
515 kMenuItemAttrIncludeInCmdKeyMatching = 1 shl 12;
516
517 {
518 * This item is automatically disabled if, when
519 * kEventCommandUpdateStatus is sent for this item, no handler is
520 * installed or all handlers return eventNotHandledErr. A return
521 * value from any handler of any value other than eventNotHandledErr
522 * will prevent automatic disabling. This attribute is useful for
523 * applications that use kEventCommandUpdateStatus events for all
524 * menu item enabling; previously, an application would need to
525 * install UpdateStatus handlers on its application target to disable
526 * all items in the application that were unnecessary when no
527 * document windows were open. By setting this attribute, all menu
528 * items will be disabled automatically unless specifically enabled
529 * by an UpdateStatus handler on a window, control, or application
530 * target. This attribute is available in Mac OS X 10.3 and later.
531 }
532 kMenuItemAttrAutoDisable = 1 shl 13;
533
534 {
535 * During command key matching, the Menu Manager uses a cache of the
536 * available command keys to locate the menu item that matches an
537 * event. Before returning this item, the Menu Manager sends a
538 * kEventMenuEnableItems event to the menu containing the item, and a
539 * kEventCommandUpdateStatus event to each item in the menu, so that
540 * the item can be properly enabled or disabled. For some
541 * applications, updating the item status for each item in the menu
542 * is quite expensive, and also unnecessary since only a single item
543 * actually needs to be updated. Setting this attribute indicates to
544 * the Menu Manager that it only needs to send a
545 * kEventCommandUpdateStatus event to this menu item before returning
546 * it from command key matching; kEventMenuEnableItems will not be
547 * sent to the menu, and no other menu item will receive
548 * kEventCommandUpdateStatus. This attribute is available in Mac OS X
549 * 10.3 and later.
550 }
551 kMenuItemAttrUpdateSingleItem = 1 shl 14;
552
553
554 {
555 * MenuTrackingMode
556 *
557 * Summary:
558 * A menu tracking mode constant is part of the
559 * kEventMenuBeginTracking and kEventMenuChangeTrackingMode Carbon
560 * events. It indicates whether menus are being tracked using the
561 * mouse or keyboard.
562 }
563 type
564 MenuTrackingMode = UInt32;
565 const
566 {
567 * Menus are being tracked using the mouse.
568 }
569 kMenuTrackingModeMouse = 1;
570
571 {
572 * Menus are being tracked using the keyboard.
573 }
574 kMenuTrackingModeKeyboard = 2;
575
576
577 {
578 * MenuEventOptions
579 *
580 * Summary:
581 * Menu event options control how the menus are searched for an item
582 * matching a particular keyboard event. They are used with the
583 * IsMenuKeyEvent API.
584 }
585 type
586 MenuEventOptions = UInt32;
587 const
588 {
589 * Disabled items are examined for a match.
590 }
591 kMenuEventIncludeDisabledItems = $0001;
592
593 {
594 * Don't hilite the menu title if a match is found.
595 }
596 kMenuEventQueryOnly = $0002;
597
598 {
599 * Don't look for a match in submenus of the starting menu.
600 }
601 kMenuEventDontCheckSubmenus = $0004;
602
603 {��������������������������������������������������������������������������������������}
604 { � Menu Types }
605 {��������������������������������������������������������������������������������������}
606 type
607 MenuID = SInt16;
608 MenuItemIndex = UInt16;
609 MenuItemIndex_fix = MenuItemIndex; { used as field type when a record declaration contains a MenuItemIndex field identifier }
610 MenuItemIndexPtr = ^MenuItemIndex;
611 MenuCommand = UInt32;
612 type
613 MenuRef = ^OpaqueMenuRef; { an opaque type }
614 OpaqueMenuRef = record end;
615 MenuRef_fix = MenuRef; { used as field type when a record declaration contains a MenuRef field identifier }
616 MenuRefPtr = ^MenuRef;
617 { MenuHandle is old name for MenuRef}
618 type
619 MenuHandle = MenuRef;
620
621 {
622 A MenuBarHandle is a handle to a MenuBarHeader. An instance of this structure is returned
623 by the GetMenuBar and GetNewMBar APIs. It is typedef'd to a plain Handle to retain
624 source compatibility with previous versions of this header file.
625 }
626 type
627 MenuBarHandle = Handle;
628
629 {
630 * MenuBarHeader
631 *
632 * Summary:
633 * This structure is contained in a MenuBarHandle. It contains a
634 * list of the non-hierarchical menus that have been inserted into
635 * the menubar.
636 *
637 * Discussion:
638 * The MenuBarHandle is a dynamically sized object which cannot be
639 * directly expressed as a C or Pascal structure. First is the
640 * MenuBarHeader structure, followed by a dynamically sized array of
641 * MenuBarMenus, one for each menu. This array is followed by the
642 * HMenuBarHeader, followed by another dynamically sized array of
643 * HMenuBarMenus, one for each hierarchical menu.
644 }
645 type
646 MenuBarHeaderPtr = ^MenuBarHeader;
647 MenuBarHeader = record
648 {
649 * Offset in bytes from the start of the header to the last menu in
650 * the array of MenuBarMenus.
651 }
652 lastMenu: UInt16;
653
654 {
655 * Global coordinate of the right edge of the rightmost menu; unused
656 * in a MenuBarHandle returned by GetMenuBar or GetNewMBar.
657 }
658 lastRight: SInt16;
659
660 {
661 * The MBDF resource ID; unused in a MenuBarHandle returned by
662 * GetMenuBar or GetNewMBar.
663 }
664 mbResID: SInt16;
665 end;
666
667 {
668 * HMenuBarHeader
669 *
670 * Summary:
671 * This structure is contained in a MenuBarHandle. It contains a
672 * list of the hierarchical menus that have been inserted into the
673 * menubar with InsertMenu( menu, -1 ).
674 *
675 * Discussion:
676 * The hierarchical portion of the menubar follows the
677 * non-hierarchical portion in a menubar handle. The hierarchical
678 * portion begins with the HMenuBarHeader structure, followed by a
679 * dynamically sized array of HMenuBarMenus.
680 }
681 type
682 HMenuBarHeaderPtr = ^HMenuBarHeader;
683 HMenuBarHeader = record
684 {
685 * Offset in bytes from the start of the header to the last menu in
686 * the array of HMenuBarMenus.
687 }
688 lastHMenu: UInt16;
689
690 {
691 * Saved bits behind the hilited menu title; unused in a
692 * MenuBarHandle returned by GetMenuBar or GetNewMBar.
693 }
694 menuTitleBits: PixMapHandle;
695 end;
696
697 {
698 * MenuBarMenu
699 *
700 * Summary:
701 * This structure contains a single menu in the menubar. It is an
702 * element in an array in the MenuBarHeader data strucuture.
703 }
704 type
705 MenuBarMenuPtr = ^MenuBarMenu;
706 MenuBarMenu = record
707 {
708 * A menu in the menubar.
709 }
710 menu: MenuRef;
711
712 {
713 * The global coordinate of the left edge of the menu title; unused
714 * in a MenuBarHandle returned by GetMenuBar or GetNewMBar.
715 }
716 menuLeft: SInt16;
717 end;
718
719 {
720 * HMenuBarMenu
721 *
722 * Summary:
723 * This structure contains a single hierarchical menu in the
724 * menubar. It is an element in an array in the HMenuBarHeader data
725 * strucuture.
726 }
727 type
728 HMenuBarMenuPtr = ^HMenuBarMenu;
729 HMenuBarMenu = record
730 {
731 * An hierarchical menu in the menubar.
732 }
733 menu: MenuRef;
734
735 {
736 * This field is currently unused.
737 }
738 reserved: SInt16;
739 end;
740 {
741 * MenuTrackingData
742 *
743 * Summary:
744 * The MenuTrackingData structure contains information about a menu
745 * currently being displayed. It is used with the
746 * GetMenuTrackingData API.
747 }
748 type
749 MenuTrackingData = record
750 menu: MenuRef;
751 itemSelected: MenuItemIndex;
752 itemUnderMouse: MenuItemIndex;
753 itemRect: Rect;
754 virtualMenuTop: SInt32;
755 virtualMenuBottom: SInt32;
756 end;
757 MenuTrackingDataPtr = ^MenuTrackingData;
758
759 {
760 * Summary:
761 * A MenuItemDataFlags value indicates which fields of a
762 * MenuItemDataRec structure should be used by the
763 * Copy/SetMenuItemData APIs. All MenuItemDataFlags may be used when
764 * getting or setting the contents of a menu item; some may also be
765 * used when getting or setting information about the menu itself,
766 * if the item index given to Copy/SetMenuItemData is 0.
767 }
768 const
769 {
770 * Set or return the Str255 text of a menu using the
771 * MenuItemDataRec.text field. If getting the text, the text field
772 * must be initialized with a pointer to a Str255 variable before
773 * calling CopyMenuItemData. If both kMenuItemDataText and
774 * kMenuItemCFString are set on entry to CopyMenuItemData, the API
775 * will determine whether the menu text was most recently set using a
776 * Str255 or CFString, and return only that text format; the flags
777 * value for the other format will be cleared. Valid for both menu
778 * items and the menu title (if item number is 0).
779 *
780 * Note that this option is not supported in the 64-bit HIToolbox API.
781 }
782 kMenuItemDataText = 1 shl 0;
783
784 {
785 * Set or return the mark character of a menu item using the
786 * MenuItemDataRec.mark field. Valid only for menu items.
787 }
788 kMenuItemDataMark = 1 shl 1;
789
790 {
791 * Set or return the command key of a menu item using the
792 * MenuItemDataRec.cmdKey field. Valid only for menu items.
793 }
794 kMenuItemDataCmdKey = 1 shl 2;
795
796 {
797 * Set or return the command key glyph of a menu item using the
798 * MenuItemDataRec.cmdKeyGlyph field. Valid only for menu items.
799 }
800 kMenuItemDataCmdKeyGlyph = 1 shl 3;
801
802 {
803 * Set or return the command key modifiers of a menu item using the
804 * MenuItemDataRec.cmdKeyModifiers field. Valid only for menu items.
805 }
806 kMenuItemDataCmdKeyModifiers = 1 shl 4;
807
808 {
809 * Set or return the QuickDraw text style of a menu item using the
810 * MenuItemDataRec.style field. Valid only for menu items.
811 }
812 kMenuItemDataStyle = 1 shl 5;
813
814 {
815 * Set or return the enable state of a menu using the
816 * MenuItemDataRec.enabled field. Valid for both menu items and the
817 * menu itself (if item number is 0).
818 }
819 kMenuItemDataEnabled = 1 shl 6;
820
821 {
822 * Set or return the enable state of a menu item icon using the
823 * MenuItemDataRec.iconEnabled field. Valid only for menu items.
824 }
825 kMenuItemDataIconEnabled = 1 shl 7;
826
827 {
828 * Set or return the icon resource ID of a menu item using the
829 * MenuItemDataRec.iconID field. Valid only for menu items.
830 *
831 * Note that this option is not supported in the 64-bit HIToolbox API.
832 }
833 kMenuItemDataIconID = 1 shl 8;
834
835 {
836 * Set or return the icon handle of a menu item using the
837 * MenuItemDataRec.iconType and MenuItemDataRec.iconHandle fields.
838 * Both fields must be initialized if setting the icon handle; both
839 * fields will be returned when getting the handle. The iconType
840 * field should contain one of the constants kMenuIconType,
841 * kMenuShrinkIconType, kMenuSmallIconType, kMenuColorIconType,
842 * kMenuIconSuiteType, kMenuIconRefType, kMenuCGImageRefType,
843 * kMenuSystemIconSelectorType, or kMenuIconResourceType. An icon
844 * handle may be a handle to an ICON resource, a SICN resource, a
845 * cicn resource, an IconSuite, an IconRef, a CGImageRef, an OSType,
846 * or a CFStringRef. Valid only for menu items. When used with
847 * CopyMenuItemData, the caller does not need to release the returned
848 * icon handle.
849 }
850 kMenuItemDataIconHandle = 1 shl 9;
851
852 {
853 * Set or return the command ID of a menu item using the
854 * MenuItemDataRec.cmdID field. Valid only for menu items.
855 }
856 kMenuItemDataCommandID = 1 shl 10;
857
858 {
859 * Set or return the text encoding of a menu item using the
860 * MenuItemDataRec.encoding field. Valid only for menu items.
861 *
862 *
863 * Note that this option is not supported in the 64-bit HIToolbox API.
864 }
865 kMenuItemDataTextEncoding = 1 shl 11;
866
867 {
868 * Set or return the menu ID of a item's submenu using the
869 * MenuItemDataRec.submenuID field. Valid only for menu items.
870 }
871 kMenuItemDataSubmenuID = 1 shl 12;
872
873 {
874 * Set or return the menu handle of an item's submenu using the
875 * MenuItemDataRec.submenuHandle field. Valid only for menu items.
876 * When used with CopyMenuItemData, the caller does not need to
877 * release the returned MenuRef.
878 }
879 kMenuItemDataSubmenuHandle = 1 shl 13;
880
881 {
882 * Set or return the QuickDraw font ID of a menu item using the
883 * MenuItemDataRec.fontID field. Valid only for menu items.
884 }
885 kMenuItemDataFontID = 1 shl 14;
886
887 {
888 * Set or return the refcon of a menu using the
889 * MenuItemDataRec.refcon field. Valid for both menu items and the
890 * menu itself (if item number is 0).
891 }
892 kMenuItemDataRefcon = 1 shl 15;
893
894 {
895 * Set or return the attributes of a menu using the
896 * MenuItemDataRec.attr field. Valid for both menu items, in which
897 * case the attr field should contain values from the
898 * MenuItemAttributes enumeration, and for the menu itself (if item
899 * number is 0), in which case the attr field should contain values
900 * from the MenuAttributes enumeration.
901 }
902 kMenuItemDataAttributes = 1 shl 16;
903
904 {
905 * Set or return the CFString text of a menu using the
906 * MenuItemDataRec.cfText field. If setting the CFString text, the
907 * Menu Manager increments the refcount of the text; the caller may
908 * safely release the text after setting it. If getting the CFString
909 * text, the caller receives a copy of the text owned by the Menu
910 * Manager; modifications on the text by the caller will have no
911 * effect on the text of the menu, and the caller should release the
912 * text when finished with it. If both kMenuItemDataText and
913 * kMenuItemCFString are set on entry to CopyMenuItemData, the API
914 * will determine whether the menu text was most recently set using a
915 * Str255 or CFString, and return only that text format; the flags
916 * value for the other format will be cleared. Valid for both menu
917 * items and the menu title (if item number is 0). When used with
918 * CopyMenuItemData, the caller must release the returned CFStringRef.
919 }
920 kMenuItemDataCFString = 1 shl 17;
921
922 {
923 * Set or return the properties of a menu using the
924 * MenuItemDataRec.properties field. If setting the properties, the
925 * properties field should contain a collection with the new
926 * properties; existing menu properties with the same collection
927 * creator and tag will be replaced by the new properties. If getting
928 * the properties, the properties field should either be set to NULL
929 * or to a valid Collection. If NULL, a new collection is allocated
930 * by the CopyMenuItemData and returned in the properties field. If
931 * not NULL, the entire contents of the collection are replaced by
932 * the properties of the menu. Valid for both menu items and the menu
933 * itself (if item number is 0).
934 }
935 kMenuItemDataProperties = 1 shl 18;
936
937 {
938 * Set or return the item indent level of a menu item using the
939 * MenuItemDataRec.indent field. Valid only for menu items.
940 }
941 kMenuItemDataIndent = 1 shl 19;
942
943 {
944 * Set or return the virtual key code keyboard equivalent of a menu
945 * item using the MenuItemDataRec.cmdVirtualKey field. Valid only for
946 * menu items. On output, only valid if the item has the
947 * kMenuItemAttrUseVirtualKeyCode attribute. Available in Mac OS X
948 * and CarbonLib 1.1 and later.
949 }
950 kMenuItemDataCmdVirtualKey = 1 shl 20;
951
952 {
953 * Set or return the attributed text of a menu item using the
954 * MenuItemDataRec.attributedText field. If setting the attributed
955 * text, the Menu Manager increments the refcount of the text; the
956 * caller may safely release the text after setting it. If getting
957 * the attributed text, the caller receives a copy of the text owned
958 * by the Menu Manager; modifications on the text by the caller will
959 * have no effect on the text of the menu, and the caller should
960 * release the text when finished with it. Valid only for menu items.
961 * Available in Mac OS X 10.5 and later.
962 }
963 kMenuItemDataAttributedText = 1 shl 21;
964
965 {
966 * Set or return the CTFontRef of a menu using the
967 * MenuItemDataRec.font field. If setting the font, the Menu Manager
968 * increments the refcount of the font; the caller may safely release
969 * the font after setting it. If getting the font, the caller
970 * receives a retained instance of the font owned by the Menu
971 * Manager; the caller should release the font when finished with it.
972 * Valid for both menu items and the menu title (if item number is
973 * 0). Available in Mac OS X 10.5 and later.
974 }
975 kMenuItemDataFont = 1 shl 22;
976 kMenuItemDataAllDataVersionOne = $000FFFFF;
977 kMenuItemDataAllDataVersionTwo = kMenuItemDataAllDataVersionOne or kMenuItemDataCmdVirtualKey;
978 kMenuItemDataAllDataVersionThree = kMenuItemDataAllDataVersionTwo or kMenuItemDataAttributedText or kMenuItemDataFont;
979
980 type
981 MenuItemDataFlags = UInt64;
982
983 {
984 * MenuItemDataRec
985 *
986 * Summary:
987 * The MenuItemDataRec structure is used to get and change aspects
988 * of a menu item. It is used with the Copy/SetMenuItemData APIs.
989 *
990 * Discussion:
991 * When using this structure with Copy/SetMenuItemData, the caller
992 * must first set the whichData field to a combination of
993 * MenuItemDataFlags indicating which specific data should be
994 * retrieved or set. Some fields also require initialization before
995 * calling CopyMenuItemData; see the individual MenuItemDataFlags
996 * documentation for details. When used with CopyMenuItemData, the
997 * whichData field will be updated on exit to indicate which data
998 * fields have actually been returned. If the caller requests data
999 * that does not exist for that menu or menu item, the corresponding
1000 * bit in the whichData field will be cleared, and the field in the
1001 * MenuItemDataRec for that data will be set to zero.
1002 }
1003 type
1004 MenuItemDataRecPtr = ^MenuItemDataRec;
1005 MenuItemDataRec = record
1006 whichData: MenuItemDataFlags;
1007 text: StringPtr;
1008 mark: UniChar;
1009 cmdKey: UniChar;
1010 cmdKeyGlyph: UInt32;
1011 cmdKeyModifiers: UInt32;
1012 style: Style_fix;
1013 enabled: Boolean;
1014 iconEnabled: Boolean;
1015 filler1: UInt8;
1016 iconID: SInt32;
1017 iconType: UInt32;
1018 iconHandle: Handle;
1019 cmdID: MenuCommand;
1020 encoding: TextEncoding;
1021 submenuID: MenuID;
1022 submenuHandle: MenuRef;
1023 fontID: SInt32;
1024 refcon: URefCon;
1025 attr: OptionBits;
1026 cfText: CFStringRef;
1027 properties: Collection;
1028 indent: UInt32;
1029 cmdVirtualKey: UInt16;
1030 attributedText: CFAttributedStringRef;
1031 font: CTFontRef;
1032 end;
1033 type
1034 MenuItemDataPtr = MenuItemDataRecPtr;
1035 MenuItemID = UInt32;
1036
1037 {
1038 * MenuDefType
1039 *
1040 * Summary:
1041 * Types of custom menu definitions.
1042 }
1043 const
1044 {
1045 * A custom menu definition using a function pointer based on the
1046 * pre-Carbon MDEF model. This type of custom menu definition is not
1047 * supported by 64-bit HIToolbox.
1048 }
1049 kMenuDefProcPtr = 0;
1050
1051 {
1052 * A custom menu definition using an HIView subclass. Available in
1053 * Mac OS X 10.3 and later.
1054 }
1055 kMenuDefClassID = 1;
1056
1057 type
1058 MenuDefType = UInt32;
1059 {$ifc TARGET_CPU_64}
1060 type
1061 MenuDefUPP = UnivPtr;
1062 {$elsec} {TARGET_CPU_64}
1063
1064 {
1065 * MenuDefProcPtr
1066 *
1067 * Summary:
1068 * Callback function for a custom menu definition.
1069 }
1070 type
1071 MenuDefProcPtr = procedure( message: SInt16; theMenu: MenuRef; var menuRect: Rect; hitPt: Point; var whichItem: SInt16 );
1072 MenuDefUPP = MenuDefProcPtr;
1073 {
1074 * NewMenuDefUPP()
1075 *
1076 * Availability:
1077 * Mac OS X: in version 10.0 and later in Carbon.framework
1078 * CarbonLib: in CarbonLib 1.0 and later
1079 * Non-Carbon CFM: available as macro/inline
1080 }
NewMenuDefUPPnull1081 function NewMenuDefUPP( userRoutine: MenuDefProcPtr ): MenuDefUPP; external name '_NewMenuDefUPP';
1082 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
1083
1084 {
1085 * DisposeMenuDefUPP()
1086 *
1087 * Availability:
1088 * Mac OS X: in version 10.0 and later in Carbon.framework
1089 * CarbonLib: in CarbonLib 1.0 and later
1090 * Non-Carbon CFM: available as macro/inline
1091 }
1092 procedure DisposeMenuDefUPP( userUPP: MenuDefUPP ); external name '_DisposeMenuDefUPP';
1093 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
1094
1095 {
1096 * InvokeMenuDefUPP()
1097 *
1098 * Availability:
1099 * Mac OS X: in version 10.0 and later in Carbon.framework
1100 * CarbonLib: in CarbonLib 1.0 and later
1101 * Non-Carbon CFM: available as macro/inline
1102 }
1103 procedure InvokeMenuDefUPP( message: SInt16; theMenu: MenuRef; var menuRect: Rect; hitPt: Point; var whichItem: SInt16; userUPP: MenuDefUPP ); external name '_InvokeMenuDefUPP';
1104 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
1105
1106 {$endc} {TARGET_CPU_64}
1107
1108
1109 {
1110 * MenuDefSpec
1111 *
1112 * Summary:
1113 * Specifies a custom menu definition.
1114 }
1115 type
1116 MenuDefSpec = record
1117 {
1118 * The type of menu definition: either kMenuDefProcPtr or
1119 * kMenuDefClassID. kMenuDefClassID may only be used in Mac OS X 10.3
1120 * and later. On 64-bit HIToolbox, kMenuDefProcPtr is not supported.
1121 }
1122 defType: MenuDefType;
1123 case SInt16 of
1124 0: (
1125 defProc: MenuDefUPP;
1126 );
1127 1: (
1128 classID: CFStringRef;
1129 initEvent: EventRef;
1130 );
1131 end;
1132 MenuDefSpecPtr = ^MenuDefSpec;
1133 {��������������������������������������������������������������������������������������}
1134 { � Menu Manipulation }
1135 {��������������������������������������������������������������������������������������}
1136 {$ifc not TARGET_CPU_64}
1137 {
1138 * [Mac]GetMenu()
1139 *
1140 * Summary:
1141 * Creates a menu using the contents of a 'MENU' resource.
1142 *
1143 * Discussion:
1144 * Apple recommends that you use Interface Builder to design your
1145 * menus and other user interface components. Interface Builder
1146 * stores its output in nib files rather then Resource Manager
1147 * resources. Use the CreateMenuFromNib API to load a menu from a
1148 * nib file.
1149 *
1150 * Mac OS X threading:
1151 * Not thread safe
1152 *
1153 * Parameters:
1154 *
1155 * resourceID:
1156 * The resource ID of the 'MENU' resource.
1157 *
1158 * Result:
1159 * The newly created MenuRef. In CarbonLib and Mac OS X, a new menu
1160 * will be created by each call to the GetMenu API; this is a change
1161 * from the classic Mac OS API, in which GetMenu would return an
1162 * existing menu if the menu had previously been created from the
1163 * same resource.
1164 *
1165 * Availability:
1166 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1167 * CarbonLib: in CarbonLib 1.0 and later
1168 * Non-Carbon CFM: in InterfaceLib 7.1 and later
1169 }
1170 {$ifc TARGET_OS_MAC}
MacGetMenunull1171 function MacGetMenu( resourceID: SInt16 ): MenuRef; external name '_GetMenu';
1172 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1173 {$endc} {TARGET_OS_MAC}
GetMenunull1174 function GetMenu( resourceID: SInt16 ): MenuRef; external name '_GetMenu';
1175 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1176
1177
1178 {
1179 * DisposeMenu()
1180 *
1181 * Mac OS X threading:
1182 * Not thread safe
1183 *
1184 * Availability:
1185 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1186 * CarbonLib: in CarbonLib 1.0 and later
1187 * Non-Carbon CFM: in InterfaceLib 7.1 and later
1188 }
1189 procedure DisposeMenu( theMenu: MenuRef ); external name '_DisposeMenu';
1190 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1191
1192
1193 {
1194 * GetMenuID()
1195 *
1196 * Mac OS X threading:
1197 * Not thread safe
1198 *
1199 * Availability:
1200 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1201 * CarbonLib: in CarbonLib 1.0 and later
1202 * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
1203 }
GetMenuIDnull1204 function GetMenuID( menu: MenuRef ): MenuID; external name '_GetMenuID';
1205 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1206
1207
1208 {
1209 * GetMenuWidth()
1210 *
1211 * Mac OS X threading:
1212 * Not thread safe
1213 *
1214 * Availability:
1215 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1216 * CarbonLib: in CarbonLib 1.0 and later
1217 * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
1218 }
GetMenuWidthnull1219 function GetMenuWidth( menu: MenuRef ): SInt16; external name '_GetMenuWidth';
1220 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1221
1222
1223 {
1224 * GetMenuHeight()
1225 *
1226 * Mac OS X threading:
1227 * Not thread safe
1228 *
1229 * Availability:
1230 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1231 * CarbonLib: in CarbonLib 1.0 and later
1232 * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
1233 }
GetMenuHeightnull1234 function GetMenuHeight( menu: MenuRef ): SInt16; external name '_GetMenuHeight';
1235 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1236
1237
1238 {
1239 * GetMenuDefinition()
1240 *
1241 * Mac OS X threading:
1242 * Not thread safe
1243 *
1244 * Availability:
1245 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1246 * CarbonLib: in CarbonLib 1.0 and later
1247 * Non-Carbon CFM: not available
1248 }
GetMenuDefinitionnull1249 function GetMenuDefinition( menu: MenuRef; outDefSpec: MenuDefSpecPtr ): OSStatus; external name '_GetMenuDefinition';
1250 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1251
1252
1253 {
1254 * SetMenuID()
1255 *
1256 * Mac OS X threading:
1257 * Not thread safe
1258 *
1259 * Availability:
1260 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1261 * CarbonLib: in CarbonLib 1.0 and later
1262 * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
1263 }
1264 procedure SetMenuID( menu: MenuRef; menuID_: MenuID ); external name '_SetMenuID';
1265 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1266
1267
1268 {
1269 * SetMenuWidth()
1270 *
1271 * Mac OS X threading:
1272 * Not thread safe
1273 *
1274 * Availability:
1275 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1276 * CarbonLib: in CarbonLib 1.0 and later
1277 * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
1278 }
1279 procedure SetMenuWidth( menu: MenuRef; width: SInt16 ); external name '_SetMenuWidth';
1280 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1281
1282
1283 {
1284 * SetMenuHeight()
1285 *
1286 * Mac OS X threading:
1287 * Not thread safe
1288 *
1289 * Availability:
1290 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1291 * CarbonLib: in CarbonLib 1.0 and later
1292 * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
1293 }
1294 procedure SetMenuHeight( menu: MenuRef; height: SInt16 ); external name '_SetMenuHeight';
1295 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1296
1297
1298 {
1299 * SetMenuDefinition()
1300 *
1301 * Mac OS X threading:
1302 * Not thread safe
1303 *
1304 * Availability:
1305 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1306 * CarbonLib: in CarbonLib 1.0 and later
1307 * Non-Carbon CFM: not available
1308 }
SetMenuDefinitionnull1309 function SetMenuDefinition( menu: MenuRef; const (*var*) defSpec: MenuDefSpec ): OSStatus; external name '_SetMenuDefinition';
1310 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1311
1312
1313 {
1314 * CalcMenuSize()
1315 *
1316 * Mac OS X threading:
1317 * Not thread safe
1318 *
1319 * Availability:
1320 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1321 * CarbonLib: in CarbonLib 1.0 and later
1322 * Non-Carbon CFM: in InterfaceLib 7.1 and later
1323 }
1324 procedure CalcMenuSize( theMenu: MenuRef ); external name '_CalcMenuSize';
1325 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1326
1327
1328 {
1329 * CountMenuItems()
1330 *
1331 * Mac OS X threading:
1332 * Not thread safe
1333 *
1334 * Availability:
1335 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1336 * CarbonLib: in CarbonLib 1.0 and later
1337 * Non-Carbon CFM: in CarbonAccessors.o 1.3 and later
1338 }
CountMenuItemsnull1339 function CountMenuItems( theMenu: MenuRef ): UInt16; external name '_CountMenuItems';
1340 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1341
1342
1343 { Routines available in Mac OS 8.5 and later, and on Mac OS 8.1 and later using CarbonLib 1.1 and later}
1344
1345 {
1346 * GetMenuFont()
1347 *
1348 * Summary:
1349 * Retrieves the QuickDraw font ID and size used to draw the items
1350 * in a menu.
1351 *
1352 * Discussion:
1353 * This API will be deprecated in the next major release of Mac OS
1354 * X. Use HIMenuCopyFont instead of GetMenuFont.
1355 *
1356 * Mac OS X threading:
1357 * Not thread safe
1358 *
1359 * Parameters:
1360 *
1361 * menu:
1362 * The menu whose font to retrieve.
1363 *
1364 * outFontID:
1365 * On exit, contains the menu's default font, or zero if the font
1366 * has not been customized.
1367 *
1368 * outFontSize:
1369 * On exit, contains the menu's default font size, or zero if the
1370 * font size has not been customized.
1371 *
1372 * Availability:
1373 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1374 * CarbonLib: in CarbonLib 1.0 and later
1375 * Non-Carbon CFM: in MenusLib 8.5 and later
1376 }
GetMenuFontnull1377 function GetMenuFont( menu: MenuRef; var outFontID: SInt16; var outFontSize: UInt16 ): OSStatus; external name '_GetMenuFont';
1378 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1379
1380
1381 {
1382 * SetMenuFont()
1383 *
1384 * Summary:
1385 * Sets the QuickDraw font ID and size used to draw the items in a
1386 * menu.
1387 *
1388 * Discussion:
1389 * This API will be deprecated in the next major release of Mac OS
1390 * X. Use HIMenuSetFont instead of SetMenuFont.
1391 *
1392 * Mac OS X threading:
1393 * Not thread safe
1394 *
1395 * Parameters:
1396 *
1397 * menu:
1398 * The menu whose font to set.
1399 *
1400 * inFontID:
1401 * The menu's default font, or zero to use the standard font for
1402 * menu items.
1403 *
1404 * inFontSize:
1405 * The menu's default font size, or zero to use the standard font
1406 * size for menu items.
1407 *
1408 * Availability:
1409 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1410 * CarbonLib: in CarbonLib 1.0 and later
1411 * Non-Carbon CFM: in MenusLib 8.5 and later
1412 }
SetMenuFontnull1413 function SetMenuFont( menu: MenuRef; inFontID: SInt16; inFontSize: UInt16 ): OSStatus; external name '_SetMenuFont';
1414 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1415
1416
1417 {
1418 * GetMenuExcludesMarkColumn()
1419 *
1420 * Summary:
1421 * Returns whether the layout of a menu includes or excludes space
1422 * for menu item marks.
1423 *
1424 * Discussion:
1425 * Apple recommends that you use the GetMenuAttributes API and check
1426 * for the kMenuAttrExcludesMarkColumn attribute instead of using
1427 * this API.
1428 *
1429 * Mac OS X threading:
1430 * Not thread safe
1431 *
1432 * Parameters:
1433 *
1434 * menu:
1435 * The menu to examine.
1436 *
1437 * Result:
1438 * True if the menu layout does not include space for menu item
1439 * marks, or false if it does include space for marks.
1440 *
1441 * Availability:
1442 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1443 * CarbonLib: in CarbonLib 1.0 and later
1444 * Non-Carbon CFM: in MenusLib 8.5 and later
1445 }
GetMenuExcludesMarkColumnnull1446 function GetMenuExcludesMarkColumn( menu: MenuRef ): Boolean; external name '_GetMenuExcludesMarkColumn';
1447 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1448
1449
1450 {
1451 * SetMenuExcludesMarkColumn()
1452 *
1453 * Summary:
1454 * Sets whether the layout of a menu includes or excludes space for
1455 * menu item marks.
1456 *
1457 * Discussion:
1458 * Apple recommends that you use the ChangeMenuAttributes API with
1459 * the kMenuAttrExcludesMarkColumn attribute instead of using this
1460 * API.
1461 *
1462 * Mac OS X threading:
1463 * Not thread safe
1464 *
1465 * Parameters:
1466 *
1467 * menu:
1468 * The menu to modify.
1469 *
1470 * excludesMark:
1471 * True if the menu layout should not include space for menu item
1472 * marks, or false if it should include space for marks.
1473 *
1474 * Availability:
1475 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1476 * CarbonLib: in CarbonLib 1.0 and later
1477 * Non-Carbon CFM: in MenusLib 8.5 and later
1478 }
SetMenuExcludesMarkColumnnull1479 function SetMenuExcludesMarkColumn( menu: MenuRef; excludesMark: Boolean ): OSStatus; external name '_SetMenuExcludesMarkColumn';
1480 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1481
1482
1483 {
1484 * RegisterMenuDefinition()
1485 *
1486 * Summary:
1487 * Registers or unregisters a binding between a resource ID and a
1488 * menu definition function.
1489 *
1490 * Discussion:
1491 * In the classic Mac OS Menu Manager, a 'MENU' resource can contain
1492 * an embedded MDEF procID that is used by the Menu Manager as the
1493 * resource ID of an 'MDEF' resource to measure and draw the menu.
1494 * The 'MDEF' resource is loaded by the Menu Manager when you load
1495 * the menu with GetMenu. Since MDEFs can no longer be packaged as
1496 * code resources on Carbon, the procID can no longer refer directly
1497 * to an MDEF resource. However, using RegisterMenuDefinition you
1498 * can instead specify a UniversalProcPtr pointing to code in your
1499 * application code fragment.
1500 *
1501 * Mac OS X threading:
1502 * Not thread safe
1503 *
1504 * Parameters:
1505 *
1506 * inResID:
1507 * An MDEF proc ID, as used in a 'MENU' resource.
1508 *
1509 * inDefSpec:
1510 * Specifies the MenuDefUPP that should be used for menus with the
1511 * given MDEF proc ID. Passing NULL allows you to unregister the
1512 * menu definition that had been associated with the given MDEF
1513 * proc ID.
1514 *
1515 * Availability:
1516 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1517 * CarbonLib: in CarbonLib 1.0 and later
1518 * Non-Carbon CFM: not available
1519 }
RegisterMenuDefinitionnull1520 function RegisterMenuDefinition( inResID: SInt16; inDefSpec: MenuDefSpecPtr ): OSStatus; external name '_RegisterMenuDefinition';
1521 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1522
1523
1524 {
1525 * CreateNewMenu()
1526 *
1527 * Summary:
1528 * Creates a new, untitled, empty menu.
1529 *
1530 * Discussion:
1531 * CreateNewMenu is preferred over NewMenu because it allows you to
1532 * specify the menu's attributes and it does not require you to
1533 * specify a Str255-based menu title. To set the menu title, you can
1534 * use either SetMenuTitle or SetMenuTitleWithCFString.
1535 *
1536 * Mac OS X threading:
1537 * Not thread safe
1538 *
1539 * Parameters:
1540 *
1541 * inMenuID:
1542 * The menu ID to use for the new menu. Zero is a valid menu ID in
1543 * Carbon.
1544 *
1545 * inMenuAttributes:
1546 * The menu attributes to use for the new menu.
1547 *
1548 * outMenuRef:
1549 * On exit, contains the new menu.
1550 *
1551 * Availability:
1552 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1553 * CarbonLib: in CarbonLib 1.0 and later
1554 * Non-Carbon CFM: not available
1555 }
CreateNewMenunull1556 function CreateNewMenu( inMenuID: MenuID; inMenuAttributes: MenuAttributes; var outMenuRef: MenuRef ): OSStatus; external name '_CreateNewMenu';
1557 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1558
1559
1560 {
1561 * CreateCustomMenu()
1562 *
1563 * Summary:
1564 * Creates a new, untitled, empty menu using a custom menu
1565 * definition function.
1566 *
1567 * Discussion:
1568 * Similar to CreateNewMenu, but also allows you to specify a custom
1569 * menu definition function.
1570 *
1571 * Mac OS X threading:
1572 * Not thread safe
1573 *
1574 * Parameters:
1575 *
1576 * inDefSpec:
1577 * Specifies a custom menu definition function. defSpec->defType
1578 * must be kMenuDefProcPtr or, on Mac OS X 10.3 and later,
1579 * kMenuDefClassID.
1580 *
1581 * inMenuID:
1582 * The menu ID to use for the new menu.
1583 *
1584 * inMenuAttributes:
1585 * The menu attributes to use for the new menu.
1586 *
1587 * outMenuRef:
1588 * On exit, contains the new menu.
1589 *
1590 * Availability:
1591 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1592 * CarbonLib: in CarbonLib 1.0 and later
1593 * Non-Carbon CFM: not available
1594 }
CreateCustomMenunull1595 function CreateCustomMenu( const (*var*) inDefSpec: MenuDefSpec; inMenuID: MenuID; inMenuAttributes: MenuAttributes; var outMenuRef: MenuRef ): OSStatus; external name '_CreateCustomMenu';
1596 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1597
1598
1599 {
1600 * IsValidMenu()
1601 *
1602 * Summary:
1603 * Determines if a menu is valid.
1604 *
1605 * Mac OS X threading:
1606 * Not thread safe
1607 *
1608 * Parameters:
1609 *
1610 * inMenu:
1611 * The menu to check for validity.
1612 *
1613 * Result:
1614 * Indicates whether the menu is valid.
1615 *
1616 * Availability:
1617 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1618 * CarbonLib: in CarbonLib 1.1 and later
1619 * Non-Carbon CFM: not available
1620 }
IsValidMenunull1621 function IsValidMenu( inMenu: MenuRef ): Boolean; external name '_IsValidMenu';
1622 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1623
1624
1625 {
1626 * DuplicateMenu()
1627 *
1628 * Summary:
1629 * Creates a new menu that is a copy of another menu.
1630 *
1631 * Discussion:
1632 * Unlike RetainMenu, DuplicateMenu creates an entirely new menu
1633 * that is an exact copy of the original menu. The MDEF for the new
1634 * menu will receive an init message after the menu has been fully
1635 * created.
1636 *
1637 * Mac OS X threading:
1638 * Not thread safe
1639 *
1640 * Parameters:
1641 *
1642 * inSourceMenu:
1643 * The menu to duplicate.
1644 *
1645 * outMenu:
1646 * On exit, a copy of the source menu.
1647 *
1648 * Availability:
1649 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1650 * CarbonLib: in CarbonLib 1.1 and later
1651 * Non-Carbon CFM: not available
1652 }
DuplicateMenunull1653 function DuplicateMenu( inSourceMenu: MenuRef; var outMenu: MenuRef ): OSStatus; external name '_DuplicateMenu';
1654 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1655
1656
1657 {
1658 * CopyMenuTitleAsCFString()
1659 *
1660 * Summary:
1661 * Returns a CFString containing the title of a menu.
1662 *
1663 * Mac OS X threading:
1664 * Not thread safe
1665 *
1666 * Parameters:
1667 *
1668 * inMenu:
1669 * The menu whose title to return.
1670 *
1671 * outString:
1672 * On exit, a CFString containing the menu's title. This string
1673 * must be released by the caller.
1674 *
1675 * Availability:
1676 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1677 * CarbonLib: in CarbonLib 1.1 and later
1678 * Non-Carbon CFM: not available
1679 }
CopyMenuTitleAsCFStringnull1680 function CopyMenuTitleAsCFString( inMenu: MenuRef; var outString: CFStringRef ): OSStatus; external name '_CopyMenuTitleAsCFString';
1681 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1682
1683
1684 {
1685 * SetMenuTitleWithCFString()
1686 *
1687 * Summary:
1688 * Sets the title of a menu to the text contained in a CFString.
1689 *
1690 * Discussion:
1691 * The Menu Manager will either make its own copy or just increment
1692 * the refcount of the CFString before returning from
1693 * SetMenuTitleWithCFString, depending on whether the string is
1694 * mutable or immutable. If the string is mutable, modifying the
1695 * string after calling SetMenuTitleWithCFString will have no effect
1696 * on the menu's actual title. The caller may release the string
1697 * after calling SetMenuTitleWithCFString.
1698 *
1699 * Mac OS X threading:
1700 * Not thread safe
1701 *
1702 * Parameters:
1703 *
1704 * inMenu:
1705 * The menu whose title to set.
1706 *
1707 * inString:
1708 * The string containing the new menu title text.
1709 *
1710 * Availability:
1711 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1712 * CarbonLib: in CarbonLib 1.1 and later
1713 * Non-Carbon CFM: not available
1714 }
SetMenuTitleWithCFStringnull1715 function SetMenuTitleWithCFString( inMenu: MenuRef; inString: CFStringRef ): OSStatus; external name '_SetMenuTitleWithCFString';
1716 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1717
1718
1719 {
1720 * SetMenuTitleIcon()
1721 *
1722 * Summary:
1723 * Sets the title of a menu to be an icon.
1724 *
1725 * Discussion:
1726 * The Menu Manager takes ownership of the supplied icon after this
1727 * call. When a menu with an title icon is disposed, the Menu
1728 * Manager will dispose the icon also; the Menu Manager will also
1729 * dispose of the current title icon when a new text or icon title
1730 * is supplied for a menu. If an IconRef or CGImageRef is specified,
1731 * the Menu Manager will increment its refcount, so you may freely
1732 * release your reference to the icon or image without invalidating
1733 * the Menu Manager's copy. The menubar will be invalidated by this
1734 * call, and redrawn at the next opportunity.
1735 *
1736 * Mac OS X threading:
1737 * Not thread safe
1738 *
1739 * Parameters:
1740 *
1741 * inMenu:
1742 * The menu whose title to set.
1743 *
1744 * inType:
1745 * The type of icon being used to specify the icon title; use
1746 * kMenuNoIcon to remove the icon from the menu title. In Mac OS X
1747 * 10.2 and earlier, the supported types are kMenuIconSuiteType
1748 * and kMenuIconRefType; Mac OS X 10.3 also supports
1749 * kMenuCGImageRefType.
1750 *
1751 * inIcon:
1752 * The icon; must be NULL if inType is kMenuNoIcon. The supported
1753 * icon formats are IconSuiteRef, IconRef, and in Mac OS X 10.3
1754 * and later, CGImageRef.
1755 *
1756 * Availability:
1757 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1758 * CarbonLib: in CarbonLib 1.1 and later
1759 * Non-Carbon CFM: not available
1760 }
SetMenuTitleIconnull1761 function SetMenuTitleIcon( inMenu: MenuRef; inType: UInt32; inIcon: UnivPtr ): OSStatus; external name '_SetMenuTitleIcon';
1762 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1763
1764
1765 {
1766 * GetMenuTitleIcon()
1767 *
1768 * Summary:
1769 * Retrieves the icon, if any, being used as the title of a menu.
1770 *
1771 * Discussion:
1772 * This API does not increment a refcount on the returned icon. The
1773 * caller should not release the icon.
1774 *
1775 * Mac OS X threading:
1776 * Not thread safe
1777 *
1778 * Parameters:
1779 *
1780 * inMenu:
1781 * The menu whose icon title to retrieve.
1782 *
1783 * outType:
1784 * On exit, contains the type of icon being used as the title of
1785 * the menu. Contains kMenuNoIcon if the menu does not have an
1786 * icon title.
1787 *
1788 * outIcon:
1789 * On exit, contains the IconSuiteRef, IconRef, or CGImageRef
1790 * being used as the title of the menu, or NULL if the menu does
1791 * not have an icon title. May be NULL.
1792 *
1793 * Availability:
1794 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1795 * CarbonLib: in CarbonLib 1.1 and later
1796 * Non-Carbon CFM: not available
1797 }
GetMenuTitleIconnull1798 function GetMenuTitleIcon( inMenu: MenuRef; outType: UInt32Ptr { can be NULL }; outIcon: UnivPtrPtr { can be NULL } ): OSStatus; external name '_GetMenuTitleIcon';
1799 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1800
1801
1802 {
1803 * InvalidateMenuSize()
1804 *
1805 * Summary:
1806 * Invalidates the menu size so that it will be recalculated when
1807 * next displayed.
1808 *
1809 * Discussion:
1810 * The pre-Carbon technique for invalidating the menu size was to
1811 * set the width and height to -1. Although this technique still
1812 * works, for best compatibility it's preferable to use the
1813 * InvalidateMenuSize API so that the Menu Manager has explicit
1814 * notification that the menu is invalid.
1815 *
1816 * Mac OS X threading:
1817 * Not thread safe
1818 *
1819 * Parameters:
1820 *
1821 * inMenu:
1822 * The menu whose size to invalidate.
1823 *
1824 * Availability:
1825 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1826 * CarbonLib: in CarbonLib 1.1 and later
1827 * Non-Carbon CFM: not available
1828 }
InvalidateMenuSizenull1829 function InvalidateMenuSize( inMenu: MenuRef ): OSStatus; external name '_InvalidateMenuSize';
1830 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1831
1832
1833 {
1834 * IsMenuSizeInvalid()
1835 *
1836 * Summary:
1837 * Determines if a menu's size is invalid and should be recalculated.
1838 *
1839 * Discussion:
1840 * The pre-Carbon technique for determining if a menu's size is
1841 * invalid was to check if the width or height was -1. This
1842 * technique is not always reliable on Carbon due to implementation
1843 * changes in the Menu Manager. You should now use IsMenuSizeInvalid
1844 * instead.
1845 *
1846 * Mac OS X threading:
1847 * Not thread safe
1848 *
1849 * Parameters:
1850 *
1851 * inMenu:
1852 * The menu whose size to examine.
1853 *
1854 * Availability:
1855 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1856 * CarbonLib: in CarbonLib 1.1 and later
1857 * Non-Carbon CFM: not available
1858 }
IsMenuSizeInvalidnull1859 function IsMenuSizeInvalid( inMenu: MenuRef ): Boolean; external name '_IsMenuSizeInvalid';
1860 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1861
1862
1863 {
1864 * HIMenuGetContentView()
1865 *
1866 * Summary:
1867 * Returns the HIViewRef that will be used to draw menu content for
1868 * this menu, if any.
1869 *
1870 * Discussion:
1871 * If the content view has not yet been created, the Menu Manager
1872 * will create the content view using the view class ID and
1873 * initialization event associated with the menu. Note that the menu
1874 * content view is not the same as the window content view; the menu
1875 * content view is embedded inside the window content view. If the
1876 * menu uses an MDEF instead of an HIView to draw its content, noErr
1877 * is returned but the output HIViewRef is set to NULL.
1878 *
1879 * Mac OS X threading:
1880 * Not thread safe
1881 *
1882 * Parameters:
1883 *
1884 * inMenu:
1885 * The menu.
1886 *
1887 * inMenuType:
1888 * The type of menu for which the menu content view should be
1889 * returned. The same MenuRef may have multiple content views,
1890 * depending on the menu type being displayed.
1891 *
1892 * outView:
1893 * On exit, contains the view. May be set to NULL if the menu does
1894 * not use an HIView to draw its content. The caller should not
1895 * release this view.
1896 *
1897 * Availability:
1898 * Mac OS X: in version 10.3 and later in Carbon.framework [32-bit only]
1899 * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
1900 * Non-Carbon CFM: not available
1901 }
HIMenuGetContentViewnull1902 function HIMenuGetContentView( inMenu: MenuRef; inMenuType: ThemeMenuType; var outView: HIViewRef ): OSStatus; external name '_HIMenuGetContentView';
1903 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
1904
1905
1906 {
1907 * HIMenuSetFont()
1908 *
1909 * Summary:
1910 * Sets the font to be used to draw a menu or a menu item.
1911 *
1912 * Discussion:
1913 * Pass zero for the inItem parameter to set the default font for
1914 * all of the items in a menu. Pass a non-zero value for the inItem
1915 * parameter to set a font for a specific item; this overrides the
1916 * default font for the menu. If a font is set for an entire menu,
1917 * it will also apply to all submenus of the menu. Setting a font
1918 * for a specific item does not cause that font to apply to the
1919 * item's submenu.
1920 *
1921 * Mac OS X threading:
1922 * Not thread safe
1923 *
1924 * Parameters:
1925 *
1926 * inMenu:
1927 * The menu whose font to set.
1928 *
1929 * inItem:
1930 * The item whose font to set, or zero to customze the font for
1931 * the entire menu.
1932 *
1933 * inFont:
1934 * The font to use for the specified menu or item. May be NULL to
1935 * remove the menu or item's current custom font. The font will be
1936 * retained by the Menu Manager and released when the menu or item
1937 * is destroyed, or when the font for the menu or item is changed
1938 * to a different value.
1939 *
1940 * Availability:
1941 * Mac OS X: in version 10.5 and later in Carbon.framework [32-bit only]
1942 * CarbonLib: not available
1943 * Non-Carbon CFM: not available
1944 }
HIMenuSetFontnull1945 function HIMenuSetFont( inMenu: MenuRef; inItem: MenuItemIndex; inFont: CTFontRef { can be NULL } ): OSStatus; external name '_HIMenuSetFont';
1946 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
1947
1948
1949 {
1950 * HIMenuCopyFont()
1951 *
1952 * Summary:
1953 * Retrieves the custom font that is used to draw a menu or a menu
1954 * item.
1955 *
1956 * Mac OS X threading:
1957 * Not thread safe
1958 *
1959 * Parameters:
1960 *
1961 * inMenu:
1962 * The menu whose font to retrieve.
1963 *
1964 * inItem:
1965 * The item whose font to retrieve, or zero to retrieve the font
1966 * for the entire menu.
1967 *
1968 * outFont:
1969 * On exit, contains the font used for the specified menu or item.
1970 * If the menu or item does not have a custom font, the resulting
1971 * CTFontRef is set to NULL. The caller must release the
1972 * CTFontRef, if it is non-NULL.
1973 *
1974 * Availability:
1975 * Mac OS X: in version 10.5 and later in Carbon.framework [32-bit only]
1976 * CarbonLib: not available
1977 * Non-Carbon CFM: not available
1978 }
HIMenuCopyFontnull1979 function HIMenuCopyFont( inMenu: MenuRef; inItem: MenuItemIndex; var outFont: CTFontRef ): OSStatus; external name '_HIMenuCopyFont';
1980 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
1981
1982
1983 {��������������������������������������������������������������������������������������}
1984 { � Menu Item Insertion }
1985 {��������������������������������������������������������������������������������������}
1986 {
1987 * DeleteMenuItem()
1988 *
1989 * Mac OS X threading:
1990 * Not thread safe
1991 *
1992 * Availability:
1993 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1994 * CarbonLib: in CarbonLib 1.0 and later
1995 * Non-Carbon CFM: in InterfaceLib 7.1 and later
1996 }
1997 procedure DeleteMenuItem( theMenu: MenuRef; item: MenuItemIndex ); external name '_DeleteMenuItem';
1998 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1999
2000
2001 {
2002 * CopyMenuItems()
2003 *
2004 * Summary:
2005 * Copies menu items from one menu to another.
2006 *
2007 * Mac OS X threading:
2008 * Not thread safe
2009 *
2010 * Parameters:
2011 *
2012 * inSourceMenu:
2013 * The menu from which to copy items.
2014 *
2015 * inFirstItem:
2016 * The first item to copy.
2017 *
2018 * inNumItems:
2019 * The number of items to copy.
2020 *
2021 * inDestMenu:
2022 * The menu to which to copy items.
2023 *
2024 * inInsertAfter:
2025 * The menu item in the destination menu after which to insert the
2026 * copied items. Pass 0 to insert the items at the beginning of
2027 * the menu. This value of this parameter must not exceed the
2028 * number of items in the destination menu.
2029 *
2030 * Availability:
2031 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2032 * CarbonLib: in CarbonLib 1.1 and later
2033 * Non-Carbon CFM: not available
2034 }
CopyMenuItemsnull2035 function CopyMenuItems( inSourceMenu: MenuRef; inFirstItem: MenuItemIndex; inNumItems: ItemCount; inDestMenu: MenuRef; inInsertAfter: MenuItemIndex ): OSStatus; external name '_CopyMenuItems';
2036 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2037
2038
2039 {
2040 * DeleteMenuItems()
2041 *
2042 * Summary:
2043 * Deletes multiple menu items.
2044 *
2045 * Discussion:
2046 * This API is more efficient than calling DeleteMenuItem multiple
2047 * times.
2048 *
2049 * Mac OS X threading:
2050 * Not thread safe
2051 *
2052 * Parameters:
2053 *
2054 * inMenu:
2055 * The menu from which to delete items.
2056 *
2057 * inFirstItem:
2058 * The first item to delete.
2059 *
2060 * inNumItems:
2061 * The number of items to delete.
2062 *
2063 * Availability:
2064 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2065 * CarbonLib: in CarbonLib 1.1 and later
2066 * Non-Carbon CFM: not available
2067 }
DeleteMenuItemsnull2068 function DeleteMenuItems( inMenu: MenuRef; inFirstItem: MenuItemIndex; inNumItems: ItemCount ): OSStatus; external name '_DeleteMenuItems';
2069 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2070
2071
2072 {
2073 * AppendMenuItemTextWithCFString()
2074 *
2075 * Summary:
2076 * Appends a new menu item with text from a CFString.
2077 *
2078 * Discussion:
2079 * The Menu Manager will either make its own copy or just increment
2080 * the refcount of the CFString before returning from
2081 * AppendMenuItemWithTextCFString, depending on whether the string
2082 * is mutable or immutable. If the string is mutable, modifying the
2083 * string after calling AppendMenuItemTextWithCFString will have no
2084 * effect on the menu item's actual text. The caller may release the
2085 * string after calling AppendMenuItemTextWithCFString.
2086 *
2087 * Mac OS X threading:
2088 * Not thread safe
2089 *
2090 * Parameters:
2091 *
2092 * inMenu:
2093 * The menu to which to append the new item.
2094 *
2095 * inString:
2096 * The text of the new item.
2097 *
2098 * inAttributes:
2099 * The attributes of the new item.
2100 *
2101 * inCommandID:
2102 * The command ID of the new item.
2103 *
2104 * outNewItem:
2105 * On exit, the index of the new item. May be NULL if the caller
2106 * does not need this information.
2107 *
2108 * Availability:
2109 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2110 * CarbonLib: in CarbonLib 1.1 and later
2111 * Non-Carbon CFM: not available
2112 }
AppendMenuItemTextWithCFStringnull2113 function AppendMenuItemTextWithCFString( inMenu: MenuRef; inString: CFStringRef; inAttributes: MenuItemAttributes; inCommandID: MenuCommand; outNewItem: MenuItemIndexPtr { can be NULL } ): OSStatus; external name '_AppendMenuItemTextWithCFString';
2114 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2115
2116
2117 {
2118 * InsertMenuItemTextWithCFString()
2119 *
2120 * Summary:
2121 * Inserts a new menu item with text from a CFString.
2122 *
2123 * Discussion:
2124 * The Menu Manager will either make its own copy or just increment
2125 * the refcount of the CFString before returning from
2126 * InsertMenuItemWithCFString, depending on whether the string is
2127 * mutable or immutable. If the string is mutable, modifying the
2128 * string after calling InsertMenuItemWithCFString will have no
2129 * effect on the menu item's actual text. The caller may release the
2130 * string after calling InsertMenuItemWithCFString.
2131 *
2132 * Mac OS X threading:
2133 * Not thread safe
2134 *
2135 * Parameters:
2136 *
2137 * inMenu:
2138 * The menu in which to insert the new item.
2139 *
2140 * inString:
2141 * The text of the new item.
2142 *
2143 * inAfterItem:
2144 * The item after which to insert the new item. Pass 0 to insert
2145 * the item at the beginning of the menu. If inAfterItem is
2146 * greater than the number of items in the menu, the item is
2147 * inserted at the end of the menu.
2148 *
2149 * inAttributes:
2150 * The attributes of the new item.
2151 *
2152 * inCommandID:
2153 * The command ID of the new item.
2154 *
2155 * Availability:
2156 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2157 * CarbonLib: in CarbonLib 1.1 and later
2158 * Non-Carbon CFM: not available
2159 }
InsertMenuItemTextWithCFStringnull2160 function InsertMenuItemTextWithCFString( inMenu: MenuRef; inString: CFStringRef; inAfterItem: MenuItemIndex; inAttributes: MenuItemAttributes; inCommandID: MenuCommand ): OSStatus; external name '_InsertMenuItemTextWithCFString';
2161 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2162
2163
2164 {��������������������������������������������������������������������������������������}
2165 { � Menu Events }
2166 {��������������������������������������������������������������������������������������}
2167 {
2168 * HIMenuSetSelection()
2169 *
2170 * Summary:
2171 * Sets the selected item in a menu.
2172 *
2173 * Discussion:
2174 * The HIMenuSetSelection API may be called either before opening a
2175 * menu, or while a menu is open. If called before opening a menu,
2176 * when the menu is next opened, the specified item will be
2177 * selected; this case only works for menus that use an HIView to
2178 * display menu content, and does not work for MDEF-based menus. If
2179 * called while a menu is open, the menu's selection will be changed
2180 * to the specified item. Note that changing the selection of an
2181 * open menu is not standard UI and may be confusing to the user;
2182 * also, changing the selected item does not currently affect the
2183 * state of hierarchical submenus of the previously selected or
2184 * newly selected item, so Apple recommends that you do not change
2185 * the selected state of an item with a hierarchical submenu.
2186 *
2187 * Mac OS X threading:
2188 * Not thread safe
2189 *
2190 * Parameters:
2191 *
2192 * inMenu:
2193 * The menu whose selected item to set.
2194 *
2195 * inMenuType:
2196 * The type of menu for which to set the selected item. Ignored
2197 * unless the menu is already open; use GetMenuType to determine
2198 * the menu's current type.
2199 *
2200 * inItem:
2201 * The menu item that should be selected.
2202 *
2203 * Availability:
2204 * Mac OS X: in version 10.5 and later in Carbon.framework [32-bit only]
2205 * CarbonLib: not available
2206 * Non-Carbon CFM: not available
2207 }
HIMenuSetSelectionnull2208 function HIMenuSetSelection( inMenu: MenuRef; inMenuType: ThemeMenuType; inItem: MenuItemIndex ): OSStatus; external name '_HIMenuSetSelection';
2209 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
2210
2211
2212 {
2213 * MenuSelect()
2214 *
2215 * Mac OS X threading:
2216 * Not thread safe
2217 *
2218 * Availability:
2219 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2220 * CarbonLib: in CarbonLib 1.0 and later
2221 * Non-Carbon CFM: in InterfaceLib 7.1 and later
2222 }
MenuSelectnull2223 function MenuSelect( startPt: Point ): SInt32; external name '_MenuSelect';
2224 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2225
2226
2227 {
2228 * PopUpMenuSelect()
2229 *
2230 * Summary:
2231 * Displays a pop-up menu at a specified location.
2232 *
2233 * Discussion:
2234 * In Mac OS 9 and earlier, PopUpMenuSelect requires that the menu
2235 * be inserted into the menubar using InsertMenu( menuRef,
2236 * kInsertHierarchicalMenu ). CarbonLib 1.1 and later, and Mac OS X,
2237 * do not have this requirement; a menu can be displayed by
2238 * PopUpMenuSelect even if it is not inserted in the menubar.
2239 *
2240 * Mac OS X threading:
2241 * Not thread safe
2242 *
2243 * Parameters:
2244 *
2245 * menu:
2246 * The menu to display.
2247 *
2248 * top:
2249 * The vertical position, in global coordinates, of the top left
2250 * corner of the selected item when the menu is opened.
2251 *
2252 * left:
2253 * The horizontal position, in global coordinates, of the top left
2254 * corner of the selected item when the menu is opened.
2255 *
2256 * popUpItem:
2257 * The item that should be positioned at the global point
2258 * specified by the top and left parameters. May be zero, in which
2259 * case item one is positioned at the specified global point.
2260 *
2261 * Result:
2262 * A 32-bit value whose high 16-bit word is the menu ID and whose
2263 * low 16-bit word is the index of the menu item that was selected,
2264 * or zero if no item was selected.
2265 *
2266 * Availability:
2267 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2268 * CarbonLib: in CarbonLib 1.0 and later
2269 * Non-Carbon CFM: in InterfaceLib 7.1 and later
2270 }
PopUpMenuSelectnull2271 function PopUpMenuSelect( menu: MenuRef; top: SInt16; left: SInt16; popUpItem: MenuItemIndex ): SInt32; external name '_PopUpMenuSelect';
2272 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2273
2274
2275 {
2276 * MenuChoice()
2277 *
2278 * Mac OS X threading:
2279 * Not thread safe
2280 *
2281 * Availability:
2282 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2283 * CarbonLib: in CarbonLib 1.0 and later
2284 * Non-Carbon CFM: in InterfaceLib 7.1 and later
2285 }
MenuChoicenull2286 function MenuChoice: SInt32; external name '_MenuChoice';
2287 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2288
2289
2290 {
2291 * MenuEvent()
2292 *
2293 * Summary:
2294 * Determines whether an event should result in the selection of a
2295 * menu item.
2296 *
2297 * Discussion:
2298 * Apple recommends that you use the IsMenuKeyEvent API rather than
2299 * this API.
2300 *
2301 * Mac OS X threading:
2302 * Not thread safe
2303 *
2304 * Parameters:
2305 *
2306 * inEvent:
2307 * The event to examine. Typically, this is a keyboard event.
2308 *
2309 * Result:
2310 * If the keyboard event corresponds to a menu item's keyboard
2311 * equivalent, then the result is a 32-bit value whose high 16-bit
2312 * word is the menu ID and whose low 16-bit word is the index of the
2313 * menu item that was found. Zero is returned if no item matched the
2314 * event.
2315 *
2316 * Availability:
2317 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2318 * CarbonLib: in CarbonLib 1.0 and later
2319 * Non-Carbon CFM: in AppearanceLib 1.0 and later
2320 }
MenuEventnull2321 function MenuEvent( const (*var*) inEvent: EventRecord ): UInt32; external name '_MenuEvent';
2322 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2323
2324
2325 {
2326 * IsMenuKeyEvent()
2327 *
2328 * Summary:
2329 * Determines if an event corresponds to a menu command key.
2330 *
2331 * Discussion:
2332 * By default, IsMenuKeyEvent searches the menus in the current menu
2333 * bar and hilites the menu title of the menu containing the
2334 * selected item.
2335 *
2336 * Mac OS X threading:
2337 * Not thread safe
2338 *
2339 * Parameters:
2340 *
2341 * inStartMenu:
2342 * IsMenuKeyEvent searches for matching menu items in this menu
2343 * and all of its submenus. May be NULL to search the current menu
2344 * bar contents.
2345 *
2346 * inEvent:
2347 * The event to match against. Non-keyboard events are ignored.
2348 *
2349 * inOptions:
2350 * Options controlling how to search. Pass kNilOptions for the
2351 * default behavior.
2352 *
2353 * outMenu:
2354 * On exit, the menu containing the matching item. May be NULL.
2355 *
2356 * outMenuItem:
2357 * On exit, the menu item that matched. May be NULL.
2358 *
2359 * Availability:
2360 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2361 * CarbonLib: in CarbonLib 1.1 and later
2362 * Non-Carbon CFM: not available
2363 }
IsMenuKeyEventnull2364 function IsMenuKeyEvent( inStartMenu: MenuRef; inEvent: EventRef; inOptions: MenuEventOptions; outMenu: MenuRefPtr { can be NULL }; outMenuItem: MenuItemIndexPtr { can be NULL } ): Boolean; external name '_IsMenuKeyEvent';
2365 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2366
2367
2368 {
2369 * InvalidateMenuEnabling()
2370 *
2371 * Summary:
2372 * Causes the menu enable state to be recalculated at the next
2373 * convenient opportunity.
2374 *
2375 * Discussion:
2376 * It is common for state changes in an application (for example,
2377 * selection of text) to cause a change in the enabling of items in
2378 * the application's menu (for example, the Copy menu item might
2379 * become enabled). In a Carbon-event-savvy application, menu items
2380 * are enabled or disabled in response to an
2381 * kEventCommandUpdateStatus event; however, this event is normally
2382 * only sent before a command key press or a click in the menubar.
2383 * You can request an explicit recalculation of a menu's enable
2384 * state with the InvalidateMenuEnabling API. The Carbon Event
2385 * Manager will automatically invalidate the enable state of all
2386 * top-level menus when a user event is dispatched, the user focus
2387 * changes, or the active window changes, so in many cases you will
2388 * not need to explicitly invalidate the menu enabling state.
2389 *
2390 * Mac OS X threading:
2391 * Not thread safe
2392 *
2393 * Parameters:
2394 *
2395 * inMenu:
2396 * A menu to re-enable, or NULL if all menus in the root menu
2397 * should be re-enabled.
2398 *
2399 * Availability:
2400 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2401 * CarbonLib: in CarbonLib 1.3 and later
2402 * Non-Carbon CFM: not available
2403 }
InvalidateMenuEnablingnull2404 function InvalidateMenuEnabling( inMenu: MenuRef ): OSStatus; external name '_InvalidateMenuEnabling';
2405 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2406
2407
2408 {$endc} {not TARGET_CPU_64}
2409
2410
2411 {
2412 * Summary:
2413 * Menu dismissal causation constants
2414 }
2415 const
2416 {
2417 * The menu was dismissed by the selection of a menu item.
2418 }
2419 kHIMenuDismissedBySelection = 1;
2420
2421 {
2422 * The menu was dismissed because the user canceled menu tracking.
2423 }
2424 kHIMenuDismissedByUserCancel = 2;
2425
2426 {
2427 * The menu was dismissed by a mouse-down somewhere that did not
2428 * result in menu item selection.
2429 }
2430 kHIMenuDismissedByMouseDown = 3;
2431
2432 {
2433 * The menu was dismissed by a mouse-up.
2434 }
2435 kHIMenuDismissedByMouseUp = 4;
2436
2437 {
2438 * The menu was dismissed by a keyboard event.
2439 }
2440 kHIMenuDismissedByKeyEvent = 5;
2441
2442 {
2443 * The menu was dismissed because the current application was no
2444 * longer frontmost.
2445 }
2446 kHIMenuDismissedByAppSwitch = 6;
2447
2448 {
2449 * The menu was dismissed because menu tracking mode timed out.
2450 }
2451 kHIMenuDismissedByTimeout = 7;
2452
2453 {
2454 * The menu was dismissed by the CancelMenuTracking API.
2455 }
2456 kHIMenuDismissedByCancelMenuTracking = 8;
2457
2458 {
2459 * The menu was dismissed because the active window changed.
2460 }
2461 kHIMenuDismissedByActivationChange = 9;
2462
2463 {
2464 * The menu was dismissed bcause the user focus window changed, or
2465 * because keyboard focus was removed from the current process.
2466 }
2467 kHIMenuDismissedByFocusChange = 10;
2468
2469 {$ifc not TARGET_CPU_64}
2470 {
2471 * CancelMenuTracking()
2472 *
2473 * Summary:
2474 * Cancels a menu tracking session.
2475 *
2476 * Mac OS X threading:
2477 * Not thread safe
2478 *
2479 * Parameters:
2480 *
2481 * inRootMenu:
2482 * The root menu of the menu tracking session that should be
2483 * dismissed. For menubar tracking, use the result of AcquireRoot
2484 * menu; for popup menu tracking, use the menu that was passed to
2485 * PopUpMenuSelect.
2486 *
2487 * inImmediate:
2488 * Whether the open menus should disappear immediately or fade out.
2489 *
2490 * inDismissalReason:
2491 * Why the menu is being dismissed; this value will be added to
2492 * the kEventMenuEndTracking event. On Mac OS X 10.5 and later,
2493 * you may pass zero to indicate that
2494 * kHIMenuDismissedByCancelMenuTracking should be passed to the
2495 * EndTracking event.
2496 *
2497 * Availability:
2498 * Mac OS X: in version 10.3 and later in Carbon.framework [32-bit only]
2499 * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
2500 * Non-Carbon CFM: not available
2501 }
CancelMenuTrackingnull2502 function CancelMenuTracking( inRootMenu: MenuRef; inImmediate: Boolean; inDismissalReason: UInt32 ): OSStatus; external name '_CancelMenuTracking';
2503 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
2504
2505
2506 {��������������������������������������������������������������������������������������}
2507 { � Menu Bar }
2508 {��������������������������������������������������������������������������������������}
2509 {
2510 * GetMBarHeight()
2511 *
2512 * Mac OS X threading:
2513 * Not thread safe
2514 *
2515 * Availability:
2516 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2517 * CarbonLib: in CarbonLib 1.0 and later
2518 * Non-Carbon CFM: in InterfaceLib 7.1 and later
2519 }
GetMBarHeightnull2520 function GetMBarHeight: SInt16; external name '_GetMBarHeight';
2521 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2522
2523
2524 {
2525 * [Mac]DrawMenuBar()
2526 *
2527 * Mac OS X threading:
2528 * Not thread safe
2529 *
2530 * Availability:
2531 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2532 * CarbonLib: in CarbonLib 1.0 and later
2533 * Non-Carbon CFM: in InterfaceLib 7.1 and later
2534 }
2535 procedure DrawMenuBar; external name '_DrawMenuBar';
2536 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2537 procedure MacDrawMenuBar; external name '_DrawMenuBar';
2538 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2539
2540
2541 {
2542 * InvalMenuBar()
2543 *
2544 * Mac OS X threading:
2545 * Not thread safe
2546 *
2547 * Availability:
2548 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2549 * CarbonLib: in CarbonLib 1.0 and later
2550 * Non-Carbon CFM: in InterfaceLib 7.1 and later
2551 }
2552 procedure InvalMenuBar; external name '_InvalMenuBar';
2553 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2554
2555
2556 {
2557 * IsMenuBarInvalid()
2558 *
2559 * Summary:
2560 * Determines if the menubar is invalid and should be redrawn.
2561 *
2562 * Mac OS X threading:
2563 * Not thread safe
2564 *
2565 * Parameters:
2566 *
2567 * rootMenu:
2568 * The root menu for the menubar to be examined. Pass NULL to
2569 * check the state of the current menubar.
2570 *
2571 * Availability:
2572 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2573 * CarbonLib: in CarbonLib 1.1 and later
2574 * Non-Carbon CFM: not available
2575 }
IsMenuBarInvalidnull2576 function IsMenuBarInvalid( rootMenu: MenuRef ): Boolean; external name '_IsMenuBarInvalid';
2577 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2578
2579
2580 {
2581 * HiliteMenu()
2582 *
2583 * Mac OS X threading:
2584 * Not thread safe
2585 *
2586 * Availability:
2587 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2588 * CarbonLib: in CarbonLib 1.0 and later
2589 * Non-Carbon CFM: in InterfaceLib 7.1 and later
2590 }
2591 procedure HiliteMenu( menuID_: MenuID ); external name '_HiliteMenu';
2592 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2593
2594
2595 {
2596 * GetNewMBar()
2597 *
2598 * Summary:
2599 * Creates multiple menus using the contents of a 'MBAR' resource.
2600 *
2601 * Discussion:
2602 * Apple recommends that you use Interface Builder to design your
2603 * menus and other user interface components. Interface Builder
2604 * stores its output in nib files rather then Resource Manager
2605 * resources. Use the CreateMenuBarFromNib API to load a menu from a
2606 * nib file.
2607 *
2608 * Mac OS X threading:
2609 * Not thread safe
2610 *
2611 * Parameters:
2612 *
2613 * menuBarID:
2614 * The resource ID of the 'MBAR' resource.
2615 *
2616 * Result:
2617 * The newly created menubar handle. Use SetMenuBar to place the
2618 * contents of the menubar handle into the menubar. You must release
2619 * the menubar handle with DisposeMenuBar when you are done with it.
2620 *
2621 * Availability:
2622 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2623 * CarbonLib: in CarbonLib 1.0 and later
2624 * Non-Carbon CFM: in InterfaceLib 7.1 and later
2625 }
GetNewMBarnull2626 function GetNewMBar( menuBarID: SInt16 ): MenuBarHandle; external name '_GetNewMBar';
2627 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2628
2629
2630 {
2631 * GetMenuBar()
2632 *
2633 * Mac OS X threading:
2634 * Not thread safe
2635 *
2636 * Availability:
2637 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2638 * CarbonLib: in CarbonLib 1.0 and later
2639 * Non-Carbon CFM: in InterfaceLib 7.1 and later
2640 }
GetMenuBarnull2641 function GetMenuBar: MenuBarHandle; external name '_GetMenuBar';
2642 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2643
2644
2645 {
2646 * SetMenuBar()
2647 *
2648 * Mac OS X threading:
2649 * Not thread safe
2650 *
2651 * Availability:
2652 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2653 * CarbonLib: in CarbonLib 1.0 and later
2654 * Non-Carbon CFM: in InterfaceLib 7.1 and later
2655 }
2656 procedure SetMenuBar( mbar: MenuBarHandle ); external name '_SetMenuBar';
2657 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2658
2659
2660 {
2661 * DuplicateMenuBar()
2662 *
2663 * Summary:
2664 * Duplicates a menubar handle.
2665 *
2666 * Discussion:
2667 * This API should be used in Carbon applications when duplicating a
2668 * handle returned from GetMenuBar or GetNewMBar. You should not use
2669 * Memory Manager APIs (HandToHand, NewHandle, etc) to duplicate
2670 * such a handle. This is necessary in Carbon so that the refcounts
2671 * of the menus in the menubar handle can be incremented when the
2672 * handle is duplicated.
2673 *
2674 * Mac OS X threading:
2675 * Not thread safe
2676 *
2677 * Parameters:
2678 *
2679 * inMbar:
2680 * The menubar handle to duplicate.
2681 *
2682 * outMbar:
2683 * On exit, contains the new menubar handle.
2684 *
2685 * Availability:
2686 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2687 * CarbonLib: in CarbonLib 1.0.2 and later
2688 * Non-Carbon CFM: not available
2689 }
DuplicateMenuBarnull2690 function DuplicateMenuBar( inMbar: MenuBarHandle; var outMbar: MenuBarHandle ): OSStatus; external name '_DuplicateMenuBar';
2691 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2692
2693
2694 {
2695 * DisposeMenuBar()
2696 *
2697 * Summary:
2698 * Releases a menubar handle.
2699 *
2700 * Discussion:
2701 * This API should be used in Carbon applications when releasing a
2702 * handle returned from GetMenuBar or GetNewMBar. You should not use
2703 * DisposeHandle to release such a handle. This is necessary in
2704 * Carbon so that the refcounts of the menus in the menubar handle
2705 * can be decremented when the handle is released.
2706 *
2707 * Mac OS X threading:
2708 * Not thread safe
2709 *
2710 * Parameters:
2711 *
2712 * inMbar:
2713 * The menubar handle to release.
2714 *
2715 * Availability:
2716 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2717 * CarbonLib: in CarbonLib 1.0.2 and later
2718 * Non-Carbon CFM: not available
2719 }
DisposeMenuBarnull2720 function DisposeMenuBar( inMbar: MenuBarHandle ): OSStatus; external name '_DisposeMenuBar';
2721 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2722
2723
2724 {
2725 * GetMenuHandle()
2726 *
2727 * Mac OS X threading:
2728 * Not thread safe
2729 *
2730 * Availability:
2731 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2732 * CarbonLib: in CarbonLib 1.0 and later
2733 * Non-Carbon CFM: in InterfaceLib 7.1 and later
2734 }
GetMenuHandlenull2735 function GetMenuHandle( menuID_: MenuID ): MenuRef; external name '_GetMenuHandle';
2736 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
GetMenuRefnull2737 function GetMenuRef( menuID_: MenuID ): MenuRef; external name '_GetMenuHandle';
2738 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2739
2740
2741 {
2742 * [Mac]InsertMenu()
2743 *
2744 * Mac OS X threading:
2745 * Not thread safe
2746 *
2747 * Availability:
2748 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2749 * CarbonLib: in CarbonLib 1.0 and later
2750 * Non-Carbon CFM: in InterfaceLib 7.1 and later
2751 }
2752 procedure InsertMenu( theMenu: MenuRef; beforeID: MenuID ); external name '_InsertMenu';
2753 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2754 procedure MacInsertMenu( theMenu: MenuRef; beforeID: MenuID ); external name '_InsertMenu';
2755 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2756
2757
2758 {
2759 * [Mac]DeleteMenu()
2760 *
2761 * Mac OS X threading:
2762 * Not thread safe
2763 *
2764 * Availability:
2765 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2766 * CarbonLib: in CarbonLib 1.0 and later
2767 * Non-Carbon CFM: in InterfaceLib 7.1 and later
2768 }
2769 procedure DeleteMenu( menuID_: MenuID ); external name '_DeleteMenu';
2770 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2771 procedure MacDeleteMenu( menuID_: MenuID ); external name '_DeleteMenu';
2772 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2773
2774
2775 {
2776 * ClearMenuBar()
2777 *
2778 * Mac OS X threading:
2779 * Not thread safe
2780 *
2781 * Availability:
2782 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2783 * CarbonLib: in CarbonLib 1.0 and later
2784 * Non-Carbon CFM: in InterfaceLib 7.1 and later
2785 }
2786 procedure ClearMenuBar; external name '_ClearMenuBar';
2787 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2788
2789
2790 {
2791 * FlashMenuBar()
2792 *
2793 * Mac OS X threading:
2794 * Not thread safe
2795 *
2796 * Availability:
2797 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2798 * CarbonLib: in CarbonLib 1.0 and later
2799 * Non-Carbon CFM: in InterfaceLib 7.1 and later
2800 }
2801 procedure FlashMenuBar( menuID_: MenuID ); external name '_FlashMenuBar';
2802 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2803
2804
2805 {
2806 * IsMenuBarVisible()
2807 *
2808 * Mac OS X threading:
2809 * Not thread safe
2810 *
2811 * Availability:
2812 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2813 * CarbonLib: in CarbonLib 1.0 and later
2814 * Non-Carbon CFM: in MenusLib 8.5 and later
2815 }
IsMenuBarVisiblenull2816 function IsMenuBarVisible: Boolean; external name '_IsMenuBarVisible';
2817 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2818
2819
2820 {
2821 * ShowMenuBar()
2822 *
2823 * Mac OS X threading:
2824 * Not thread safe
2825 *
2826 * Availability:
2827 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2828 * CarbonLib: in CarbonLib 1.0 and later
2829 * Non-Carbon CFM: in MenusLib 8.5 and later
2830 }
2831 procedure ShowMenuBar; external name '_ShowMenuBar';
2832 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2833
2834
2835 {
2836 * HideMenuBar()
2837 *
2838 * Mac OS X threading:
2839 * Not thread safe
2840 *
2841 * Availability:
2842 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2843 * CarbonLib: in CarbonLib 1.0 and later
2844 * Non-Carbon CFM: in MenusLib 8.5 and later
2845 }
2846 procedure HideMenuBar; external name '_HideMenuBar';
2847 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2848
2849
2850 {
2851 * AcquireRootMenu()
2852 *
2853 * Summary:
2854 * Get the menu whose contents are displayed in the menubar.
2855 *
2856 * Discussion:
2857 * The refcount of the root menu is incremented by this API. The
2858 * caller should release a refcount with ReleaseMenu when it�s done
2859 * with the menu.
2860 *
2861 * Mac OS X threading:
2862 * Not thread safe
2863 *
2864 * Availability:
2865 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2866 * CarbonLib: in CarbonLib 1.1 and later
2867 * Non-Carbon CFM: not available
2868 }
AcquireRootMenunull2869 function AcquireRootMenu: MenuRef; external name '_AcquireRootMenu';
2870 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2871
2872
2873 {
2874 * SetRootMenu()
2875 *
2876 * Summary:
2877 * Sets the menu whose contents are displayed in the menubar.
2878 *
2879 * Discussion:
2880 * The refcount of the root menu is incremented by this API. The
2881 * caller may release the menu after calling SetRootMenu.
2882 *
2883 * A root menu should contain one menu item for each top-level menu
2884 * that should be displayed in the menubar. Each menu item should
2885 * have a submenu that was installed with
2886 * SetMenuItemHierarchicalMenu.
2887 *
2888 * SetRootMenu also sets the contents of the hierarchical portion of
2889 * the menulist (the set of menus that were inserted with
2890 * InsertMenu( menu, kInsertHierarchicalMenu). If a menu that was
2891 * returned by AcquireRootMenu is passed to SetRootMenu, the
2892 * hierarchical menulist is changed to include the menus that were
2893 * in the hierarchical menulist when AcquireRootMenu was called. If
2894 * a newly created menu is passed to SetRootMenu, the hierarchical
2895 * menulist is cleared and has no menus in it.
2896 *
2897 * Mac OS X threading:
2898 * Not thread safe
2899 *
2900 * Parameters:
2901 *
2902 * inMenu:
2903 * The new root menu.
2904 *
2905 * Availability:
2906 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2907 * CarbonLib: in CarbonLib 1.1 and later
2908 * Non-Carbon CFM: not available
2909 }
SetRootMenunull2910 function SetRootMenu( inMenu: MenuRef ): OSStatus; external name '_SetRootMenu';
2911 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2912
2913
2914 {��������������������������������������������������������������������������������������}
2915 { � Menu Item Accessors }
2916 {��������������������������������������������������������������������������������������}
2917 {
2918 * [Mac]CheckMenuItem()
2919 *
2920 * Mac OS X threading:
2921 * Not thread safe
2922 *
2923 * Availability:
2924 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2925 * CarbonLib: in CarbonLib 1.0 and later
2926 * Non-Carbon CFM: in CarbonAccessors.o 1.3 and later
2927 }
2928 procedure CheckMenuItem( theMenu: MenuRef; item: MenuItemIndex; checked: Boolean ); external name '_CheckMenuItem';
2929 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2930 procedure MacCheckMenuItem( theMenu: MenuRef; item: MenuItemIndex; checked: Boolean ); external name '_CheckMenuItem';
2931 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2932
2933
2934 {
2935 * SetItemMark()
2936 *
2937 * Mac OS X threading:
2938 * Not thread safe
2939 *
2940 * Availability:
2941 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2942 * CarbonLib: in CarbonLib 1.0 and later
2943 * Non-Carbon CFM: in InterfaceLib 7.1 and later
2944 }
2945 procedure SetItemMark( theMenu: MenuRef; item: MenuItemIndex; markChar: CharParameter ); external name '_SetItemMark';
2946 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2947
2948
2949 {
2950 * GetItemMark()
2951 *
2952 * Mac OS X threading:
2953 * Not thread safe
2954 *
2955 * Availability:
2956 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2957 * CarbonLib: in CarbonLib 1.0 and later
2958 * Non-Carbon CFM: in InterfaceLib 7.1 and later
2959 }
2960
2961 procedure __GetItemMark( theMenu: MenuRef; item: MenuItemIndex; var markChar: UInt16 ); external name '_GetItemMark';
2962 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2963
2964 {
2965 With GPC and FPC on Intel we have an endian issue, because markChar is expected to be 16-bit
2966 }
2967
2968 procedure GetItemMark( theMenu: MenuRef; item: MenuItemIndex; var markChar: CharParameter ); inline;
2969
2970
2971 {
2972 * SetItemCmd()
2973 *
2974 * Summary:
2975 * Sets a menu item's keyboard equivalent to a specified character
2976 * in the application's text encoding.
2977 *
2978 * Discussion:
2979 * Apple recommends that you use the SetMenuItemCommandKey API
2980 * instead of this API.
2981 *
2982 * Mac OS X threading:
2983 * Not thread safe
2984 *
2985 * Parameters:
2986 *
2987 * theMenu:
2988 * The menu whose item to modify.
2989 *
2990 * item:
2991 * The item whose keyboard equivalent to set.
2992 *
2993 * cmdChar:
2994 * A character in the application's text encoding, or zero to
2995 * remove the item's keyboard equivalent.
2996 *
2997 * Availability:
2998 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
2999 * CarbonLib: in CarbonLib 1.0 and later
3000 * Non-Carbon CFM: in InterfaceLib 7.1 and later
3001 }
3002 procedure SetItemCmd( theMenu: MenuRef; item: MenuItemIndex; cmdChar: CharParameter ); external name '_SetItemCmd';
3003 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3004
3005
3006 {
3007 * GetItemCmd()
3008 *
3009 * Summary:
3010 * Returns a menu item's keyboard equivalent in the application's
3011 * text encoding.
3012 *
3013 * Discussion:
3014 * Apple recommends that you use the GetMenuItemCommandKey API
3015 * instead of this API.
3016 *
3017 * Mac OS X threading:
3018 * Not thread safe
3019 *
3020 * Parameters:
3021 *
3022 * theMenu:
3023 * The menu whose item to query.
3024 *
3025 * item:
3026 * The item whose keyboard equivalent to return.
3027 *
3028 * cmdChar:
3029 * On exit, contains the menu item's keyboard equivalent, or zero
3030 * if the item has no keyboard equivalent.
3031 *
3032 * Availability:
3033 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3034 * CarbonLib: in CarbonLib 1.0 and later
3035 * Non-Carbon CFM: in InterfaceLib 7.1 and later
3036 }
3037 procedure __GetItemCmd( theMenu: MenuRef; item: MenuItemIndex; var cmdChar: UInt16 ); external name '_GetItemCmd';
3038 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3039
3040 {
3041 With GPC and FPC on Intel we have an endian issue, because cmdChar is expected to be 16-bit
3042 }
3043
3044 procedure GetItemCmd( theMenu: MenuRef; item: MenuItemIndex; var cmdChar: CharParameter ); inline;
3045
3046
3047 {
3048 * SetItemStyle()
3049 *
3050 * Mac OS X threading:
3051 * Not thread safe
3052 *
3053 * Availability:
3054 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3055 * CarbonLib: in CarbonLib 1.0 and later
3056 * Non-Carbon CFM: in InterfaceLib 7.1 and later
3057 }
3058 procedure SetItemStyle( theMenu: MenuRef; item: MenuItemIndex; chStyle: StyleParameter ); external name '_SetItemStyle';
3059 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3060
3061
3062 {
3063 * GetItemStyle()
3064 *
3065 * Mac OS X threading:
3066 * Not thread safe
3067 *
3068 * Availability:
3069 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3070 * CarbonLib: in CarbonLib 1.0 and later
3071 * Non-Carbon CFM: in InterfaceLib 7.1 and later
3072 }
3073 procedure GetItemStyle( theMenu: MenuRef; item: MenuItemIndex; var chStyle: Style ); external name '_GetItemStyle';
3074 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3075
3076
3077 {
3078 * SetMenuItemCommandID()
3079 *
3080 * Mac OS X threading:
3081 * Not thread safe
3082 *
3083 * Availability:
3084 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3085 * CarbonLib: in CarbonLib 1.0 and later
3086 * Non-Carbon CFM: in AppearanceLib 1.0 and later
3087 }
SetMenuItemCommandIDnull3088 function SetMenuItemCommandID( inMenu: MenuRef; inItem: MenuItemIndex; inCommandID: MenuCommand ): OSErr; external name '_SetMenuItemCommandID';
3089 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3090
3091
3092 {
3093 * GetMenuItemCommandID()
3094 *
3095 * Mac OS X threading:
3096 * Not thread safe
3097 *
3098 * Availability:
3099 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3100 * CarbonLib: in CarbonLib 1.0 and later
3101 * Non-Carbon CFM: in AppearanceLib 1.0 and later
3102 }
GetMenuItemCommandIDnull3103 function GetMenuItemCommandID( inMenu: MenuRef; inItem: MenuItemIndex; var outCommandID: MenuCommand ): OSErr; external name '_GetMenuItemCommandID';
3104 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3105
3106
3107 {
3108 * SetMenuItemModifiers()
3109 *
3110 * Mac OS X threading:
3111 * Not thread safe
3112 *
3113 * Availability:
3114 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3115 * CarbonLib: in CarbonLib 1.0 and later
3116 * Non-Carbon CFM: in AppearanceLib 1.0 and later
3117 }
SetMenuItemModifiersnull3118 function SetMenuItemModifiers( inMenu: MenuRef; inItem: MenuItemIndex; inModifiers: SInt8 ): OSErr; external name '_SetMenuItemModifiers';
3119 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3120
3121
3122 {
3123 * GetMenuItemModifiers()
3124 *
3125 * Mac OS X threading:
3126 * Not thread safe
3127 *
3128 * Availability:
3129 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3130 * CarbonLib: in CarbonLib 1.0 and later
3131 * Non-Carbon CFM: in AppearanceLib 1.0 and later
3132 }
GetMenuItemModifiersnull3133 function GetMenuItemModifiers( inMenu: MenuRef; inItem: MenuItemIndex; var outModifiers: SInt8 ): OSErr; external name '_GetMenuItemModifiers';
3134 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3135
3136
3137 {
3138 * SetMenuItemIconHandle()
3139 *
3140 * Mac OS X threading:
3141 * Not thread safe
3142 *
3143 * Availability:
3144 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3145 * CarbonLib: in CarbonLib 1.0 and later
3146 * Non-Carbon CFM: in AppearanceLib 1.0 and later
3147 }
SetMenuItemIconHandlenull3148 function SetMenuItemIconHandle( inMenu: MenuRef; inItem: MenuItemIndex; inIconType: SInt8; inIconHandle: Handle ): OSErr; external name '_SetMenuItemIconHandle';
3149 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3150
3151
3152 {
3153 * GetMenuItemIconHandle()
3154 *
3155 * Mac OS X threading:
3156 * Not thread safe
3157 *
3158 * Availability:
3159 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3160 * CarbonLib: in CarbonLib 1.0 and later
3161 * Non-Carbon CFM: in AppearanceLib 1.0 and later
3162 }
GetMenuItemIconHandlenull3163 function GetMenuItemIconHandle( inMenu: MenuRef; inItem: MenuItemIndex; var outIconType: SInt8; var outIconHandle: Handle ): OSErr; external name '_GetMenuItemIconHandle';
3164 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3165
3166
3167
3168 {
3169 * SetMenuItemFontID()
3170 *
3171 * Summary:
3172 * Sets the QuickDraw font ID used to draw a menu item.
3173 *
3174 * Discussion:
3175 * The font ID specified with this API overrides the font ID
3176 * specified with the SetMenuFont API.
3177 *
3178 * This API will be deprecated in the next major release of Mac OS
3179 * X. Use HIMenuSetFont instead of SetMenuItemFontID.
3180 *
3181 * Mac OS X threading:
3182 * Not thread safe
3183 *
3184 * Parameters:
3185 *
3186 * inMenu:
3187 * The menu containing the item whose font to set.
3188 *
3189 * inItem:
3190 * The menu item whose font to set.
3191 *
3192 * inFontID:
3193 * The menu item's font, or zero to use the standard font for menu
3194 * items.
3195 *
3196 * Availability:
3197 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3198 * CarbonLib: in CarbonLib 1.0 and later
3199 * Non-Carbon CFM: in AppearanceLib 1.0 and later
3200 }
SetMenuItemFontIDnull3201 function SetMenuItemFontID( inMenu: MenuRef; inItem: MenuItemIndex; inFontID: SInt16 ): OSErr; external name '_SetMenuItemFontID';
3202 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3203
3204
3205 {
3206 * GetMenuItemFontID()
3207 *
3208 * Summary:
3209 * Retrieves the QuickDraw font ID used to draw a menu item.
3210 *
3211 * Discussion:
3212 * This API will be deprecated in the next major release of Mac OS
3213 * X. Use HIMenuCopyFont instead of GetMenuItemFontID.
3214 *
3215 * Mac OS X threading:
3216 * Not thread safe
3217 *
3218 * Parameters:
3219 *
3220 * inMenu:
3221 * The menu containing the item whose font to retrieve.
3222 *
3223 * inItem:
3224 * The menu item whose font to retrieve.
3225 *
3226 * outFontID:
3227 * On exit, contains the menu item's font, or zero if the font has
3228 * not been customized.
3229 *
3230 * Availability:
3231 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3232 * CarbonLib: in CarbonLib 1.0 and later
3233 * Non-Carbon CFM: in AppearanceLib 1.0 and later
3234 }
GetMenuItemFontIDnull3235 function GetMenuItemFontID( inMenu: MenuRef; inItem: MenuItemIndex; var outFontID: SInt16 ): OSErr; external name '_GetMenuItemFontID';
3236 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3237
3238
3239 {
3240 * SetMenuItemRefCon()
3241 *
3242 * Mac OS X threading:
3243 * Not thread safe
3244 *
3245 * Availability:
3246 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3247 * CarbonLib: in CarbonLib 1.0 and later
3248 * Non-Carbon CFM: in AppearanceLib 1.0 and later
3249 }
SetMenuItemRefConnull3250 function SetMenuItemRefCon( inMenu: MenuRef; inItem: MenuItemIndex; inRefCon: URefCon ): OSErr; external name '_SetMenuItemRefCon';
3251 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3252
3253
3254 {
3255 * GetMenuItemRefCon()
3256 *
3257 * Mac OS X threading:
3258 * Not thread safe
3259 *
3260 * Availability:
3261 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3262 * CarbonLib: in CarbonLib 1.0 and later
3263 * Non-Carbon CFM: in AppearanceLib 1.0 and later
3264 }
GetMenuItemRefConnull3265 function GetMenuItemRefCon( inMenu: MenuRef; inItem: MenuItemIndex; var outRefCon: URefCon ): OSErr; external name '_GetMenuItemRefCon';
3266 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3267
3268
3269 {
3270 * SetMenuItemKeyGlyph()
3271 *
3272 * Summary:
3273 * Sets the command key glyph code for a menu item.
3274 *
3275 * Discussion:
3276 * A menu item's command key may be customized using a key glyph
3277 * code; these codes are the kMenu*Glyph constants documented in
3278 * Menus.h. In classic Mac OS, a glyph code is only used for
3279 * display; it does not affect command key matching. In Carbon, a
3280 * menu item's glyph code is used for command key matching if the
3281 * menu item does not have a command key character or virtual
3282 * keycode assigned to it.
3283 *
3284 * In CarbonLib 1.2 and Mac OS X 10.0 and later, the Menu Manager
3285 * will automatically draw the appropriate glyph for a menu item
3286 * that has a virtual keycode command key assigned to it; it is not
3287 * necessary to set both the virtual keycode and the glyph for an
3288 * item.
3289 *
3290 * Mac OS X threading:
3291 * Not thread safe
3292 *
3293 * Parameters:
3294 *
3295 * inMenu:
3296 * The menu to change.
3297 *
3298 * inItem:
3299 * The menu item to change.
3300 *
3301 * inGlyph:
3302 * The new glyph code for the item, or zero to remove the item's
3303 * glyph code.
3304 *
3305 * Availability:
3306 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3307 * CarbonLib: in CarbonLib 1.0 and later
3308 * Non-Carbon CFM: in AppearanceLib 1.0 and later
3309 }
SetMenuItemKeyGlyphnull3310 function SetMenuItemKeyGlyph( inMenu: MenuRef; inItem: MenuItemIndex; inGlyph: SInt16 ): OSErr; external name '_SetMenuItemKeyGlyph';
3311 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3312
3313
3314 {
3315 * GetMenuItemKeyGlyph()
3316 *
3317 * Mac OS X threading:
3318 * Not thread safe
3319 *
3320 * Availability:
3321 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3322 * CarbonLib: in CarbonLib 1.0 and later
3323 * Non-Carbon CFM: in AppearanceLib 1.0 and later
3324 }
GetMenuItemKeyGlyphnull3325 function GetMenuItemKeyGlyph( inMenu: MenuRef; inItem: MenuItemIndex; var outGlyph: SInt16 ): OSErr; external name '_GetMenuItemKeyGlyph';
3326 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3327
3328
3329 { Routines available in Mac OS 8.5 and later (supporting enabling/disabling of > 31 items)}
3330
3331 {
3332 * [Mac]EnableMenuItem()
3333 *
3334 * Mac OS X threading:
3335 * Not thread safe
3336 *
3337 * Availability:
3338 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3339 * CarbonLib: in CarbonLib 1.0 and later
3340 * Non-Carbon CFM: in MenusLib 8.5 and later
3341 }
3342 procedure EnableMenuItem( theMenu: MenuRef; item: MenuItemIndex ); external name '_EnableMenuItem';
3343 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3344 procedure MacEnableMenuItem( theMenu: MenuRef; item: MenuItemIndex ); external name '_EnableMenuItem';
3345 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3346
3347
3348 {
3349 * DisableMenuItem()
3350 *
3351 * Mac OS X threading:
3352 * Not thread safe
3353 *
3354 * Availability:
3355 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3356 * CarbonLib: in CarbonLib 1.0 and later
3357 * Non-Carbon CFM: in MenusLib 8.5 and later
3358 }
3359 procedure DisableMenuItem( theMenu: MenuRef; item: MenuItemIndex ); external name '_DisableMenuItem';
3360 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3361
3362
3363 {
3364 * IsMenuItemEnabled()
3365 *
3366 * Mac OS X threading:
3367 * Not thread safe
3368 *
3369 * Availability:
3370 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3371 * CarbonLib: in CarbonLib 1.0 and later
3372 * Non-Carbon CFM: in MenusLib 8.5 and later
3373 }
IsMenuItemEnablednull3374 function IsMenuItemEnabled( menu: MenuRef; item: MenuItemIndex ): Boolean; external name '_IsMenuItemEnabled';
3375 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3376
3377
3378 {
3379 * EnableMenuItemIcon()
3380 *
3381 * Mac OS X threading:
3382 * Not thread safe
3383 *
3384 * Availability:
3385 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3386 * CarbonLib: in CarbonLib 1.0 and later
3387 * Non-Carbon CFM: in MenusLib 8.5 and later
3388 }
3389 procedure EnableMenuItemIcon( theMenu: MenuRef; item: MenuItemIndex ); external name '_EnableMenuItemIcon';
3390 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3391
3392
3393 {
3394 * DisableMenuItemIcon()
3395 *
3396 * Mac OS X threading:
3397 * Not thread safe
3398 *
3399 * Availability:
3400 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3401 * CarbonLib: in CarbonLib 1.0 and later
3402 * Non-Carbon CFM: in MenusLib 8.5 and later
3403 }
3404 procedure DisableMenuItemIcon( theMenu: MenuRef; item: MenuItemIndex ); external name '_DisableMenuItemIcon';
3405 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3406
3407
3408 {
3409 * IsMenuItemIconEnabled()
3410 *
3411 * Mac OS X threading:
3412 * Not thread safe
3413 *
3414 * Availability:
3415 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3416 * CarbonLib: in CarbonLib 1.0 and later
3417 * Non-Carbon CFM: in MenusLib 8.5 and later
3418 }
IsMenuItemIconEnablednull3419 function IsMenuItemIconEnabled( menu: MenuRef; item: MenuItemIndex ): Boolean; external name '_IsMenuItemIconEnabled';
3420 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3421
3422
3423 {
3424 * SetMenuItemHierarchicalMenu()
3425 *
3426 * Summary:
3427 * Attaches a submenu to a menu item.
3428 *
3429 * Discussion:
3430 * Using SetMenuItemHierarchicalMenu, it is possible to directly
3431 * specify the submenu for a menu item without specifying its menu
3432 * ID. It is not necessary to insert the submenu into the
3433 * hierarchical portion of the menubar, and it is not necessary for
3434 * the submenu to have a unique menu ID; it is recommended that you
3435 * use 0 as the menu ID for the submenu, and identify selections
3436 * from the menu by command ID. The Menu Manager will increment the
3437 * refcount of the submenu that you specify, and the submenu's
3438 * refcount will be decremented automatically when the parent menu
3439 * item is deleted or the parent menu is disposed.
3440 *
3441 * Mac OS X threading:
3442 * Not thread safe
3443 *
3444 * Parameters:
3445 *
3446 * inMenu:
3447 * The parent menu.
3448 *
3449 * inItem:
3450 * The parent item.
3451 *
3452 * inHierMenu:
3453 * The submenu. You may pass NULL to remove any existing submenu.
3454 *
3455 * Availability:
3456 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3457 * CarbonLib: in CarbonLib 1.1 and later
3458 * Non-Carbon CFM: not available
3459 }
SetMenuItemHierarchicalMenunull3460 function SetMenuItemHierarchicalMenu( inMenu: MenuRef; inItem: MenuItemIndex; inHierMenu: MenuRef { can be NULL } ): OSStatus; external name '_SetMenuItemHierarchicalMenu';
3461 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3462
3463
3464 {
3465 * GetMenuItemHierarchicalMenu()
3466 *
3467 * Summary:
3468 * Returns the submenu attached to a menu item.
3469 *
3470 * Discussion:
3471 * GetMenuItemHierarchicalMenu will return the submenu attached to a
3472 * menu item regardless of how the submenu was specified. If the
3473 * submenu was specified by menu ID (using SetItemCmd or
3474 * SetMenuItemHierarchicalID), GetMenuItemHierarchicalMenu will
3475 * return the currently installed menu with that ID, if any. The
3476 * only case where GetMenuItemHierarchicalMenu will fail to return
3477 * the item's submenu is when the submenu is specified by menu ID,
3478 * but the submenu is not currently inserted in the menu bar.
3479 *
3480 * Mac OS X threading:
3481 * Not thread safe
3482 *
3483 * Parameters:
3484 *
3485 * inMenu:
3486 * The parent menu.
3487 *
3488 * inItem:
3489 * The parent item.
3490 *
3491 * outHierMenu:
3492 * On exit, the item's submenu, or NULL if it does not have one.
3493 *
3494 * Availability:
3495 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3496 * CarbonLib: in CarbonLib 1.1 and later
3497 * Non-Carbon CFM: not available
3498 }
GetMenuItemHierarchicalMenunull3499 function GetMenuItemHierarchicalMenu( inMenu: MenuRef; inItem: MenuItemIndex; var outHierMenu: MenuRef ): OSStatus; external name '_GetMenuItemHierarchicalMenu';
3500 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3501
3502
3503 {
3504 * HIMenuCopyParents()
3505 *
3506 * Summary:
3507 * Returns the parent menus of a menu.
3508 *
3509 * Discussion:
3510 * A menu may be a submenu of one or more other menus; for example,
3511 * a Spelling menu might be a submenu of both an Edit menu contained
3512 * in the menubar, and a contextual menu displayed when the user
3513 * clicks in a document. HIMenuCopyParents returns an array of
3514 * MenuRefs that are the parent menus of the specified menu. If the
3515 * menu has only a single parent, the array will have only that
3516 * single parent menu in it.
3517 *
3518 * Mac OS X threading:
3519 * Not thread safe
3520 *
3521 * Parameters:
3522 *
3523 * inMenu:
3524 * The menu whose parent menus to return.
3525 *
3526 * outParents:
3527 * On exit, contains an array of MenuRefs that are parents of the
3528 * specified menu. If the menu does not have any parents, the
3529 * array on exit will be NULL. If not NULL, the caller is
3530 * responsible for releasing the array.
3531 *
3532 * Availability:
3533 * Mac OS X: in version 10.5 and later in Carbon.framework [32-bit only]
3534 * CarbonLib: not available
3535 * Non-Carbon CFM: not available
3536 }
HIMenuCopyParentsnull3537 function HIMenuCopyParents( inMenu: MenuRef; var outParents: CFArrayRef ): OSStatus; external name '_HIMenuCopyParents';
3538 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
3539
3540
3541 {
3542 * CopyMenuItemTextAsCFString()
3543 *
3544 * Summary:
3545 * Returns a CFString containing the text of a menu item.
3546 *
3547 * Mac OS X threading:
3548 * Not thread safe
3549 *
3550 * Parameters:
3551 *
3552 * inMenu:
3553 * The menu containing the item.
3554 *
3555 * inItem:
3556 * The item whose text to return.
3557 *
3558 * outString:
3559 * On exit, a CFString containing the item's text. This string
3560 * must be released by the caller.
3561 *
3562 * Availability:
3563 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3564 * CarbonLib: in CarbonLib 1.1 and later
3565 * Non-Carbon CFM: not available
3566 }
CopyMenuItemTextAsCFStringnull3567 function CopyMenuItemTextAsCFString( inMenu: MenuRef; inItem: MenuItemIndex; var outString: CFStringRef ): OSStatus; external name '_CopyMenuItemTextAsCFString';
3568 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3569
3570
3571 {
3572 * SetMenuItemTextWithCFString()
3573 *
3574 * Summary:
3575 * Sets the text of a menu item to the text contained in a CFString.
3576 *
3577 * Discussion:
3578 * The Menu Manager will either make its own copy or just increment
3579 * the refcount of the CFString before returning from
3580 * SetMenuItemTextWithCFString, depending on whether the string is
3581 * mutable or immutable. If the string is mutable, modifying the
3582 * string after calling SetMenuItemTextWithCFString will have no
3583 * effect on the menu item's actual text. The caller may release the
3584 * string after calling SetMenuItemTextWithCFString.
3585 *
3586 * Mac OS X threading:
3587 * Not thread safe
3588 *
3589 * Parameters:
3590 *
3591 * inMenu:
3592 * The menu containing the item.
3593 *
3594 * inItem:
3595 * The item whose text to set.
3596 *
3597 * inString:
3598 * The string containing the new menu item text.
3599 *
3600 * Availability:
3601 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3602 * CarbonLib: in CarbonLib 1.1 and later
3603 * Non-Carbon CFM: not available
3604 }
SetMenuItemTextWithCFStringnull3605 function SetMenuItemTextWithCFString( inMenu: MenuRef; inItem: MenuItemIndex; inString: CFStringRef ): OSStatus; external name '_SetMenuItemTextWithCFString';
3606 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3607
3608
3609 {
3610 * HIMenuSetAttributedItemText()
3611 *
3612 * Summary:
3613 * Sets the attributed text of a menu item.
3614 *
3615 * Discussion:
3616 * A menu item may have two strings attached to it: a regular
3617 * CFString and an attributed CFString. The regular string is
3618 * modified by the SetMenuItemTextAsCFString API, and the attributed
3619 * string is modified using this API. If an attributed string is
3620 * provided, it will be used when measuring and drawing the menu
3621 * item text. However, the regular string (if provided) is always
3622 * used for type-selection; this allows the attributed string to
3623 * contain extra characters that should be ignored during
3624 * type-selection.
3625 *
3626 * Mac OS X threading:
3627 * Not thread safe
3628 *
3629 * Parameters:
3630 *
3631 * inMenu:
3632 * The menu containing the specified item.
3633 *
3634 * inItem:
3635 * The menu item whose attributed text to set.
3636 *
3637 * inText:
3638 * The new attributed text for the menu item. May be NULL if the
3639 * item no longer need attributed text.
3640 *
3641 * Availability:
3642 * Mac OS X: in version 10.5 and later in Carbon.framework [32-bit only]
3643 * CarbonLib: not available
3644 * Non-Carbon CFM: not available
3645 }
HIMenuSetAttributedItemTextnull3646 function HIMenuSetAttributedItemText( inMenu: MenuRef; inItem: MenuItemIndex; inText: CFAttributedStringRef { can be NULL } ): OSStatus; external name '_HIMenuSetAttributedItemText';
3647 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
3648
3649
3650 {
3651 * HIMenuCopyAttributedItemText()
3652 *
3653 * Summary:
3654 * Retrieves the attributed text of a menu item.
3655 *
3656 * Mac OS X threading:
3657 * Not thread safe
3658 *
3659 * Parameters:
3660 *
3661 * inMenu:
3662 * The menu containing the specified item.
3663 *
3664 * inItem:
3665 * The menu item whose attributed text to retrieve.
3666 *
3667 * outText:
3668 * On exit, contains the item's attributed text, or NULL if the
3669 * item has no attributed text.
3670 *
3671 * Availability:
3672 * Mac OS X: in version 10.5 and later in Carbon.framework [32-bit only]
3673 * CarbonLib: not available
3674 * Non-Carbon CFM: not available
3675 }
HIMenuCopyAttributedItemTextnull3676 function HIMenuCopyAttributedItemText( inMenu: MenuRef; inItem: MenuItemIndex; var outText: CFAttributedStringRef ): OSStatus; external name '_HIMenuCopyAttributedItemText';
3677 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
3678
3679
3680 {
3681 * GetMenuItemIndent()
3682 *
3683 * Summary:
3684 * Gets the indent level of a menu item.
3685 *
3686 * Discussion:
3687 * The indent level of an item is an amount of extra space added to
3688 * the left of the item's icon or checkmark. The level is simply a
3689 * number, starting at zero, which the Menu Manager multiplies by a
3690 * constant to get the indent in pixels. The default indent level is
3691 * zero.
3692 *
3693 * Mac OS X threading:
3694 * Not thread safe
3695 *
3696 * Parameters:
3697 *
3698 * inMenu:
3699 * The menu containing the item.
3700 *
3701 * inItem:
3702 * The item whose indent to retrieve.
3703 *
3704 * outIndent:
3705 * On exit, the indent level of the item.
3706 *
3707 * Availability:
3708 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3709 * CarbonLib: in CarbonLib 1.1 and later
3710 * Non-Carbon CFM: not available
3711 }
GetMenuItemIndentnull3712 function GetMenuItemIndent( inMenu: MenuRef; inItem: MenuItemIndex; var outIndent: UInt32 ): OSStatus; external name '_GetMenuItemIndent';
3713 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3714
3715
3716 {
3717 * SetMenuItemIndent()
3718 *
3719 * Summary:
3720 * Sets the indent level of a menu item.
3721 *
3722 * Discussion:
3723 * The indent level of an item is an amount of extra space added to
3724 * the left of the item's icon or checkmark. The level is simply a
3725 * number, starting at zero, which the Menu Manager multiplies by a
3726 * constant to get the indent in pixels. The default indent level is
3727 * zero.
3728 *
3729 * Mac OS X threading:
3730 * Not thread safe
3731 *
3732 * Parameters:
3733 *
3734 * inMenu:
3735 * The menu containing the item.
3736 *
3737 * inItem:
3738 * The item whose indent to set.
3739 *
3740 * inIndent:
3741 * The new indent level of the item.
3742 *
3743 * Availability:
3744 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3745 * CarbonLib: in CarbonLib 1.1 and later
3746 * Non-Carbon CFM: not available
3747 }
SetMenuItemIndentnull3748 function SetMenuItemIndent( inMenu: MenuRef; inItem: MenuItemIndex; inIndent: UInt32 ): OSStatus; external name '_SetMenuItemIndent';
3749 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3750
3751
3752 {
3753 * GetMenuItemCommandKey()
3754 *
3755 * Summary:
3756 * Gets the keyboard equivalent of a menu item.
3757 *
3758 * Discussion:
3759 * A menu item's keyboard equivalent may be either a character code
3760 * or a virtual keycode. An item's character code and virtual
3761 * keycode are stored separately and may contain different values,
3762 * but only one is used by the Menu Manager at any given time. When
3763 * requesting a menu item's virtual keycode equivalent, you should
3764 * first check that the item is using a virtual keycode by testing
3765 * the kMenuItemAttrUseVirtualKey attribute for that item. If this
3766 * attribute is not set, the item's virtual keycode is ignored by
3767 * the Menu Manager. Note that zero is a valid virtual keycode, so
3768 * you cannot test the returned keycode against zero to determine if
3769 * the item is using a virtual keycode equivalent. You must test the
3770 * kMenuItemAttrUseVirtualKey attribute.
3771 *
3772 * Mac OS X threading:
3773 * Not thread safe
3774 *
3775 * Parameters:
3776 *
3777 * inMenu:
3778 * The menu containing the item.
3779 *
3780 * inItem:
3781 * The item whose keyboard equivalent to retrieve.
3782 *
3783 * inGetVirtualKey:
3784 * Indicates whether to retrieve the item's character code or
3785 * virtual keycode equivalent.
3786 *
3787 * outKey:
3788 * On exit, the keyboard equivalent of the item.
3789 *
3790 * Availability:
3791 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3792 * CarbonLib: in CarbonLib 1.1 and later
3793 * Non-Carbon CFM: not available
3794 }
GetMenuItemCommandKeynull3795 function GetMenuItemCommandKey( inMenu: MenuRef; inItem: MenuItemIndex; inGetVirtualKey: Boolean; var outKey: UInt16 ): OSStatus; external name '_GetMenuItemCommandKey';
3796 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3797
3798
3799 {
3800 * SetMenuItemCommandKey()
3801 *
3802 * Summary:
3803 * Sets the keyboard equivalent of a menu item.
3804 *
3805 * Discussion:
3806 * A menu item's keyboard equivalent may be either a character code
3807 * or a virtual keycode. The character code is always used to draw
3808 * the item's keyboard equivalent in the menu, but either a char
3809 * code or a virtual key code may be used for keyboard equivalent
3810 * matching by MenuEvent and IsMenuKeyEvent, depending on whether
3811 * the kMenuItemAttrUseVirtualKey item attribute is set. If
3812 * SetMenuItemCommandKey is used to set the virtual keycode
3813 * equivalent for a menu item, it also automatically sets the
3814 * kMenuItemAttrUseVirtualKey item attribute. To make the menu item
3815 * stop using the virtual keycode equivalent and use the character
3816 * code equivalent instead, use ChangeMenuItemAttributes to clear
3817 * the kMenuItemAttrUseVirtualKey item attribute.
3818 *
3819 * Mac OS X threading:
3820 * Not thread safe
3821 *
3822 * Parameters:
3823 *
3824 * inMenu:
3825 * The menu containing the item.
3826 *
3827 * inItem:
3828 * The item whose keyboard equivalent to set.
3829 *
3830 * inSetVirtualKey:
3831 * Indicates whether to set the item's character code or virtual
3832 * keycode equivalent. If setting a character code, the character
3833 * is assumed to be in the application's text encoding.
3834 *
3835 * inKey:
3836 * The item's new character code or virtual keycode equivalent.
3837 * Note that the character code is not a Unicode value; rather,
3838 * the character code is assumed to be expressed in the
3839 * application's text encoding. In Mac OS X 10.3 and later, the
3840 * Menu Manager also supports the following metavalues when
3841 * inSetVirtualKey is false. When receiving one of these values,
3842 * the Menu Manager automatically sets the item's keyboard
3843 * equivalent glyph code to an appropriate value using
3844 * SetMenuItemKeyGlyph.
3845 *
3846 * NSF1FunctionKey..NSF15FunctionKey
3847 * NSHomeFunctionKey
3848 * kEnterCharCode
3849 * kEndCharCode
3850 * NSEndFunctionKey
3851 * kHelpCharCode
3852 * NSHelpFunctionKey
3853 * kBackspaceCharCode
3854 * kTabCharCode
3855 * kLineFeedCharCode
3856 * kReturnCharCode
3857 * kPageUpCharCode
3858 * NSPageUpFunctionKey
3859 * kPageDownCharCode
3860 * NSPageDownFunctionKey
3861 * NSBackTabCharacter
3862 * kEscapeCharCode
3863 * NSClearDisplayFunctionKey
3864 * kLeftArrowCharCode
3865 * NSLeftArrowFunctionKey
3866 * kRightArrowCharCode
3867 * NSRightArrowFunctionKey
3868 * kUpArrowCharCode
3869 * NSUpArrowFunctionKey
3870 * kDownArrowCharCode
3871 * NSDownArrowFunctionKey
3872 * kDeleteCharCode
3873 *
3874 * In Mac OS X 10.4 and later, the Menu Manager also supports
3875 * these values:
3876 *
3877 * 0x2190..0x2193 (left, up, right, and down-arrow)
3878 * kSpaceCharCode
3879 *
3880 * In Mac OS X 10.6 and later, the Menu Manager also supports
3881 * these values:
3882 * NSF16FunctionKey..NSF19FunctionKey, NSDeleteFunctionKey
3883 *
3884 * Availability:
3885 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
3886 * CarbonLib: in CarbonLib 1.1 and later
3887 * Non-Carbon CFM: not available
3888 }
SetMenuItemCommandKeynull3889 function SetMenuItemCommandKey( inMenu: MenuRef; inItem: MenuItemIndex; inSetVirtualKey: Boolean; inKey: UInt16 ): OSStatus; external name '_SetMenuItemCommandKey';
3890 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
3891
3892
3893 {��������������������������������������������������������������������������������������}
3894 { � Menu item views }
3895 {��������������������������������������������������������������������������������������}
3896 {
3897 * HIMenuSetItemViewClass()
3898 *
3899 * Summary:
3900 * Sets the HIObject class ID and initialization event that will be
3901 * used to create a custom HIView for a menu item.
3902 *
3903 * Discussion:
3904 * When a menu item has a custom HIObject class ID associated with
3905 * it, the standard menu view automatically creates an HIView using
3906 * that class ID as necessary and inserts the view as a subview of
3907 * the standard menu view. The item view is send a
3908 * kEventControlGetOptimalBounds event to request that it calculate
3909 * its size, and if this size is larger than the size that the item
3910 * would normally have, it is used instead. The view's frame is
3911 * automatically positioned to match the frame of the item.
3912 *
3913 * An item view should be an ordinary subclass of HIView. The item
3914 * view is responsible for entirely replacing the standard menu item
3915 * content; the standard content will not be drawn. When created, an
3916 * item view's kEventHIObjectInitialize event will have two extra
3917 * parameters, kEventParamMenuRef and kEventParamMenuItemIndex, if
3918 * the view is intended for use in a menu. Note that a view should
3919 * not cache the item index from the Init event, because the item
3920 * index can change over time if menu items are inserted or deleted;
3921 * instead, a view can determine its current menu item index at any
3922 * time (except during Construct or Init handlers) by calling
3923 * HIMenuItemViewGetEnclosingMenuItem.
3924 *
3925 * This API may only be called on menus that are implemented using
3926 * an HIView. paramErr will be returned if an MDEF-based menu is
3927 * provided.
3928 *
3929 * Mac OS X threading:
3930 * Not thread safe
3931 *
3932 * Parameters:
3933 *
3934 * inMenu:
3935 * The menu for which to set the item view class.
3936 *
3937 * inItem:
3938 * The menu item for which to set the item view class.
3939 *
3940 * inClassID:
3941 * The class ID of the menu item's custom view. May be NULL to
3942 * clear the item's custom view class ID; however, any item view
3943 * that had already been created for the item will remain embedded
3944 * in the menu content view and will be used to measure and draw
3945 * the item.
3946 *
3947 * inInitEvent:
3948 * The initialization event of the menu item's custom view. May be
3949 * NULL.
3950 *
3951 * Availability:
3952 * Mac OS X: in version 10.5 and later in Carbon.framework [32-bit only]
3953 * CarbonLib: not available
3954 * Non-Carbon CFM: not available
3955 }
HIMenuSetItemViewClassnull3956 function HIMenuSetItemViewClass( inMenu: MenuRef; inItem: MenuItemIndex; inClassID: CFStringRef { can be NULL }; inInitEvent: EventRef { can be NULL } ): OSStatus; external name '_HIMenuSetItemViewClass';
3957 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
3958
3959
3960 {
3961 * HIMenuCopyItemViewClass()
3962 *
3963 * Summary:
3964 * Returns the HIObject class ID and initialization event that are
3965 * used to create a custom HIView for a menu item.
3966 *
3967 * Mac OS X threading:
3968 * Not thread safe
3969 *
3970 * Parameters:
3971 *
3972 * inMenu:
3973 * The menu for which to retrieve the item view class.
3974 *
3975 * inItem:
3976 * The menu item for which to retrieve the item view class.
3977 *
3978 * outClassID:
3979 * On exit, contains the item's custom view class ID, or NULL if
3980 * none. The caller should release this string.
3981 *
3982 * outInitEvent:
3983 * On exit, contains the item's custom view initialization event,
3984 * or NULL if none. The caller should release this event.
3985 *
3986 * Availability:
3987 * Mac OS X: in version 10.5 and later in Carbon.framework [32-bit only]
3988 * CarbonLib: not available
3989 * Non-Carbon CFM: not available
3990 }
HIMenuCopyItemViewClassnull3991 function HIMenuCopyItemViewClass( inMenu: MenuRef; inItem: MenuItemIndex; var outClassID: CFStringRef; outInitEvent: EventRefPtr { can be NULL } ): OSStatus; external name '_HIMenuCopyItemViewClass';
3992 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
3993
3994
3995 {
3996 * HIMenuGetItemView()
3997 *
3998 * Summary:
3999 * Returns the HIViewRef that will be used to draw a menu item, if
4000 * any.
4001 *
4002 * Discussion:
4003 * If the item view has not yet been created, the Menu Manager will
4004 * create the item view using the view class ID and initialization
4005 * event specified by the HIMenuSetItemViewClass API. If the menu
4006 * item does not have a custom view associated with it, noErr is
4007 * returned but outView is set to NULL.
4008 *
4009 * This API may only be called on menus that are implemented using
4010 * an HIView. paramErr will be returned if an MDEF-based menu is
4011 * provided.
4012 *
4013 * Mac OS X threading:
4014 * Not thread safe
4015 *
4016 * Parameters:
4017 *
4018 * inMenu:
4019 * The menu.
4020 *
4021 * inItem:
4022 * The menu item.
4023 *
4024 * inMenuType:
4025 *
4026 * outView:
4027 * On exit, contains the view. May be set to NULL if the item does
4028 * not have a custom item view. The caller should not release this
4029 * view.
4030 *
4031 * Availability:
4032 * Mac OS X: in version 10.5 and later in Carbon.framework [32-bit only]
4033 * CarbonLib: not available
4034 * Non-Carbon CFM: not available
4035 }
HIMenuGetItemViewnull4036 function HIMenuGetItemView( inMenu: MenuRef; inItem: MenuItemIndex; inMenuType: ThemeMenuType; var outView: HIViewRef ): OSStatus; external name '_HIMenuGetItemView';
4037 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
4038
4039
4040 {
4041 * HIMenuItemViewGetEnclosingMenuItem()
4042 *
4043 * Summary:
4044 * Locates the menu item that contains a menu item view or one of
4045 * its subviews.
4046 *
4047 * Discussion:
4048 * A custom HIView may behave differently depending on whether it's
4049 * embedded in a menu or a regular window. This API will tell the
4050 * view whether it's contained in a menu or a window. Note that this
4051 * API will always return false if called from a view's
4052 * kEventHIObjectConstruct or kEventHIObjectInitialize event
4053 * handler, even if the view is being created for use in a menu; at
4054 * Construct and Init time, the Menu Manager has not yet created the
4055 * binding between the view and the item. A view can check for
4056 * kEventParamMenuRef and kEventParamMenuItemIndex parameters in its
4057 * kEventHIObjectInitialize handler to determine at Init time
4058 * whether the view is being placed into a menu.
4059 *
4060 * This API may be passed a menu item view or any subview of the
4061 * item view. If passed a subview, it will search upwards through
4062 * the view hierarchy to look for an item view.
4063 *
4064 * Mac OS X threading:
4065 * Not thread safe
4066 *
4067 * Parameters:
4068 *
4069 * inItemView:
4070 * The item view.
4071 *
4072 * outMenu:
4073 * On exit, contains the menu in which the view is embedded. May
4074 * be NULL if you don't need the menu.
4075 *
4076 * outItem:
4077 * On exit, contains the menu item that the view is implementing.
4078 * May be NULL if you don't need the item. Note that the item
4079 * index that is returned may change over time if menu items are
4080 * inserted or deleted; generally, a view should not cache the
4081 * item index, but should call this API each time that it needs to
4082 * know its current item.
4083 *
4084 * Result:
4085 * true if the view is embedded in a menu, or false if not.
4086 *
4087 * Availability:
4088 * Mac OS X: in version 10.5 and later in Carbon.framework [32-bit only]
4089 * CarbonLib: not available
4090 * Non-Carbon CFM: not available
4091 }
HIMenuItemViewGetEnclosingMenuItemnull4092 function HIMenuItemViewGetEnclosingMenuItem( inItemView: HIViewRef; outMenu: MenuRefPtr { can be NULL }; outItem: MenuItemIndexPtr { can be NULL } ): Boolean; external name '_HIMenuItemViewGetEnclosingMenuItem';
4093 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
4094
4095
4096 {
4097 * HIMenuItemViewCancelMenuTracking()
4098 *
4099 * Summary:
4100 * Cancels menu tracking for the menu containing an item view.
4101 *
4102 * Discussion:
4103 * In order to call the CancelMenuTracking API, you must know the
4104 * menu that is the root for the menu tracking session. This root
4105 * menu is often not available to a custom menu item view. This API
4106 * allows a menu item view to cancel tracking without knowing the
4107 * root menu.
4108 *
4109 * Mac OS X threading:
4110 * Not thread safe
4111 *
4112 * Parameters:
4113 *
4114 * inItemView:
4115 * The item view.
4116 *
4117 * inImmediate:
4118 * Whether the open menus should disappear immediately or fade out.
4119 *
4120 * inDismissalReason:
4121 * Why the menu is being dismissed; this value will be added to
4122 * the kEventMenuEndTracking event. If zero,
4123 * kHIMenuDismissedByCancelMenuTracking is added to the
4124 * EndTracking event.
4125 *
4126 * Availability:
4127 * Mac OS X: in version 10.5 and later in Carbon.framework [32-bit only]
4128 * CarbonLib: not available
4129 * Non-Carbon CFM: not available
4130 }
HIMenuItemViewCancelMenuTrackingnull4131 function HIMenuItemViewCancelMenuTracking( inItemView: HIViewRef; inImmediate: Boolean; inDismissalReason: UInt32 ): OSStatus; external name '_HIMenuItemViewCancelMenuTracking';
4132 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
4133
4134
4135 {��������������������������������������������������������������������������������������}
4136 { � Properties (Mac OS 8.5 and later) }
4137 { With the following property APIs, you can attach any piece of data you'd like to a }
4138 { menu or menu item. Passing zero for the item number parameter indicates you'd like }
4139 { to attach the data to the menu itself, and not to any specific menu item. }
4140 {��������������������������������������������������������������������������������������}
4141 {$endc} {not TARGET_CPU_64}
4142
4143 const
4144 kMenuPropertyPersistent = $00000001; { whether this property gets saved when archiving the menu; however, ignored in Mac OS X 10.4}
4145
4146 {$ifc not TARGET_CPU_64}
4147 {
4148 * GetMenuItemProperty()
4149 *
4150 * Mac OS X threading:
4151 * Not thread safe
4152 *
4153 * Availability:
4154 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4155 * CarbonLib: in CarbonLib 1.0 and later
4156 * Non-Carbon CFM: in MenusLib 8.5 and later
4157 }
GetMenuItemPropertynull4158 function GetMenuItemProperty( menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType; bufferSize: ByteCount; var actualSize: ByteCount; propertyBuffer: UnivPtr ): OSStatus; external name '_GetMenuItemProperty';
4159 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4160
4161
4162 {
4163 * GetMenuItemPropertySize()
4164 *
4165 * Mac OS X threading:
4166 * Not thread safe
4167 *
4168 * Availability:
4169 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4170 * CarbonLib: in CarbonLib 1.0 and later
4171 * Non-Carbon CFM: in MenusLib 8.5 and later
4172 }
GetMenuItemPropertySizenull4173 function GetMenuItemPropertySize( menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType; var size: ByteCount ): OSStatus; external name '_GetMenuItemPropertySize';
4174 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4175
4176
4177 {
4178 * SetMenuItemProperty()
4179 *
4180 * Mac OS X threading:
4181 * Not thread safe
4182 *
4183 * Availability:
4184 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4185 * CarbonLib: in CarbonLib 1.0 and later
4186 * Non-Carbon CFM: in MenusLib 8.5 and later
4187 }
SetMenuItemPropertynull4188 function SetMenuItemProperty( menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType; propertySize: ByteCount; propertyData: {const} UnivPtr ): OSStatus; external name '_SetMenuItemProperty';
4189 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4190
4191
4192 {
4193 * RemoveMenuItemProperty()
4194 *
4195 * Mac OS X threading:
4196 * Not thread safe
4197 *
4198 * Availability:
4199 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4200 * CarbonLib: in CarbonLib 1.0 and later
4201 * Non-Carbon CFM: in MenusLib 8.5 and later
4202 }
RemoveMenuItemPropertynull4203 function RemoveMenuItemProperty( menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType ): OSStatus; external name '_RemoveMenuItemProperty';
4204 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4205
4206
4207 {
4208 * GetMenuItemPropertyAttributes()
4209 *
4210 * Summary:
4211 * Gets the attributes of a menu item property.
4212 *
4213 * Mac OS X threading:
4214 * Not thread safe
4215 *
4216 * Parameters:
4217 *
4218 * menu:
4219 * The menu.
4220 *
4221 * item:
4222 * The menu item.
4223 *
4224 * propertyCreator:
4225 * The creator code of the property.
4226 *
4227 * propertyTag:
4228 * The property tag.
4229 *
4230 * attributes:
4231 * On exit, contains the attributes of the property.
4232 *
4233 * Availability:
4234 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4235 * CarbonLib: in CarbonLib 1.0 and later
4236 * Non-Carbon CFM: not available
4237 }
GetMenuItemPropertyAttributesnull4238 function GetMenuItemPropertyAttributes( menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType; var attributes: OptionBits ): OSStatus; external name '_GetMenuItemPropertyAttributes';
4239 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4240
4241
4242 {
4243 * ChangeMenuItemPropertyAttributes()
4244 *
4245 * Summary:
4246 * Changes the attributes of a menu item property.
4247 *
4248 * Mac OS X threading:
4249 * Not thread safe
4250 *
4251 * Parameters:
4252 *
4253 * menu:
4254 * The menu.
4255 *
4256 * item:
4257 * The menu item.
4258 *
4259 * propertyCreator:
4260 * The creator code of the property.
4261 *
4262 * propertyTag:
4263 * The property tag.
4264 *
4265 * attributesToSet:
4266 * The attributes to add to the menu item property.
4267 *
4268 * attributesToClear:
4269 * The attributes to remove from the menu item property.
4270 *
4271 * Availability:
4272 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4273 * CarbonLib: in CarbonLib 1.0 and later
4274 * Non-Carbon CFM: not available
4275 }
ChangeMenuItemPropertyAttributesnull4276 function ChangeMenuItemPropertyAttributes( menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType; attributesToSet: OptionBits; attributesToClear: OptionBits ): OSStatus; external name '_ChangeMenuItemPropertyAttributes';
4277 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4278
4279
4280 {��������������������������������������������������������������������������������������}
4281 { � Attributes (Carbon and later) }
4282 { Each menu and menu item has attribute flags. }
4283 {��������������������������������������������������������������������������������������}
4284 {
4285 * GetMenuAttributes()
4286 *
4287 * Summary:
4288 * Gets the attributes of a menu.
4289 *
4290 * Mac OS X threading:
4291 * Not thread safe
4292 *
4293 * Parameters:
4294 *
4295 * menu:
4296 * The menu.
4297 *
4298 * outAttributes:
4299 * On exit, contains the attributes of the menu.
4300 *
4301 * Availability:
4302 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4303 * CarbonLib: in CarbonLib 1.0 and later
4304 * Non-Carbon CFM: not available
4305 }
GetMenuAttributesnull4306 function GetMenuAttributes( menu: MenuRef; var outAttributes: MenuAttributes ): OSStatus; external name '_GetMenuAttributes';
4307 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4308
4309
4310 {
4311 * ChangeMenuAttributes()
4312 *
4313 * Summary:
4314 * Changes the attributes of a menu.
4315 *
4316 * Mac OS X threading:
4317 * Not thread safe
4318 *
4319 * Parameters:
4320 *
4321 * menu:
4322 * The menu.
4323 *
4324 * setTheseAttributes:
4325 * The attributes to add to the menu.
4326 *
4327 * clearTheseAttributes:
4328 * The attributes to remove from the menu.
4329 *
4330 * Availability:
4331 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4332 * CarbonLib: in CarbonLib 1.0 and later
4333 * Non-Carbon CFM: not available
4334 }
ChangeMenuAttributesnull4335 function ChangeMenuAttributes( menu: MenuRef; setTheseAttributes: MenuAttributes; clearTheseAttributes: MenuAttributes ): OSStatus; external name '_ChangeMenuAttributes';
4336 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4337
4338
4339 {
4340 * GetMenuItemAttributes()
4341 *
4342 * Summary:
4343 * Gets the attributes of a menu item.
4344 *
4345 * Mac OS X threading:
4346 * Not thread safe
4347 *
4348 * Parameters:
4349 *
4350 * menu:
4351 * The menu.
4352 *
4353 * item:
4354 * The menu item.
4355 *
4356 * outAttributes:
4357 * On exit, contains the attributes of the menu item.
4358 *
4359 * Availability:
4360 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4361 * CarbonLib: in CarbonLib 1.0 and later
4362 * Non-Carbon CFM: not available
4363 }
GetMenuItemAttributesnull4364 function GetMenuItemAttributes( menu: MenuRef; item: MenuItemIndex; var outAttributes: MenuItemAttributes ): OSStatus; external name '_GetMenuItemAttributes';
4365 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4366
4367
4368 {
4369 * ChangeMenuItemAttributes()
4370 *
4371 * Summary:
4372 * Changes the attributes of a menu item.
4373 *
4374 * Mac OS X threading:
4375 * Not thread safe
4376 *
4377 * Parameters:
4378 *
4379 * menu:
4380 * The menu.
4381 *
4382 * item:
4383 * The menu item.
4384 *
4385 * setTheseAttributes:
4386 * The attributes to add to the menu item.
4387 *
4388 * clearTheseAttributes:
4389 * The attributes to remove from the menu item.
4390 *
4391 * Availability:
4392 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4393 * CarbonLib: in CarbonLib 1.0 and later
4394 * Non-Carbon CFM: not available
4395 }
ChangeMenuItemAttributesnull4396 function ChangeMenuItemAttributes( menu: MenuRef; item: MenuItemIndex; setTheseAttributes: MenuItemAttributes; clearTheseAttributes: MenuItemAttributes ): OSStatus; external name '_ChangeMenuItemAttributes';
4397 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4398
4399
4400 {��������������������������������������������������������������������������������������}
4401 { � Mass menu item enabling and disabling (Carbon and later) }
4402 { Useful when rewriting code that modifies the enableFlags field directly. }
4403 {��������������������������������������������������������������������������������������}
4404 {
4405 * DisableAllMenuItems()
4406 *
4407 * Summary:
4408 * Disables all items in a menu.
4409 *
4410 * Discussion:
4411 * This API is equivalent to pre-Carbon code that masked the
4412 * enableFlags field of the MenuInfo with 0x01. It disables all
4413 * items (including items past item 31) but does not affect the
4414 * state of the menu title.
4415 *
4416 * Mac OS X threading:
4417 * Not thread safe
4418 *
4419 * Parameters:
4420 *
4421 * theMenu:
4422 * The menu whose items to disable.
4423 *
4424 * Availability:
4425 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4426 * CarbonLib: in CarbonLib 1.0 and later
4427 * Non-Carbon CFM: not available
4428 }
4429 procedure DisableAllMenuItems( theMenu: MenuRef ); external name '_DisableAllMenuItems';
4430 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4431
4432
4433 {
4434 * EnableAllMenuItems()
4435 *
4436 * Summary:
4437 * Enables all items in a menu.
4438 *
4439 * Discussion:
4440 * This API is equivalent to pre-Carbon code that or'd the
4441 * enableFlags field of the MenuInfo with 0xFFFFFFFE. It enables all
4442 * items (including items past item 31) but does not affect the
4443 * state of the menu title.
4444 *
4445 * Mac OS X threading:
4446 * Not thread safe
4447 *
4448 * Parameters:
4449 *
4450 * theMenu:
4451 * The menu whose items to enable.
4452 *
4453 * Availability:
4454 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4455 * CarbonLib: in CarbonLib 1.0 and later
4456 * Non-Carbon CFM: not available
4457 }
4458 procedure EnableAllMenuItems( theMenu: MenuRef ); external name '_EnableAllMenuItems';
4459 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4460
4461
4462 {
4463 * MenuHasEnabledItems()
4464 *
4465 * Summary:
4466 * Determines if any items in a menu are enabled.
4467 *
4468 * Discussion:
4469 * This API is equivalent to pre-Carbon code that compared the
4470 * enableFlags field of the MenuInfo with 0. It checks the enable
4471 * state of all items to see if any are enabled, but ignores the
4472 * state of the menu title. It will return true even if the menu
4473 * title is disabled.
4474 *
4475 * Mac OS X threading:
4476 * Not thread safe
4477 *
4478 * Parameters:
4479 *
4480 * theMenu:
4481 * The menu whose items to examine.
4482 *
4483 * Availability:
4484 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4485 * CarbonLib: in CarbonLib 1.0 and later
4486 * Non-Carbon CFM: not available
4487 }
MenuHasEnabledItemsnull4488 function MenuHasEnabledItems( theMenu: MenuRef ): Boolean; external name '_MenuHasEnabledItems';
4489 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4490
4491
4492 {��������������������������������������������������������������������������������������}
4493 { � Menu tracking status (Carbon and later) }
4494 { Get info about the selected menu item during menu tracking. Replaces direct access }
4495 { to low-mem globals that previously held this info. }
4496 {��������������������������������������������������������������������������������������}
4497 {$endc} {not TARGET_CPU_64}
4498
4499 {
4500 * GetMenuTrackingData()
4501 *
4502 * Summary:
4503 * Gets information about the menu currently selected by the user.
4504 *
4505 * Discussion:
4506 * This API replaces direct access to the low-memory globals
4507 * TopMenuItem, AtMenuBottom, MenuDisable, and mbSaveLoc. It is only
4508 * valid to call this API while menu tracking is occurring. This API
4509 * will most commonly be used by custom MDEFs.
4510 *
4511 * Mac OS X threading:
4512 * Not thread safe
4513 *
4514 * Parameters:
4515 *
4516 * theMenu:
4517 * The menu about which to get tracking information. May be NULL
4518 * to get information about the menu that the user is currently
4519 * selecting. If the menu is not currently open, menuNotFoundErr
4520 * is returned.
4521 *
4522 * outData:
4523 * On exit, contains tracking data about the menu. On CarbonLib,
4524 * the itemRect field is not supported and is always set to an
4525 * empty rect.
4526 *
4527 * Availability:
4528 * Mac OS X: in version 10.0 and later in Carbon.framework
4529 * CarbonLib: in CarbonLib 1.0 and later
4530 * Non-Carbon CFM: not available
4531 }
GetMenuTrackingDatanull4532 function GetMenuTrackingData( theMenu: MenuRef; var outData: MenuTrackingData ): OSStatus; external name '_GetMenuTrackingData';
4533 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4534
4535
4536 {$ifc not TARGET_CPU_64}
4537 {
4538 * GetMenuType()
4539 *
4540 * Summary:
4541 * Gets the display type (pulldown, hierarchical, or popup) of a
4542 * menu.
4543 *
4544 * Discussion:
4545 * This API may only be called when the menu is displayed. If the
4546 * menu is not currently open, an error is returned. The display
4547 * type of a menu may vary from one menu tracking session to
4548 * another; for example, the same menu might be displayed as a
4549 * pulldown menu and as a popup menu.
4550 *
4551 * Mac OS X threading:
4552 * Not thread safe
4553 *
4554 * Parameters:
4555 *
4556 * theMenu:
4557 * The menu whose type to get.
4558 *
4559 * outType:
4560 * On exit, the type of the menu. The returned value will be one
4561 * of the ThemeMenuType constants: kThemeMenuTypePullDown, PopUp,
4562 * or Hierarchical. The kThemeMenuTypeInactive bit will never be
4563 * set.
4564 *
4565 * Availability:
4566 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4567 * CarbonLib: in CarbonLib 1.1 and later
4568 * Non-Carbon CFM: not available
4569 }
GetMenuTypenull4570 function GetMenuType( theMenu: MenuRef; var outType: UInt16 ): OSStatus; external name '_GetMenuType';
4571 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4572
4573
4574 {��������������������������������������������������������������������������������������}
4575 { ��Universal command ID access (Carbon and later) }
4576 { These APIs allow you to operate on menu items strictly by command ID, with no }
4577 { knowledge of a menu item's index. }
4578 {��������������������������������������������������������������������������������������}
4579 {
4580 * CountMenuItemsWithCommandID()
4581 *
4582 * Summary:
4583 * Counts the menu items with a specified command ID.
4584 *
4585 * Discussion:
4586 * In CarbonLib 1.0.x and 1.1, this API always returns zero or one;
4587 * it stops after finding the first menu item with the specified
4588 * command ID. In CarbonLib 1.2 and Mac OS X 10.0 and later, it
4589 * counts all menu items with the specified command ID. In Mac OS X
4590 * 10.0 and CarbonLib 1.0 through 1.4, this API only searches
4591 * top-level menus (menus visible in the menubar) and submenus of
4592 * top-level menus. It does not search hierarchical menus that are
4593 * inserted in the menubar but are not submenus of a top-level menus
4594 * (for example, it does not search menus that are inserted for use
4595 * in a popup menu control). In Mac OS X 10.1 and CarbonLib 1.5 and
4596 * later, this API also searches inserted hierarchical menus.
4597 *
4598 * Mac OS X threading:
4599 * Not thread safe
4600 *
4601 * Parameters:
4602 *
4603 * inMenu:
4604 * The menu in which to begin searching for items with the
4605 * specified command ID. Pass NULL to hegin searching with the
4606 * root menu. The search will descend into all submenus of this
4607 * menu.
4608 *
4609 * inCommandID:
4610 * The command ID for which to search.
4611 *
4612 * Availability:
4613 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4614 * CarbonLib: in CarbonLib 1.0 and later
4615 * Non-Carbon CFM: not available
4616 }
CountMenuItemsWithCommandIDnull4617 function CountMenuItemsWithCommandID( inMenu: MenuRef; inCommandID: MenuCommand ): ItemCount; external name '_CountMenuItemsWithCommandID';
4618 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4619
4620
4621 {
4622 * GetIndMenuItemWithCommandID()
4623 *
4624 * Summary:
4625 * Finds a menu item with a specified command ID.
4626 *
4627 * Discussion:
4628 * This API searches the specified menu and its submenus for the
4629 * n'th menu item with the specified command ID. In CarbonLib 1.0.x
4630 * and 1.1, only the first menu item is returned. In CarbonLib 1.2
4631 * and Mac OS X 10.0 and later, this API iterates over all menu
4632 * items with the specified command ID. In Mac OS X 10.0 and
4633 * CarbonLib 1.0 through 1.4, this API only searches top-level menus
4634 * (menus visible in the menubar) and submenus of top-level menus.
4635 * It does not search hierarchical menus that are inserted in the
4636 * menubar but are not submenus of a top-level menus (for example,
4637 * it does not search menus that are inserted for use in a popup
4638 * menu control). In Mac OS X 10.1 and CarbonLib 1.5 and later, this
4639 * API also searches inserted hierarchical menus.
4640 *
4641 * Mac OS X threading:
4642 * Not thread safe
4643 *
4644 * Parameters:
4645 *
4646 * inMenu:
4647 * The menu in which to begin searching for items with the
4648 * specified command ID. Pass NULL to hegin searching with the
4649 * root menu. The search will descend into all submenus of this
4650 * menu.
4651 *
4652 * inCommandID:
4653 * The command ID for which to search.
4654 *
4655 * inItemIndex:
4656 * The 1-based index of the menu item to retrieve. In CarbonLib
4657 * 1.0.x and 1.1, this parameter must be 1. In CarbonLib 1.2 and
4658 * Mac OS X 10.0, this parameter may vary from 1 to the number of
4659 * menu items with the specified command ID.
4660 *
4661 * outMenu:
4662 * On exit, the menu containing the menu item with the specified
4663 * command ID.
4664 *
4665 * outIndex:
4666 * On exit, the item index of the menu item with the specified
4667 * command ID.
4668 *
4669 * Availability:
4670 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4671 * CarbonLib: in CarbonLib 1.0 and later
4672 * Non-Carbon CFM: not available
4673 }
GetIndMenuItemWithCommandIDnull4674 function GetIndMenuItemWithCommandID( inMenu: MenuRef; inCommandID: MenuCommand; inItemIndex: UInt32; outMenu: MenuRefPtr { can be NULL }; outIndex: MenuItemIndexPtr { can be NULL } ): OSStatus; external name '_GetIndMenuItemWithCommandID';
4675 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4676
4677
4678 {
4679 * EnableMenuCommand()
4680 *
4681 * Summary:
4682 * Enables the menu item with a specified command ID.
4683 *
4684 * Mac OS X threading:
4685 * Not thread safe
4686 *
4687 * Parameters:
4688 *
4689 * inMenu:
4690 * The menu in which to begin searching for the item. Pass NULL to
4691 * begin searching with the root menu. The search will descend
4692 * into all submenus of this menu.
4693 *
4694 * inCommandID:
4695 * The command ID of the menu item to be enabled. If more than one
4696 * item has this command ID, only the first will be enabled.
4697 *
4698 * Availability:
4699 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4700 * CarbonLib: in CarbonLib 1.0 and later
4701 * Non-Carbon CFM: not available
4702 }
4703 procedure EnableMenuCommand( inMenu: MenuRef; inCommandID: MenuCommand ); external name '_EnableMenuCommand';
4704 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4705
4706
4707 {
4708 * DisableMenuCommand()
4709 *
4710 * Summary:
4711 * Disables the menu item with a specified command ID.
4712 *
4713 * Mac OS X threading:
4714 * Not thread safe
4715 *
4716 * Parameters:
4717 *
4718 * inMenu:
4719 * The menu in which to begin searching for the item. Pass NULL to
4720 * begin searching with the root menu. The search will descend
4721 * into all submenus of this menu.
4722 *
4723 * inCommandID:
4724 * The command ID of the menu item to be disabled. If more than
4725 * one item has this command ID, only the first will be disabled.
4726 *
4727 * Availability:
4728 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4729 * CarbonLib: in CarbonLib 1.0 and later
4730 * Non-Carbon CFM: not available
4731 }
4732 procedure DisableMenuCommand( inMenu: MenuRef; inCommandID: MenuCommand ); external name '_DisableMenuCommand';
4733 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4734
4735
4736 {
4737 * IsMenuCommandEnabled()
4738 *
4739 * Summary:
4740 * Determines if the menu item with a specified command ID is
4741 * enabled.
4742 *
4743 * Mac OS X threading:
4744 * Not thread safe
4745 *
4746 * Parameters:
4747 *
4748 * inMenu:
4749 * The menu in which to begin searching for the item. Pass NULL to
4750 * begin searching with the root menu. The search will descend
4751 * into all submenus of this menu.
4752 *
4753 * inCommandID:
4754 * The command ID of the menu item to examine. If more than one
4755 * item has this command ID, only the first will be examined.
4756 *
4757 * Availability:
4758 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4759 * CarbonLib: in CarbonLib 1.0 and later
4760 * Non-Carbon CFM: not available
4761 }
IsMenuCommandEnablednull4762 function IsMenuCommandEnabled( inMenu: MenuRef; inCommandID: MenuCommand ): Boolean; external name '_IsMenuCommandEnabled';
4763 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4764
4765
4766 {
4767 * SetMenuCommandMark()
4768 *
4769 * Summary:
4770 * Locates the menu item with a specified command ID and sets its
4771 * mark character.
4772 *
4773 * Mac OS X threading:
4774 * Not thread safe
4775 *
4776 * Parameters:
4777 *
4778 * inMenu:
4779 * The menu in which to begin searching for the item. Pass NULL to
4780 * begin searching with the root menu. The search will descend
4781 * into all submenus of this menu.
4782 *
4783 * inCommandID:
4784 * The command ID of the menu item to be modified. If more than
4785 * one item has this command ID, only the first will be modified.
4786 *
4787 * inMark:
4788 * The new mark character. Although the type of this parameter is
4789 * UniChar, currently only the low byte of this character will be
4790 * used as the mark character, and it is interpreted using the
4791 * application�s text encoding.
4792 *
4793 * Availability:
4794 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4795 * CarbonLib: in CarbonLib 1.1 and later
4796 * Non-Carbon CFM: not available
4797 }
SetMenuCommandMarknull4798 function SetMenuCommandMark( inMenu: MenuRef; inCommandID: MenuCommand; inMark: UniChar ): OSStatus; external name '_SetMenuCommandMark';
4799 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4800
4801
4802 {
4803 * GetMenuCommandMark()
4804 *
4805 * Summary:
4806 * Locates the menu item with a specified command ID and returns its
4807 * mark character.
4808 *
4809 * Mac OS X threading:
4810 * Not thread safe
4811 *
4812 * Parameters:
4813 *
4814 * inMenu:
4815 * The menu in which to begin searching for the item. Pass NULL to
4816 * begin searching with the root menu. The search will descend
4817 * into all submenus of this menu.
4818 *
4819 * inCommandID:
4820 * The command ID of the menu item to be examined. If more than
4821 * one item has this command ID, only the first will be examined.
4822 *
4823 * outMark:
4824 * On exit, the menu item's mark character.
4825 *
4826 * Availability:
4827 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4828 * CarbonLib: in CarbonLib 1.1 and later
4829 * Non-Carbon CFM: not available
4830 }
GetMenuCommandMarknull4831 function GetMenuCommandMark( inMenu: MenuRef; inCommandID: MenuCommand; var outMark: UniChar ): OSStatus; external name '_GetMenuCommandMark';
4832 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4833
4834
4835 {
4836 * GetMenuCommandProperty()
4837 *
4838 * Summary:
4839 * Retrives property data for a menu item with a specified command
4840 * ID.
4841 *
4842 * Mac OS X threading:
4843 * Not thread safe
4844 *
4845 * Parameters:
4846 *
4847 * inMenu:
4848 * The menu in which to begin searching for the item. Pass NULL to
4849 * begin searching with the root menu. The search will descend
4850 * into all submenus of this menu.
4851 *
4852 * inCommandID:
4853 * The command ID of the menu item containing the property. If
4854 * more than one item has this command ID, only the first will be
4855 * used.
4856 *
4857 * inPropertyCreator:
4858 * The property creator.
4859 *
4860 * inPropertyTag:
4861 * The property tag.
4862 *
4863 * inBufferSize:
4864 * The size of the output buffer, in bytes.
4865 *
4866 * outActualSize:
4867 * On exit, contains the actual size of the property data. May be
4868 * NULL if you do not need this information.
4869 *
4870 * inPropertyBuffer:
4871 * The address of a buffer in which to place the property data.
4872 *
4873 * Availability:
4874 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4875 * CarbonLib: in CarbonLib 1.0 and later
4876 * Non-Carbon CFM: not available
4877 }
GetMenuCommandPropertynull4878 function GetMenuCommandProperty( inMenu: MenuRef; inCommandID: MenuCommand; inPropertyCreator: OSType; inPropertyTag: OSType; inBufferSize: ByteCount; outActualSize: ByteCountPtr { can be NULL }; inPropertyBuffer: UnivPtr ): OSStatus; external name '_GetMenuCommandProperty';
4879 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4880
4881
4882 {
4883 * GetMenuCommandPropertySize()
4884 *
4885 * Summary:
4886 * Retrives the size of property data for a menu item with a
4887 * specified command ID.
4888 *
4889 * Mac OS X threading:
4890 * Not thread safe
4891 *
4892 * Parameters:
4893 *
4894 * inMenu:
4895 * The menu in which to begin searching for the item. Pass NULL to
4896 * begin searching with the root menu. The search will descend
4897 * into all submenus of this menu.
4898 *
4899 * inCommandID:
4900 * The command ID of the menu item containing the property. If
4901 * more than one item has this command ID, only the first will be
4902 * used.
4903 *
4904 * inPropertyCreator:
4905 * The property creator.
4906 *
4907 * inPropertyTag:
4908 * The property tag.
4909 *
4910 * outSize:
4911 * On exit, contains the size of the property data.
4912 *
4913 * Availability:
4914 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4915 * CarbonLib: in CarbonLib 1.0 and later
4916 * Non-Carbon CFM: not available
4917 }
GetMenuCommandPropertySizenull4918 function GetMenuCommandPropertySize( inMenu: MenuRef; inCommandID: MenuCommand; inPropertyCreator: OSType; inPropertyTag: OSType; var outSize: ByteCount ): OSStatus; external name '_GetMenuCommandPropertySize';
4919 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4920
4921
4922 {
4923 * SetMenuCommandProperty()
4924 *
4925 * Summary:
4926 * Sets property data for a menu item with a specified command ID.
4927 *
4928 * Mac OS X threading:
4929 * Not thread safe
4930 *
4931 * Parameters:
4932 *
4933 * inMenu:
4934 * The menu in which to begin searching for the item. Pass NULL to
4935 * begin searching with the root menu. The search will descend
4936 * into all submenus of this menu.
4937 *
4938 * inCommandID:
4939 * The command ID of the menu item that will receive the property.
4940 * If more than one item has this command ID, only the first will
4941 * be modified.
4942 *
4943 * inPropertyCreator:
4944 * The property creator.
4945 *
4946 * inPropertyTag:
4947 * The property tag.
4948 *
4949 * inPropertySize:
4950 * The size of the property data, in bytes.
4951 *
4952 * inPropertyData:
4953 * The address of the property data.
4954 *
4955 * Availability:
4956 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4957 * CarbonLib: in CarbonLib 1.0 and later
4958 * Non-Carbon CFM: not available
4959 }
SetMenuCommandPropertynull4960 function SetMenuCommandProperty( inMenu: MenuRef; inCommandID: MenuCommand; inPropertyCreator: OSType; inPropertyTag: OSType; inPropertySize: ByteCount; inPropertyData: {const} UnivPtr ): OSStatus; external name '_SetMenuCommandProperty';
4961 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4962
4963
4964 {
4965 * RemoveMenuCommandProperty()
4966 *
4967 * Summary:
4968 * Removes a property from a menu item with a specified command ID.
4969 *
4970 * Mac OS X threading:
4971 * Not thread safe
4972 *
4973 * Parameters:
4974 *
4975 * inMenu:
4976 * The menu in which to begin searching for the item. Pass NULL to
4977 * begin searching with the root menu. The search will descend
4978 * into all submenus of this menu.
4979 *
4980 * inCommandID:
4981 * The command ID of the menu item from which the property will be
4982 * removed. If more than one item has this command ID, only the
4983 * first will be modified.
4984 *
4985 * inPropertyCreator:
4986 * The property creator.
4987 *
4988 * inPropertyTag:
4989 * The property tag.
4990 *
4991 * Availability:
4992 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
4993 * CarbonLib: in CarbonLib 1.0 and later
4994 * Non-Carbon CFM: not available
4995 }
RemoveMenuCommandPropertynull4996 function RemoveMenuCommandProperty( inMenu: MenuRef; inCommandID: MenuCommand; inPropertyCreator: OSType; inPropertyTag: OSType ): OSStatus; external name '_RemoveMenuCommandProperty';
4997 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
4998
4999
5000 {
5001 * CopyMenuItemData()
5002 *
5003 * Summary:
5004 * Returns multiple attributes of a menu item at once.
5005 *
5006 * Discussion:
5007 * This function is used to retrieve many attributes of a menu item
5008 * simultaneously; for example, it might be used by a menu
5009 * definition function that needs to know how to draw a menu item.
5010 * It is more efficient to use this function than to use the
5011 * accessor functions for the individual attributes of the menu.
5012 * This function returns a copy of the data in the menu, so any data
5013 * in the MenuItemDataRec that is dynamically allocated (for
5014 * example, the CFString item text) should be released by the caller.
5015 *
5016 * Mac OS X threading:
5017 * Not thread safe
5018 *
5019 * Parameters:
5020 *
5021 * inMenu:
5022 * The menu from which to copy data. If inIsCommandID is true, you
5023 * may pass NULL for this parameter to search for an item in the
5024 * root menu; if inIsCommandID is false, this parameter must be a
5025 * valid MenuRef.
5026 *
5027 * inItem:
5028 * The item or command ID from which to copy data.
5029 *
5030 * inIsCommandID:
5031 * Indicates whether inItem is a MenuItemIndex or MenuCommand. If
5032 * inIsCommandID is true, the inItem parameter is interpreted as a
5033 * menu command ID, and data is copied from the first item in the
5034 * menu with that command ID. If inIsCommandID is false, the
5035 * inItem parameter is interpreted as a menu item index, and data
5036 * is copied for that item in the specified menu.
5037 *
5038 * ioData:
5039 * Data is copied from the item and placed here. On entry, the
5040 * whichData field of this structure should be initialized to
5041 * indicate which data the caller would like returned. Individual
5042 * fields of the MenuItemDataRec structure may require
5043 * pre-initialization also; see the individual MenuItemDataFlags
5044 * documentation for details.
5045 *
5046 * Availability:
5047 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
5048 * CarbonLib: in CarbonLib 1.1 and later
5049 * Non-Carbon CFM: not available
5050 }
CopyMenuItemDatanull5051 function CopyMenuItemData( inMenu: MenuRef { can be NULL }; inItem: MenuItemID; inIsCommandID: Boolean; ioData: MenuItemDataPtr ): OSStatus; external name '_CopyMenuItemData';
5052 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
5053
5054
5055 {
5056 * SetMenuItemData()
5057 *
5058 * Summary:
5059 * Sets multiple attributes of a menu item at once.
5060 *
5061 * Discussion:
5062 * This function is used to set many attributes of a menu item
5063 * simultaneously. It is more efficient to use this function than to
5064 * use the accessor functions for the individual attributes of the
5065 * menu.
5066 *
5067 * Mac OS X threading:
5068 * Not thread safe
5069 *
5070 * Parameters:
5071 *
5072 * inMenu:
5073 * The menu to modify.
5074 *
5075 * inItem:
5076 * The item or command ID to modify.
5077 *
5078 * inIsCommandID:
5079 * Indicates whether inItem is a MenuItemIndex or MenuCommand. If
5080 * inIsCommandID is true, the inItem parameter is interpreted as a
5081 * menu command ID, and the first item in the menu with that
5082 * command ID. is modified. If inIsCommandID is false, the inItem
5083 * parameter is interpreted as a menu item index, and the item
5084 * with that index in the specified menu is modified.
5085 *
5086 * inData:
5087 * The data to set. The caller should set the whichData field of
5088 * this structure to indicate which data should be set. Only the
5089 * fields of the structure corresponding to the non-zero whichData
5090 * flags must be initialized; other fields are ignored.
5091 *
5092 * Availability:
5093 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
5094 * CarbonLib: in CarbonLib 1.1 and later
5095 * Non-Carbon CFM: not available
5096 }
SetMenuItemDatanull5097 function SetMenuItemData( inMenu: MenuRef; inItem: MenuItemID; inIsCommandID: Boolean; const (*var*) inData: MenuItemDataRec ): OSStatus; external name '_SetMenuItemData';
5098 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
5099
5100
5101 {��������������������������������������������������������������������������������������}
5102 { � Dynamic menu item support (available in CarbonLib 1.1 and Mac OS X) }
5103 { Dynamic menu item support allows a menu item to be redrawn while the menu is open }
5104 { and visible to the user. Carbon contains automatic support for dynamic items based }
5105 { on keyboard modifier state. If you need to implement your own variable item state }
5106 { based on other system state, you can use these APIs to implement it. }
5107 { To use the built-in support for dynamic items, you should create a menu containing }
5108 { several contiguous items with the same command key but different text and modifier }
5109 { keys. For example, you might have: }
5110 { Close cmd-W }
5111 { Close All cmd-option-W }
5112 { The Menu Manager automatically determines a dynamic menu group using the base }
5113 { command key of a dynamic menu item ('W' in this case). Only a single item from }
5114 { a dynamic group is visible at any time; the other items are hidden. The Menu }
5115 { Manager uses the current keyboard modifiers to determine which item is visible. }
5116 { It is also possible to have a dynamic menu item group that does not have command }
5117 { keys, but only modifiers; for example, in the Finder's View menu, the Clean Up }
5118 { and Clean Up Selection items have no command key, but are a dynamic menu item }
5119 { group that changes visibility based on the Option modifier key. }
5120 { In this example, in your MENU resource, you would create the Close and Close All }
5121 { items and give them each the letter 'W' as the command key; using an associated }
5122 { xmnu resource, you would specify kMenuOptionModifier as the modifier for the }
5123 { Close All item. You can do the same thing using InterfacerBuilder and nib-based }
5124 { menus. }
5125 { After loading your menu from the resource, you must set the kMenuItemAttrDynamic }
5126 { flag for each dynamic item. In this example, you would use: }
5127 { ChangeMenuItemAttributes( menu, kCloseItem, kMenuItemAttrDynamic, 0 ); }
5128 { ChangeMenuItemAttributes( menu, kCloseAllItem, kMenuItemAttrDynamic, 0 ); }
5129 { The Menu Manager will now automatically display the correct item depending on }
5130 { whether the Option key is pressed. The result from MenuSelect will be the item }
5131 { number of the item that was visible when the menu closed. }
5132 { Note that: }
5133 { - If you use InterfacerBuilder, you can set the kMenuItemAttrDynamic attribute }
5134 { directly in the menu object in the nib, using the Inspector window for the }
5135 { menu. You don't need to add the attribute after creating the menu. }
5136 { - If your application requires Mac OS X 10.2 or CarbonLib 1.6 or later, you }
5137 { can also use a version-one-format 'xmnu' resource, which allows settting }
5138 { the menu item attributes in the 'xmnu'. Using a version one resource, you }
5139 { can include the kMenuItemAttrDynamic attribute in the resource rather than }
5140 { adding it after creating the menu. }
5141 { If the Menu Manager's built-in support is not sufficient, you can also change the }
5142 { attributes of an item yourself and use the UpdateInvalidMenuItems API to cause }
5143 { the menu to redraw. Changes to a menu item (changing text, command key, style, }
5144 { etc.) that occur while the menu is open will cause the menu item to be invalidated, }
5145 { but not redrawn. If you need to invalidate the item explicitly yourself, perhaps }
5146 { because you have a custom MDEF that depends on state not accessed using Menu }
5147 { Manager APIs, you can use the InvalidateMenuItems API. UpdateInvalidMenuItems will }
5148 { scan the menu for invalid items and redraw each, clearing its invalid flag }
5149 { afterwards. }
5150 { If you need to change menu contents based on modifier key state without using the }
5151 { built-in support in the Menu Manager, we recommend that you install a Carbon event }
5152 { handler on your menu for the [kEventClassKeyboard, kEventRawKeyModifiersChanged] }
5153 { event. Modifier key events are passed to the currently open menu before being sent }
5154 { to the user focus target. }
5155 {��������������������������������������������������������������������������������������}
5156 {
5157 * IsMenuItemInvalid()
5158 *
5159 * Summary:
5160 * Determines if a menu item is invalid and should be redrawn.
5161 *
5162 * Mac OS X threading:
5163 * Not thread safe
5164 *
5165 * Parameters:
5166 *
5167 * inMenu:
5168 * The menu whose item to examine.
5169 *
5170 * inItem:
5171 * The item to examine.
5172 *
5173 * Availability:
5174 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
5175 * CarbonLib: in CarbonLib 1.1 and later
5176 * Non-Carbon CFM: not available
5177 }
IsMenuItemInvalidnull5178 function IsMenuItemInvalid( inMenu: MenuRef; inItem: MenuItemIndex ): Boolean; external name '_IsMenuItemInvalid';
5179 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
5180
5181
5182 {
5183 * InvalidateMenuItems()
5184 *
5185 * Summary:
5186 * Invalidates a group of menu items so that they will be redrawn
5187 * when UpdateInvalidMenuItems is next called.
5188 *
5189 * Discussion:
5190 * Menu items are automatically invalidated when their contents are
5191 * changed using Menu Manager APIs while the menu is open. However,
5192 * you might need to use this API if you have a custom MDEF that
5193 * draws using state not contained in the menu.
5194 *
5195 * Mac OS X threading:
5196 * Not thread safe
5197 *
5198 * Parameters:
5199 *
5200 * inMenu:
5201 * The menu whose items to invalidate.
5202 *
5203 * inFirstItem:
5204 * The first item to invalidate.
5205 *
5206 * inNumItems:
5207 * The number of items to invalidate.
5208 *
5209 * Availability:
5210 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
5211 * CarbonLib: in CarbonLib 1.1 and later
5212 * Non-Carbon CFM: not available
5213 }
InvalidateMenuItemsnull5214 function InvalidateMenuItems( inMenu: MenuRef; inFirstItem: MenuItemIndex; inNumItems: ItemCount ): OSStatus; external name '_InvalidateMenuItems';
5215 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
5216
5217
5218 {
5219 * UpdateInvalidMenuItems()
5220 *
5221 * Summary:
5222 * Redraws the invalid items of an open menu.
5223 *
5224 * Discussion:
5225 * It is not necessary to use UpdateInvalidMenuItems if you are
5226 * using Carbon's built-in support for dynamic items based on
5227 * modifier key state. However, if you are modifying items
5228 * dynamically using your own implementation, you should call
5229 * UpdateInvalidMenuItems after completing your modifications for a
5230 * single menu. It will redraw any items that have been marked as
5231 * invalid, and clear the invalid flag for those items.
5232 *
5233 * Mac OS X threading:
5234 * Not thread safe
5235 *
5236 * Parameters:
5237 *
5238 * inMenu:
5239 * The menu to update.
5240 *
5241 * Availability:
5242 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
5243 * CarbonLib: in CarbonLib 1.1 and later
5244 * Non-Carbon CFM: not available
5245 }
UpdateInvalidMenuItemsnull5246 function UpdateInvalidMenuItems( inMenu: MenuRef ): OSStatus; external name '_UpdateInvalidMenuItems';
5247 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
5248
5249
5250 {��������������������������������������������������������������������������������������}
5251 { ��Standard font menu (Carbon and later) }
5252 { These APIs allow you to create and use the standard font menu. }
5253 {��������������������������������������������������������������������������������������}
5254 {$endc} {not TARGET_CPU_64}
5255
5256 const
5257 kHierarchicalFontMenuOption = $00000001;
5258
5259 {$ifc not TARGET_CPU_64}
5260 {
5261 * CreateStandardFontMenu()
5262 *
5263 * Mac OS X threading:
5264 * Not thread safe
5265 *
5266 * Availability:
5267 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
5268 * CarbonLib: in CarbonLib 1.0 and later
5269 * Non-Carbon CFM: not available
5270 }
CreateStandardFontMenunull5271 function CreateStandardFontMenu( menu: MenuRef; afterItem: MenuItemIndex; firstHierMenuID: MenuID; options: OptionBits; outHierMenuCount: ItemCountPtr { can be NULL } ): OSStatus; external name '_CreateStandardFontMenu';
5272 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
5273
5274
5275 {
5276 * UpdateStandardFontMenu()
5277 *
5278 * Mac OS X threading:
5279 * Not thread safe
5280 *
5281 * Availability:
5282 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
5283 * CarbonLib: in CarbonLib 1.0 and later
5284 * Non-Carbon CFM: not available
5285 }
UpdateStandardFontMenunull5286 function UpdateStandardFontMenu( menu: MenuRef; outHierMenuCount: ItemCountPtr { can be NULL } ): OSStatus; external name '_UpdateStandardFontMenu';
5287 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
5288
5289
5290 {
5291 * GetFontFamilyFromMenuSelection()
5292 *
5293 * Mac OS X threading:
5294 * Not thread safe
5295 *
5296 * Availability:
5297 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
5298 * CarbonLib: in CarbonLib 1.0 and later
5299 * Non-Carbon CFM: not available
5300 }
GetFontFamilyFromMenuSelectionnull5301 function GetFontFamilyFromMenuSelection( menu: MenuRef; item: MenuItemIndex; var outFontFamily: FMFontFamily; var outStyle: FMFontStyle ): OSStatus; external name '_GetFontFamilyFromMenuSelection';
5302 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
5303
5304
5305 {��������������������������������������������������������������������������������������}
5306 { � Contextual Menu routines and constants }
5307 { available with Conxtextual Menu extension 1.0 and later }
5308 {��������������������������������������������������������������������������������������}
5309 { Gestalt Selector for classic 68K apps only. }
5310 { CFM apps should weak link and check the symbols. }
5311 {$endc} {not TARGET_CPU_64}
5312
5313 const
5314 gestaltContextualMenuAttr = FourCharCode('cmnu');
5315 gestaltContextualMenuUnusedBit = 0;
5316 gestaltContextualMenuTrapAvailable = 1;
5317 gestaltContextualMenuHasAttributeAndModifierKeys = 2; { Contextual Menu Manager supports keyContextualMenuAttributes and keyContextualMenuModifiers }
5318 gestaltContextualMenuHasUnicodeSupport = 3; { Contextual Menu Manager supports typeUnicodeText and typeCFStringRef }
5319
5320
5321 {
5322 * Summary:
5323 * Values indicating what kind of help the application supports
5324 }
5325 const
5326 {
5327 * The application does not support any help. The Menu Manager will
5328 * put an appropriate help string into the contextual menu and
5329 * disable the Help item.
5330 }
5331 kCMHelpItemNoHelp = 0;
5332
5333 {
5334 * The application supports Apple Guide help. The Menu Manager will
5335 * put the name of the main Guide file into the contextual menu and
5336 * enable the Help item.
5337 }
5338 kCMHelpItemAppleGuide = 1;
5339
5340 {
5341 * The application supports some other form of help. In this case,
5342 * the application must also pass a valid string into the
5343 * inHelpItemString parameter of ContextualMenuSelect. This string
5344 * will be the text of the Help item in the contextual menu, and the
5345 * Help item will be enabled.
5346 }
5347 kCMHelpItemOtherHelp = 2;
5348
5349 {
5350 * The application does not support any help. The Menu Manager will
5351 * remove the Help item from the contextual menu. This constant is
5352 * available in Mac OS X and CarbonLib 1.6, and later; however, in
5353 * CarbonLib it is translated to kCMHelpItemNoHelp, and the Help item
5354 * is only disabled, not removed.
5355 }
5356 kCMHelpItemRemoveHelp = 3;
5357
5358
5359 {
5360 * Summary:
5361 * Values indicating what was chosen from a contextual menu
5362 }
5363 const
5364 {
5365 * The user did not choose an item from the contextual menu and the
5366 * application should do no further processing of the event.
5367 }
5368 kCMNothingSelected = 0;
5369
5370 {
5371 * The user chose one of the application's items from the menu. The
5372 * application can examine the outMenuID and outMenuItem parameters
5373 * of ContextualMenuSelect to see what the menu selection was, and it
5374 * should then handle the selection appropriately.
5375 }
5376 kCMMenuItemSelected = 1;
5377
5378 {
5379 * The user chose the Help item from the menu. The application should
5380 * open an Apple Guide database to a section appropriate for the
5381 * selection. If the application supports some other form of help, it
5382 * should be presented instead.
5383 }
5384 kCMShowHelpSelected = 3;
5385
5386
5387 {
5388 * Summary:
5389 * AERecord keywords used by the ExamineContext method of a
5390 * Contextual Menu plugin to specify menu item contents.
5391 }
5392 const
5393 {
5394 * Specifies the text of an item in a contextual menu. Data for this
5395 * parameter can be in one of several formats. In Mac OS 7/8/9.x and
5396 * Mac OS X 10.0 and 10.1, typeChar and typeIntlText are supported.
5397 * In Mac OS X 10.2 and later, typeStyledText, typeAEText,
5398 * typeUnicodeText, and typeCFStringRef are also supported. If you
5399 * provide data as typeCFStringRef, the Contextual Menu Manager will
5400 * automatically release the CFStringRef once the menu has been
5401 * displayed. If you need the CFStringRef to have a longer timetime,
5402 * your plugin should retain the CFStringRef before inserting it into
5403 * the AERecord.
5404 }
5405 keyContextualMenuName = FourCharCode('pnam');
5406
5407 {
5408 * Specifies the command ID of an item in a contextual menu. Data for
5409 * this parameter should be typeSInt32.
5410 }
5411 keyContextualMenuCommandID = FourCharCode('cmcd');
5412
5413 {
5414 * Specifies a contextual menu item with a submenu. Typically used
5415 * with AEPutKeyDesc to add an entire AEDesc containing the submenu
5416 * as the data for the parameter.
5417 }
5418 keyContextualMenuSubmenu = FourCharCode('cmsb');
5419
5420 {
5421 * Specifies the menu item attributes of an item in a contextual
5422 * menu. Data for this parameter should be typeSInt32. Available in
5423 * Mac OS X 10.2 and later.
5424 }
5425 keyContextualMenuAttributes = FourCharCode('cmat');
5426
5427 {
5428 * Specifies the modifier keys of an item in a contextual menu (see
5429 * kMenuShiftModifier, kMenuControlModifier, etc.) Data for this
5430 * parameter should be typeSInt32. Using this parameter together with
5431 * the keyContextualMenuAttributes parameter, it is possible to
5432 * create a contextual menu with dynamic items which change according
5433 * to the modifier keys pressed by the user. Available in Mac OS X
5434 * 10.2 and later.
5435 }
5436 keyContextualMenuModifiers = FourCharCode('cmmd');
5437
5438 {$ifc not TARGET_CPU_64}
5439 {
5440 * IsShowContextualMenuClick()
5441 *
5442 * Summary:
5443 * Determines whether a particular EventRecord could invoke a
5444 * contextual menu.
5445 *
5446 * Discussion:
5447 * Applications should call IsShowContextualMenuClick when they
5448 * receive non-null events. If IsShowContextualMenuClick returns
5449 * true, your application should generate its own menu and Apple
5450 * Event descriptor (AEDesc), and then call ContextualMenuSelect to
5451 * display and track the contextual menu, and then handle the user's
5452 * choice.
5453 *
5454 * Apple recommends that you use the IsShowContextualMenuEvent API
5455 * instead of this API. If you use the standard window Carbon event
5456 * handler on your windows, you can also use a
5457 * kEventControlContextualMenuClick event handler to be notified
5458 * when a contextual menu click has occured; in this case, you do
5459 * not need to call this API.
5460 *
5461 * Mac OS X threading:
5462 * Not thread safe
5463 *
5464 * Parameters:
5465 *
5466 * inEvent:
5467 * The event to examine.
5468 *
5469 * Result:
5470 * Returns true if the application should display a contextual menu,
5471 * false if not.
5472 *
5473 * Availability:
5474 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
5475 * CarbonLib: in CarbonLib 1.0 and later
5476 * Non-Carbon CFM: in ContextualMenu 1.0 and later
5477 }
IsShowContextualMenuClicknull5478 function IsShowContextualMenuClick( const (*var*) inEvent: EventRecord ): Boolean; external name '_IsShowContextualMenuClick';
5479 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
5480
5481
5482 {
5483 * IsShowContextualMenuEvent()
5484 *
5485 * Summary:
5486 * Determines whether a particular EventRef could invoke a
5487 * contextual menu.
5488 *
5489 * Discussion:
5490 * This API is similar to IsShowContextualMenuClick, but takes a
5491 * Carbon EventRef as its parameter instead of an EventRecord.
5492 *
5493 *
5494 * In Mac OS X 10.3 and earlier, this API always returned false if
5495 * the event kind was not kEventMouseDown,
5496 * kEventWindowClickContentRgn, kEventWindowClickStructureRgn, or
5497 * kEventWindowHandleContentClick. In Mac OS X 10.4 and later, this
5498 * API no longer requires a specific event kind; it only requires
5499 * that the event contain kEventParamMouseButton and
5500 * kEventParamKeyModifiers parameters.
5501 *
5502 * If you use the standard window Carbon event handler on your
5503 * windows, you can also use a kEventControlContextualMenuClick
5504 * event handler to be notified when a contextual menu click has
5505 * occured; in this case, you do not need to call this API.
5506 *
5507 * Mac OS X threading:
5508 * Not thread safe
5509 *
5510 * Parameters:
5511 *
5512 * inEvent:
5513 * The event to examine.
5514 *
5515 * Result:
5516 * Returns true if the application should display a contextual menu,
5517 * false if not.
5518 *
5519 * Availability:
5520 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
5521 * CarbonLib: in CarbonLib 1.1 and later
5522 * Non-Carbon CFM: not available
5523 }
IsShowContextualMenuEventnull5524 function IsShowContextualMenuEvent( inEvent: EventRef ): Boolean; external name '_IsShowContextualMenuEvent';
5525 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
5526
5527
5528 {
5529 * ContextualMenuSelect()
5530 *
5531 * Summary:
5532 * Displays a contextual menu.
5533 *
5534 * Discussion:
5535 * If IsShowContextualMenuClick returns true, you should call the
5536 * ContextualMenuSelect API after generating your own menu and
5537 * preparing an Apple Event descriptor (AEDesc) that describes the
5538 * item for which your application is displaying a contextual menu.
5539 * This descriptor may contain an object specifier or raw data and
5540 * will be passed to all contextual menu plug-ins.
5541 *
5542 * The system will add other items before displaying the contextual
5543 * menu, and it will remove those items before returning, leaving
5544 * the menu in its original state.
5545 *
5546 * After all the system commands are added, the contextual menu is
5547 * displayed and tracked. If the user selects one of the system
5548 * items, it is handled by the system and the call returns as though
5549 * the user didn't select anything from the menu. If the user
5550 * selects any other item (or no item at all), the Menu Manager
5551 * passes back appropriate values in the parameters
5552 * outUserSelectionType, outMenuID, and outMenuItem.
5553 *
5554 * Your application should provide visual feedback indicating the
5555 * item that was clicked upon. For example, a click on an icon
5556 * should highlight the icon, while a click on editable text should
5557 * not eliminate the current selection.
5558 *
5559 * If the outUserSelectionType parameter contains
5560 * kCMMenuItemSelected, you should look at the outMenuID and
5561 * outMenuItem parameters to determine what menu item the user chose
5562 * and handle it appropriately. If the user selected
5563 * kCMHelpItemSelected, you should open the proper Apple Guide
5564 * sequence or other form of custom help.
5565 *
5566 * There is a bug in ContextualMenuSelect in versions of Mac OS X
5567 * prior to Mac OS X 10.4 that causes the value returned in the
5568 * outUserSelectionType parameter to be set to kCMShowHelpSelected
5569 * instead of kCMMenuItemSelected if the menu has a menu ID of zero
5570 * and item three is selected. To avoid this problem on all versions
5571 * of Mac OS X, simply use a non-zero menu ID. Note that when a new
5572 * menu is created in InterfaceBuilder, its ID is automatically set
5573 * to zero.
5574 *
5575 * Mac OS X threading:
5576 * Not thread safe
5577 *
5578 * Parameters:
5579 *
5580 * inMenu:
5581 * A menu containing application commands to display. The caller
5582 * creates this menu based on the current context, the mouse
5583 * location, and the current selection (if it was the target of
5584 * the mouse). If you pass nil, only system commands will be
5585 * displayed. The menu should be added to the menu list as a
5586 * pop-up menu (using the InsertMenu function).
5587 *
5588 * inGlobalLocation:
5589 * The location (in global coordinates) of the mouse near which
5590 * the menu is to be displayed.
5591 *
5592 * inReserved:
5593 * Reserved for future use. Pass false for this parameter.
5594 *
5595 * inHelpType:
5596 * An identifier specifying the type of help to be provided by the
5597 * application; see kCMHelpItem constants.
5598 *
5599 * inHelpItemString:
5600 * A string containing the text to be displayed for the help menu
5601 * item. This string is unused unless you also pass the constant
5602 * kCMHelpItemOtherHelp in the inHelpType parameter.
5603 *
5604 * inSelection:
5605 * An object specifier for the current selection. This allows he
5606 * system to examine the selection and add special system commands
5607 * accordingly. Passing a value of nil indicates that no selection
5608 * should be examined, and most likely, no special system actions
5609 * will be included.
5610 *
5611 * outUserSelectionType:
5612 * On exit, the value indicates what the user selected from the
5613 * contextual menu; see kCMNothingSelected, kCMMenuItemSelected,
5614 * and kCMShowHelpSelected.
5615 *
5616 * outMenuID:
5617 * On exit, if outUserSelectionType is set to kCMMenuItemSelected,
5618 * the value is set to the menu ID of the chosen item.
5619 *
5620 * outMenuItem:
5621 * On exit, if outUserSelectionType is set to kCMMenuItemSelected,
5622 * the value is set to the menu item chosen.
5623 *
5624 * Result:
5625 * An OSStatus result code. ContextualMenuSelect returns the result
5626 * code userCanceledErr and sets outUserSelectionType to
5627 * kCMNothingSelected to indicate that the user did not select
5628 * anything from the contextual menu and no further processing is
5629 * needed.
5630 *
5631 * Availability:
5632 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
5633 * CarbonLib: in CarbonLib 1.0 and later
5634 * Non-Carbon CFM: in ContextualMenu 1.0 and later
5635 }
ContextualMenuSelectnull5636 function ContextualMenuSelect( inMenu: MenuRef; inGlobalLocation: Point; inReserved: Boolean; inHelpType: UInt32; {const} inHelpItemString:ConstStringPtr { can be NULL }; {const} inSelection: AEDescPtr { can be NULL }; var outUserSelectionType: UInt32; var outMenuID: MenuID; var outMenuItem: MenuItemIndex ): OSStatus; external name '_ContextualMenuSelect';
5637 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
5638
5639
5640 {$endc} {NOT TARGET_CPU_64}
5641
5642 {��������������������������������������������������������������������������������������}
5643 { Contextual Menu Plugin Interface }
5644 { For Mac OS X 10.1, we support a new type of Contextual Menu Plugin: the CFPlugIn }
5645 { based plugin. Each plugin must be in a CFPlugIn in the Contextual Menu Items }
5646 { folder in one of these paths: }
5647 { /System/Library/Contextual Menu Items/ }
5648 { /Library/Contextual Menu Items/ }
5649 { ~/Library/Contextual Menu Items/ }
5650 { It must export the following functions using the following interface or a C++ }
5651 { interface inheriting from IUnknown and including similar functions. }
5652 {��������������������������������������������������������������������������������������}
5653 (*
5654 { The Contextual Menu Manager will only load CFPlugIns of type kContextualMenuTypeID }
5655 #define kContextualMenuTypeID ( CFUUIDGetConstantUUIDWithBytes( NULL, \
5656 0x2F, 0x65, 0x22, 0xE9, 0x3E, 0x66, 0x11, 0xD5, \
5657 0x80, 0xA7, 0x00, 0x30, 0x65, 0xB3, 0x00, 0xBC ) )
5658 { 2F6522E9-3E66-11D5-80A7-003065B300BC }
5659
5660 { Contextual Menu Plugins must implement this Contexual Menu Plugin Interface }
5661 #define kContextualMenuInterfaceID ( CFUUIDGetConstantUUIDWithBytes( NULL, \
5662 0x32, 0x99, 0x7B, 0x62, 0x3E, 0x66, 0x11, 0xD5, \
5663 0xBE, 0xAB, 0x00, 0x30, 0x65, 0xB3, 0x00, 0xBC ) )
5664 { 32997B62-3E66-11D5-BEAB-003065B300BC }
5665
5666 #define CM_IUNKNOWN_C_GUTS \
5667 void *_reserved; \
5668 SInt32 (*QueryInterface)(void *thisPointer, CFUUIDBytes iid, void ** ppv); \
5669 UInt32 (*AddRef)(void *thisPointer); \
5670 UInt32 (*Release)(void *thisPointer)
5671
5672 { The function table for the interface }
5673 type
5674 ContextualMenuInterfaceStruct = record
5675 CM_IUNKNOWN_C_GUTS;
5676 OSStatus ( *ExamineContext )(
5677 void* thisInstance,
5678 const AEDesc* inContext,
5679 AEDescList* outCommandPairs );
5680 OSStatus ( *HandleSelection )(
5681 void* thisInstance,
5682 AEDesc* inContext,
5683 SInt32 inCommandID );
5684 void ( *PostMenuCleanup )(
5685 void* thisInstance );
5686 end;
5687 *)
5688 {
5689 * CMPluginExamineContext()
5690 *
5691 * Availability:
5692 * Implemented by client
5693 }
CMPluginExamineContextnull5694 function CMPluginExamineContext( thisInstance: UnivPtr; const (*var*) inContext: AEDesc; var outCommandPairs: AEDescList ): OSStatus; external name '_CMPluginExamineContext';
5695
5696
5697 {
5698 * CMPluginHandleSelection()
5699 *
5700 * Availability:
5701 * Implemented by client
5702 }
CMPluginHandleSelectionnull5703 function CMPluginHandleSelection( thisInstance: UnivPtr; var inContext: AEDesc; inCommandID: SInt32 ): OSStatus; external name '_CMPluginHandleSelection';
5704
5705
5706 {
5707 * CMPluginPostMenuCleanup()
5708 *
5709 * Availability:
5710 * Implemented by client
5711 }
5712 procedure CMPluginPostMenuCleanup( thisInstance: UnivPtr ); external name '_CMPluginPostMenuCleanup';
5713
5714
5715 { previously in LowMem.h. This functions return the menu ID of the hilited menu }
5716 {$ifc not TARGET_CPU_64}
5717 {
5718 * LMGetTheMenu()
5719 *
5720 * Mac OS X threading:
5721 * Not thread safe
5722 *
5723 * Availability:
5724 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
5725 * CarbonLib: in CarbonLib 1.0 and later
5726 * Non-Carbon CFM: in InterfaceLib 7.1 and later
5727 }
LMGetTheMenunull5728 function LMGetTheMenu: MenuID; external name '_LMGetTheMenu';
5729 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
5730
5731
5732 {--------------------------------------------------------------------------------------}
5733 { � DEPRECATED }
5734 { All functions below this point are either deprecated (they continue to function }
5735 { but are not the most modern nor most efficient solution to a problem), or they are }
5736 { completely unavailable on Mac OS X. }
5737 {--------------------------------------------------------------------------------------}
5738 {
5739 A Short Course on Menu Definition Functions
5740
5741 A menu definition function is used to implement a custom visual appearance for a menu.
5742 Menu definition functions are still supported in Carbon, but the messages sent to a
5743 menu definition function in Carbon are different than for a non-Carbon application.
5744
5745 In general, Apple recommends using the system menu definition whenever possible.
5746 Menu definition functions will continue to be supported, but it is not easy to write
5747 a correct menu definition, especially one that attempts to imitate the standard system
5748 menu appearance. If you require special features in your menu that the system menu
5749 definition does not support, please mail <toolbox@apple.com> and describe your requirements;
5750 we would much rather enhance the system menu definition than have you write a custom one.
5751 The use of menu definition functions is deprecated in Mac OS X; in Mac OS X 10.3 and
5752 later, Apple recommends that you use a custom HIView to draw menu content.
5753
5754 Menu definition functions before Carbon used the following messages:
5755
5756 kMenuDrawMsg
5757 kMenuChooseMsg
5758 kMenuSizeMsg
5759 kMenuPopUpMsg
5760 kMenuDrawItemMsg
5761 kMenuCalcItemMsg
5762 kMenuThemeSavvyMsg
5763
5764 kMenuChooseMsg and kMenuDrawItemMsg are not supported in Carbon and are not sent to
5765 Carbon menu definitions. In Carbon, kMenuChooseMsg is replaced by kMenuFindItemMsg and
5766 kMenuHiliteItemMsg. Menu definition functions in Carbon use the following messages:
5767
5768 kMenuInitMsg
5769 kMenuDisposeMsg
5770 kMenuFindItemMsg
5771 kMenuHiliteItemMsg
5772 kMenuDrawItemsMsg
5773 kMenuDrawMsg
5774 kMenuSizeMsg
5775 kMenuPopUpMsg
5776 kMenuCalcItemMsg
5777 kMenuThemeSavvyMsg
5778
5779 The rest of this documentation will focus on Carbon menu definitions only.
5780
5781 Menu Definition Messages
5782
5783 Carbon menu definition functions should support the following messages:
5784
5785 kMenuInitMsg
5786
5787 menuRect unused
5788 hitPt unused
5789 whichItem OSErr*
5790
5791 Sent when a menu is created. This message gives the menu definition an opportunity
5792 to initialize its own state. If the menu definition encounters an error while
5793 initializing, it should set *whichItem to a non-zero error code; this will cause the
5794 Menu Manager to destroy the menu and return an error back from the API that was used
5795 to create the menu.
5796
5797 kMenuDisposeMsg
5798
5799 menuRect unused
5800 hitPt unused
5801 whichItem unused
5802
5803 Sent when a menu is destroyed. This message gives the menu definition an opportunity
5804 to destroy its own data.
5805
5806 kMenuFindItemMsg
5807
5808 menuRect menu bounds
5809 hitPt point to hit-test
5810 whichItem MDEFFindItemData*
5811
5812 Sent when the Menu Manager is displaying a menu and needs to know what item is under
5813 the mouse. The whichItem parameter is actually a pointer to a MenuTrackingData structure.
5814 On entry, the menu, virtualMenuTop, and virtualMenuBottom fields of this structure are
5815 valid. The menu definition should determine which item containst the given point, if any,
5816 and fill in the itemUnderMouse, itemSelected, and itemRect fields. If an item is found,
5817 the menu definition should always fill in the itemUnderMouse and itemRect fields. The
5818 menu definition should only fill in the itemSelected field if the item is available for
5819 selection; if it is unavailable (because it is disabled, or for some other reason), the
5820 menu definition should set the itemSelected field to zero.
5821
5822 The values placed in the itemUnderMouse and itemSelected fields should be less than or
5823 equal to the number of items returned by CountMenuItems on this menu. The values placed
5824 in these two fields should be identical if both are non-zero. itemUnderMouse should always
5825 be non-zero if the mouse is actually over an item.
5826
5827 The menu definition should not hilite the found item during this message. The Menu
5828 Manager will send a separate kMenuHiliteItemMsg to request hiliting of the item.
5829
5830 If the menu definition supports scrolling, it should scroll the menu during this message,
5831 and update the virtualMenuTop and virtualMenuBottom fields of the MenuTrackingData to
5832 indicate the menu's new scrolled position.
5833
5834 If the menu definition uses QuickDraw to draw while scrolling, it should draw into the
5835 current port.
5836
5837 If the menu definition uses CoreGraphics to draw while scrolling, it should use the
5838 CGContextRef passed in the context field of the MDEFHiliteItemData structure.
5839
5840 Menu definitions must use the ScrollMenuImage API, if available, to scroll the menu contents.
5841 This API is available in CarbonLib 1.5 and later, and in Mac OS X 10.1 and later. ScrollMenuImage
5842 properly supports scrolling the alpha channel in the menu's image data. Use of QuickDraw's
5843 ScrollRect API to scroll the menu contents will result in the alpha channel being set to 0xFF
5844 (opaque) and the menu will no longer be transparent.
5845
5846 The menu definition should not modify the menu field of the MenuTrackingData.
5847
5848 kMenuHiliteItemMsg
5849
5850 menuRect menu bounds
5851 hitPt unused
5852 whichItem MDEFHiliteItemData*
5853
5854 Sent when the Menu Manager is displaying a menu and needs to hilite a newly selected
5855 item. The whichItem parameter is actually a pointer to a MDEFHiliteItemData structure.
5856 The menu definition should unhilite the item in the previousItem field, if non-zero,
5857 and hilite the item in the newItem field.
5858
5859 Menu definitions should use the EraseMenuBackground API to erase the old menu contents
5860 before unhiliting a menu item, if the menu definition is using the Appearance Manager's
5861 menu drawing APIs. This is necessary because the background of a menu is transparent on
5862 Aqua, and if the old hilite is not erased first, it will show through the new unhilited
5863 menu background.
5864
5865 If the menu definition uses QuickDraw to draw, it should draw into the current port.
5866
5867 If the menu definition uses CoreGraphics to draw, it should use the CGContextRef passed
5868 in the context field of the MDEFHiliteItemData structure.
5869
5870 kMenuDrawItemsMsg
5871
5872 menuRect menu bounds
5873 hitPt unused
5874 whichItem MDEFDrawItemsData*
5875
5876 Sent when the Menu Manager is displaying a menu and needs to redraw a portion of the
5877 menu. This message is used by the dynamic menu item support code in the Menu Manager;
5878 for example, if items five and six in a menu are a dynamic group, the Menu Manager will
5879 send a DrawItems message when the group's modifier key is pressed or released to redraw
5880 the appropriate item, but no other items in the menu.
5881
5882 The whichItem parameter for this message is actually a pointer to a MDEFDrawItemsData
5883 structure. The menu definition should redraw the items starting with firstItem and
5884 ending with lastItem, inclusive.
5885
5886 If the menu definition uses QuickDraw to draw, it should draw into the current port.
5887
5888 If the menu definition uses CoreGraphics to draw, it should use the CGContextRef passed
5889 in the context field of the MDEFDrawItemsData structure.
5890
5891 kMenuDrawMsg
5892
5893 menuRect menu bounds
5894 hitPt unused
5895 whichItem MDEFDrawData*
5896
5897 Sent when the Menu Manager is displaying a menu and needs to redraw the entire menu.
5898 The whichItem parameter is actually a pointer to a MenuTrackingData structure. On entry,
5899 the menu field of this structure is valid. The menu definition should draw the menu and,
5900 if it supports scrolling, should also fill in the virtualMenuTop and virtualMenuBottom
5901 fields of the structure to indicate the menu's initial unscrolled position; typically,
5902 virtualMenuTop would be set to the same value as the top coordinate of the menu rect,
5903 and virtualMenuBottom would be set to virtualMenuTop plus the virtual height of the menu.
5904
5905 If the menu definition uses QuickDraw to draw, it should draw into the current port.
5906
5907 If the menu definition uses CoreGraphics to draw, it should use the CGContextRef passed
5908 in the context field of the MDEFDrawData structure.
5909
5910 kMenuSizeMsg
5911
5912 menuRect unused
5913 hitPt maximum width and height of the menu
5914 whichItem unused
5915
5916 Sent when the Menu Manager needs to determine the size of a menu. The menu definition
5917 should calculate the width and height of the menu and store the sizes into the menu with
5918 SetMenuWidth and SetMenuHeight.
5919
5920 If the gestaltMenuMgrSendsMenuBoundsToDefProc bit is set in the Menu Manager's Gestalt
5921 value, then the hitPt parameter to this message is the maximum width (hitPt.h) and height
5922 (hitPt.v) of the menu. The menu definition should ensure that the width and height that it
5923 places in the menu do not exceed these values. If the gestalt bit is not set, the menu
5924 definition should just use the main GDevice's width and height as constraints on the menu's
5925 width and height.
5926
5927 kMenuPopUpMsg
5928
5929 menuRect on entry, constraints on the menu's position; on exit, menu bounds
5930 hitPt requested menu location, with swapped coordinates
5931 whichItem on entry, requested initial selection; on exit, virtual menu top
5932
5933 Sent when the Menu Manager is about to display a popup menu. The menu definition should
5934 calculate the appropriate menu bounds to contain the menu based on the requested menu
5935 location and selected item. It should write the menuBounds into the rect given by the
5936 menuRect parameter.
5937
5938 If the gestaltMenuMgrSendsMenuBoundsToDefProc bit is set in the Menu Manager's Gestalt
5939 value, then the menuRect parameter on entry to this message contains a constraint rect,
5940 in global coordinates, outside of which the popup menu should not be positioned. The menu
5941 definition should take this constraint rect into account as it calculates the menu bounds.
5942 If the gestalt bit is not set, the menu definition should use the bounds of the GDevice
5943 containing the menu's top left corner as a constraint on the menu's position.
5944
5945 The hitPt parameter is a requested location for the top left corner of the menu. The
5946 coordinates of this parameter are swapped from their normal order; the h field of the
5947 hitPt parameter contains the vertical coordinate, and the v field of hitPt contains
5948 the horizontal coordinate.
5949
5950 On entry, the whichItem parameter points at a menu item index which is requested to be
5951 the initial selection when the menu is displayed. After calculating the menu's bounds,
5952 the menu definition should write the menu's virtual top coordinate into the location
5953 pointed at by the whichItem parameter. If displaying the menu at the requested location
5954 does not require scrolling, the virtual top will be the same as the menu bounds top;
5955 if the menu must scroll to fit in the requested location, the virtual top may be different.
5956
5957 kMenuCalcItemMsg
5958
5959 menuRect on exit, item bounds
5960 hitPt unused
5961 whichItem the item whose rect to calculate
5962
5963 Sent when the Menu Manager needs to know the bounds of a menu item. The menu definition
5964 should calculate the size of the item specified by the whichItem parameter, and store
5965 the bounds in the rect specified by the menuRect parameter.
5966
5967 Some sample menu definition code provided by Apple has previously shown an implementation
5968 of this message that always sets the top left corner of the item bounds to (0,0), regardless
5969 of the item's actual position in the menu. For best future compatibility, menu definitions
5970 should begin storing an item bounds that gives the item's actual position in the menu based
5971 on the menu's current virtual top. For example, if the virtual menu top starts at 20, then
5972 the menu definition would calculate an item bounds for the first item that starts at (0,20),
5973 an item bounds for the second item that starts at (0,40), and so on. The menu definition
5974 should call GetMenuTrackingData to get the menu's current virtual position, and use zero
5975 for the menu top if GetMenuTrackingData returns an error.
5976
5977 kMenuThemeSavvyMsg
5978
5979 menuRect unused
5980 hitPt unused
5981 whichItem on exit, indicates theme-savvyness of the menu definition
5982
5983 Sent by the Menu Manager to determine whether the MDEF uses the Appearance Manager
5984 menu-drawing functions to draw its menu. If it does, the menu definition should return
5985 kThemeSavvyMenuResponse in the location pointed to by whichItem. If the menu definition
5986 draws its own custom content without using the Appearance Manager menu-drawing functions,
5987 it should ignore this message.
5988
5989 Low-memory Global Replacements
5990
5991 Pre-Carbon menu definitions needed to use several low-memory globals to communicate with the
5992 Menu Manager. These globals have all been replaced or made obsolete in Carbon, as follows:
5993
5994 MenuDisable
5995
5996 MenuDisable is now set automatically by the Menu Manager using the value returned in the
5997 itemUnderMouse field of the MenuTrackingData structure passed to kMenuFindItemMsg.
5998
5999 TopMenuItem
6000 AtMenuBottom
6001
6002 TopMenuItem and AtMenuBottom are now set automatically by the Menu Manager using the
6003 values returned in the virtualMenuTop and virtualMenuBottom fields of the MenuTrackingData
6004 structure passed to kMenuDrawMsg and kMenuFindItemMsg.
6005
6006 mbSaveLoc
6007
6008 This undocumented low-memory global was used by pre-Carbon menu definitions to store
6009 the bounding rect of the currently selected item and to avoid drawing glitches while
6010 the menu definition was scrolling the contents of a menu that had submenus. The Menu
6011 Manager now automatically sets the selected item bounds using the value returned in
6012 the itemRect field of the MenuTrackingData structure passed to kMenuFindItemMsg. In
6013 order to correctly support scrolling of menus with submenus, a menu definition should
6014 verify, before scrolling the menu contents, that no submenus of the scrolling menu are
6015 currently visible. A menu definition can use GetMenuTrackingData to verify this condition,
6016 as follows:
6017
6018 Boolean SafeToScroll( MenuRef menuBeingScrolled )
6019 (
6020 MenuTrackingData lastMenuData;
6021 return GetMenuTrackingData( NULL, &lastMenuData ) == noErr
6022 && lastMenuData.menu == menuBeingScrolled;
6023 )
6024
6025 If SafeToScroll returns false, the menu definition should not scroll the menu.
6026 }
6027 {$endc} {not TARGET_CPU_64}
6028
6029 const
6030 { menu defProc messages }
6031 kMenuDrawMsg = 0;
6032 kMenuSizeMsg = 2;
6033 kMenuPopUpMsg = 3; { position the popup menu rect appropriately }
6034 kMenuCalcItemMsg = 5;
6035 kMenuThemeSavvyMsg = 7; { is your MDEF theme-savvy? If so, return kThemeSavvyMenuResponse in the whichItem parameter}
6036 kMenuInitMsg = 8; { Return an error code in *whichItem to indicate success or failure. Only supported in Carbon. }
6037 kMenuDisposeMsg = 9; { The menu is being destroyed. Only supported in Carbon.}
6038 kMenuFindItemMsg = 10; { Determine which item is under the mouse. Only supported in Carbon.}
6039 kMenuHiliteItemMsg = 11; { Hilite the specified item. Only supported in Carbon.}
6040 kMenuDrawItemsMsg = 12; { Draw a range of items. Only supported in Carbon.}
6041 mDrawMsg = kMenuDrawMsg; { obsolete constant name}
6042 mSizeMsg = kMenuSizeMsg; { obsolete constant name}
6043 mPopUpMsg = kMenuPopUpMsg; { obsolete constant name}
6044 mCalcItemMsg = kMenuCalcItemMsg; { obsolete constant name}
6045
6046
6047 const
6048 kThemeSavvyMenuResponse = $7473; { should be returned in *whichItem when handling kMenuThemeSavvyMsg}
6049
6050
6051 {
6052 * MDEFHiliteItemData
6053 *
6054 * Summary:
6055 * The MDEFHiliteItemData structure contains information about which
6056 * menu items should be hilited and unhilited as the user moves
6057 * through the menus. It is used by menu definition functions, which
6058 * receive a pointer to an MDEFHiliteItemData structure as the
6059 * whichItem parameter during kMenuHiliteItemMsg.
6060 }
6061 type
6062 MDEFHiliteItemData = record
6063 {
6064 * The item that was previously selected. It should be redrawn in an
6065 * unhilited state. May be zero if no item was previously selected.
6066 }
6067 previousItem: MenuItemIndex;
6068
6069 {
6070 * The item that is now selected. It should be redrawn in a hilited
6071 * state. May be zero if no item is now selected.
6072 }
6073 newItem: MenuItemIndex;
6074
6075 {
6076 * A CoreGraphics context that the MDEF should draw into. The Menu
6077 * Manager will flush the context after the MDEF has returned.
6078 }
6079 context: UnivPtr;
6080 end;
6081 MDEFHiliteItemDataPtr = ^MDEFHiliteItemData;
6082 type
6083 HiliteMenuItemData = MDEFHiliteItemData;
6084 HiliteMenuItemDataPtr = MDEFHiliteItemDataPtr;
6085
6086 {
6087 * MDEFDrawData
6088 *
6089 * Summary:
6090 * The MDEFDrawData structure contains information needed to draw a
6091 * menu. It is used by menu definition functions, which receive a
6092 * pointer to an MDEFDrawData structure as the whichItem parameter
6093 * during kMenuDrawMsg.
6094 }
6095 type
6096 MDEFDrawData = record
6097 {
6098 * Information about the menu being drawn. The MDEF should fill in
6099 * the virtualMenuTop and virtualMenuBottom fields of this structure
6100 * while drawing the menu.
6101 }
6102 trackingData: MenuTrackingData;
6103
6104 {
6105 * A CoreGraphics context that the MDEF should draw into. The Menu
6106 * Manager will flush the context after the MDEF has returned.
6107 }
6108 context: UnivPtr;
6109 end;
6110 MDEFDrawDataPtr = ^MDEFDrawData;
6111
6112 {
6113 * MDEFFindItemData
6114 *
6115 * Summary:
6116 * The MDEFFindItemData structure contains information needed to
6117 * determine which item is currently selected by the user. It is
6118 * used by menu definition functions, which receive a pointer to an
6119 * MDEFDrawData structure as the whichItem parameter during
6120 * kMenuFindItemMsg.
6121 }
6122 type
6123 MDEFFindItemData = record
6124 {
6125 * Information about the menu being drawn. The MDEF should fill in
6126 * the itemSelected, itemUnderMouse, and itemRect fields of this
6127 * structure after determining which item is at the specified point.
6128 }
6129 trackingData: MenuTrackingData;
6130
6131 {
6132 * A CoreGraphics context that the MDEF should draw into if it needs
6133 * to scroll the menu during the FindItem message. The Menu Manager
6134 * will flush the context after the MDEF has returned.
6135 }
6136 context: UnivPtr;
6137 end;
6138 MDEFFindItemDataPtr = ^MDEFFindItemData;
6139
6140 {
6141 * MDEFDrawItemsData
6142 *
6143 * Summary:
6144 * The MDEFDrawItemsData structure contains information about which
6145 * menu items to redraw. It is used by menu definition functions,
6146 * which receive a pointer to an MDEFDrawItemsData structure as the
6147 * whichItem parameter during kMenuDrawItemsMsg.
6148 }
6149 type
6150 MDEFDrawItemsData = record
6151 {
6152 * The first item to draw.
6153 }
6154 firstItem: MenuItemIndex;
6155
6156 {
6157 * The last item to draw.
6158 }
6159 lastItem: MenuItemIndex;
6160
6161 {
6162 * Information about the menu's tracking state. The virtualMenuTop
6163 * and virtualMenuBottom fields in this structure will be the most
6164 * useful in handling the DrawItems message.
6165 }
6166 trackingData: MenuTrackingDataPtr;
6167
6168 {
6169 * A CoreGraphics context that the MDEF should draw into. The Menu
6170 * Manager will flush the context after the MDEF returns.
6171 }
6172 context: UnivPtr;
6173 end;
6174 MDEFDrawItemsDataPtr = ^MDEFDrawItemsData;
6175 { obsolete menu color table constants}
6176 const
6177 mctAllItems = -98; {search for all Items for the given ID}
6178 mctLastIDIndic = -99; {last color table entry has this in ID field}
6179
6180 type
6181 MCEntry = record
6182 mctID: MenuID; {menu ID. ID = 0 is the menu bar}
6183 mctItem: SInt16; {menu Item. Item = 0 is a title}
6184 mctRGB1: RGBColor; {usage depends on ID and Item}
6185 mctRGB2: RGBColor; {usage depends on ID and Item}
6186 mctRGB3: RGBColor; {usage depends on ID and Item}
6187 mctRGB4: RGBColor; {usage depends on ID and Item}
6188 mctReserved: SInt16; {reserved for internal use}
6189 end;
6190 MCEntryPtr = ^MCEntry;
6191 type
6192 MCTable = array [0..0] of MCEntry; {ARRAY [1..numEntries] of MCEntry}
6193 MCTablePtr = ^MCTable;
6194 MCTableHandle = ^MCTablePtr;
6195 type
6196 MenuCRsrc = record
6197 numEntries: SInt16; {number of entries}
6198 mcEntryRecs: MCTable; {ARRAY [1..numEntries] of MCEntry}
6199 end;
6200 MenuCRsrcPtr = ^MenuCRsrc;
6201 type
6202 MenuCRsrcHandle = ^MenuCRsrcPtr;
6203
6204
6205 const
6206 {
6207 * Menu item command ID to indicate a hierarchical menu; the item
6208 * icon ID is the hierarchical menu ID. This constant is deprecated.
6209 * Use SetMenuItemHierarchicalID or SetMenuItemHierarchicalMenu
6210 * instead of using this constant.
6211 }
6212 hMenuCmd = 27;
6213
6214 {
6215 * A menu ID used with InsertMenu to insert a menu into the
6216 * hierarchical portion of the menubar. Rather than inserting menus
6217 * into the hierarchical portion of the menubar, we recommend that
6218 * your application use SetMenuItemHierarchicalMenu to directly
6219 * specify the submenu's MenuRef.
6220 }
6221 kInsertHierarchicalMenu = -1;
6222
6223 {
6224 * The old name for kInsertHierarchicalMenu. This constant is
6225 * deprecated.
6226 }
6227 hierMenu = -1;
6228
6229 {$ifc not TARGET_CPU_64}
6230 {
6231 * NewMenu() *** DEPRECATED ***
6232 *
6233 * Deprecated:
6234 * Use CreateNewMenu instead of NewMenu.
6235 *
6236 * Summary:
6237 * Creates a new menu.
6238 *
6239 * Mac OS X threading:
6240 * Not thread safe
6241 *
6242 * Availability:
6243 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6244 * CarbonLib: in CarbonLib 1.0 and later
6245 * Non-Carbon CFM: in InterfaceLib 7.1 and later
6246 }
NewMenunull6247 function NewMenu( menuID_: MenuID; const (*var*) menuTitle: Str255 ): MenuRef; external name '_NewMenu';
6248 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6249
6250
6251 {
6252 * GetMenuTitle() *** DEPRECATED ***
6253 *
6254 * Deprecated:
6255 * Use CopyMenuTitleAsCFString instead of GetMenuTitle.
6256 *
6257 * Summary:
6258 * Retrieves the title of a menu as a Pascal string.
6259 *
6260 * Mac OS X threading:
6261 * Not thread safe
6262 *
6263 * Availability:
6264 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6265 * CarbonLib: in CarbonLib 1.0 and later
6266 * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
6267 }
GetMenuTitlenull6268 function GetMenuTitle( menu: MenuRef; var title: Str255 ): StringPtr; external name '_GetMenuTitle';
6269 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6270
6271
6272 {
6273 * SetMenuTitle() *** DEPRECATED ***
6274 *
6275 * Deprecated:
6276 * Use SetMenuTitleWithCFString instead of SetMenuTitle.
6277 *
6278 * Summary:
6279 * Sets the title of a menu to a Pascal string.
6280 *
6281 * Mac OS X threading:
6282 * Not thread safe
6283 *
6284 * Availability:
6285 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6286 * CarbonLib: in CarbonLib 1.0 and later
6287 * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
6288 }
SetMenuTitlenull6289 function SetMenuTitle( menu: MenuRef; const (*var*) title: Str255 ): OSStatus; external name '_SetMenuTitle';
6290 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6291
6292
6293 {
6294 * [Mac]AppendMenu() *** DEPRECATED ***
6295 *
6296 * Deprecated:
6297 * Use AppendMenuItemTextWithCFString instead of AppendMenu. Note
6298 * that unlike AppendMenu, AppendMenuItemTextWithCFString does not
6299 * interpret metacharacters in the text.
6300 *
6301 * Summary:
6302 * Appends a new menu item to a menu, using a Pascal string for the
6303 * item's text.
6304 *
6305 * Mac OS X threading:
6306 * Not thread safe
6307 *
6308 * Availability:
6309 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6310 * CarbonLib: in CarbonLib 1.0 and later
6311 * Non-Carbon CFM: in InterfaceLib 7.1 and later
6312 }
6313 procedure AppendMenu( menu: MenuRef; const (*var*) data: Str255 ); external name '_AppendMenu';
6314 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
6315 procedure MacAppendMenu( menu: MenuRef; const (*var*) data: Str255 ); external name '_AppendMenu';
6316 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
6317
6318 {
6319 * [Mac]InsertMenuItem() *** DEPRECATED ***
6320 *
6321 * Deprecated:
6322 * Use InsertMenuItemTextWithCFString instead of InsertMenuItem.
6323 * Note that unlike InsertMenuItem InsertMenuItemTextWithCFString
6324 * does not interpret metacharacters in the text.
6325 *
6326 * Summary:
6327 * Inserts a new menu item into a menu, using a Pascal string for
6328 * the item text.
6329 *
6330 * Mac OS X threading:
6331 * Not thread safe
6332 *
6333 * Parameters:
6334 *
6335 * theMenu:
6336 * The menu into which to insert the item.
6337 *
6338 * itemString:
6339 * The text of the new item. This string is parsed for the
6340 * meta-characters documented in the Menu Manager chapter of
6341 * Inside Macintosh.
6342 *
6343 * afterItem:
6344 * The menu item after which to insert the item. Pass 0 to insert
6345 * the item at the beginning of the menu. If afterItem is greater
6346 * than the number of items in the menu, the item is inserted at
6347 * the end of the menu.
6348 *
6349 * Availability:
6350 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6351 * CarbonLib: in CarbonLib 1.0 and later
6352 * Non-Carbon CFM: in InterfaceLib 7.1 and later
6353 }
6354 procedure InsertMenuItem( theMenu: MenuRef; const (*var*) itemString: Str255; afterItem: MenuItemIndex ); external name '_InsertMenuItem';
6355 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
6356 procedure MacInsertMenuItem( theMenu: MenuRef; const (*var*) itemString: Str255; afterItem: MenuItemIndex ); external name '_InsertMenuItem';
6357 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
6358
6359
6360 {
6361 * AppendMenuItemText() *** DEPRECATED ***
6362 *
6363 * Deprecated:
6364 * Use AppendMenuItemTextWithCFString instead of AppendMenuItemText.
6365 *
6366 * Summary:
6367 * Appends a menu item using a Pascal string for the item's text,
6368 * without interpreting metacharacters in the text.
6369 *
6370 * Mac OS X threading:
6371 * Not thread safe
6372 *
6373 * Availability:
6374 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6375 * CarbonLib: in CarbonLib 1.0 and later
6376 * Non-Carbon CFM: in MenusLib 8.5 and later
6377 }
AppendMenuItemTextnull6378 function AppendMenuItemText( menu: MenuRef; const (*var*) inString: Str255 ): OSStatus; external name '_AppendMenuItemText';
6379 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6380
6381
6382 {
6383 * InsertMenuItemText() *** DEPRECATED ***
6384 *
6385 * Deprecated:
6386 * Use InsertMenuItemTextWithCFString instead of InsertMenuItemText.
6387 *
6388 * Summary:
6389 * Inserts a new menu item into a menu, using a Str255 for the item
6390 * text.
6391 *
6392 * Mac OS X threading:
6393 * Not thread safe
6394 *
6395 * Parameters:
6396 *
6397 * menu:
6398 * The menu into which to insert the item.
6399 *
6400 * inString:
6401 * The text of the new item. This string is not parsed for the
6402 * meta-characters documented in the Menu Manager chapter of
6403 * Inside Macintosh; the new item's text becomes exactly the
6404 * specified text.
6405 *
6406 * afterItem:
6407 * The menu item after which to insert the item. Pass 0 to insert
6408 * the item at the beginning of the menu. If afterItem is greater
6409 * than the number of items in the menu, the item is inserted at
6410 * the end of the menu.
6411 *
6412 * Availability:
6413 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6414 * CarbonLib: in CarbonLib 1.0 and later
6415 * Non-Carbon CFM: in MenusLib 8.5 and later
6416 }
InsertMenuItemTextnull6417 function InsertMenuItemText( menu: MenuRef; const (*var*) inString: Str255; afterItem: MenuItemIndex ): OSStatus; external name '_InsertMenuItemText';
6418 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6419
6420
6421 {
6422 * SetMenuItemText() *** DEPRECATED ***
6423 *
6424 * Deprecated:
6425 * Use SetMenuItemTextWithCFString instead of SetMenuItemText.
6426 *
6427 * Summary:
6428 * Sets the text of a menu item using a Pascal string.
6429 *
6430 * Mac OS X threading:
6431 * Not thread safe
6432 *
6433 * Availability:
6434 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6435 * CarbonLib: in CarbonLib 1.0 and later
6436 * Non-Carbon CFM: in InterfaceLib 7.1 and later
6437 }
6438 procedure SetMenuItemText( theMenu: MenuRef; item: MenuItemIndex; const (*var*) itemString: Str255 ); external name '_SetMenuItemText';
6439 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6440
6441
6442 {
6443 * GetMenuItemText() *** DEPRECATED ***
6444 *
6445 * Deprecated:
6446 * Use CopyMenuItemTextAsCFString instead of GetMenuItemText.
6447 *
6448 * Summary:
6449 * Retrieves the text of a menu item as a Pascal string.
6450 *
6451 * Mac OS X threading:
6452 * Not thread safe
6453 *
6454 * Availability:
6455 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6456 * CarbonLib: in CarbonLib 1.0 and later
6457 * Non-Carbon CFM: in InterfaceLib 7.1 and later
6458 }
6459 procedure GetMenuItemText( theMenu: MenuRef; item: MenuItemIndex; var itemString: Str255 ); external name '_GetMenuItemText';
6460 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6461
6462
6463 {
6464 * SetMenuItemTextEncoding() *** DEPRECATED ***
6465 *
6466 * Deprecated:
6467 * Use SetMenuItemTextWithCFString instead of setting an item's text
6468 * as a Str255.
6469 *
6470 * Summary:
6471 * Sets the text encoding that should be used to interpret a menu
6472 * item's Pascal string-based text.
6473 *
6474 * Mac OS X threading:
6475 * Not thread safe
6476 *
6477 * Availability:
6478 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6479 * CarbonLib: in CarbonLib 1.0 and later
6480 * Non-Carbon CFM: in AppearanceLib 1.0 and later
6481 }
SetMenuItemTextEncodingnull6482 function SetMenuItemTextEncoding( inMenu: MenuRef; inItem: MenuItemIndex; inScriptID: TextEncoding ): OSErr; external name '_SetMenuItemTextEncoding';
6483 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6484
6485
6486 {
6487 * GetMenuItemTextEncoding() *** DEPRECATED ***
6488 *
6489 * Deprecated:
6490 * Use CopyMenuItemTextAsCFString instead of retrieving a menu
6491 * item's text as a Str255.
6492 *
6493 * Summary:
6494 * Retrieves the text encoding that should be used to interpret a
6495 * menu item's Pascal string-based text.
6496 *
6497 * Mac OS X threading:
6498 * Not thread safe
6499 *
6500 * Availability:
6501 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6502 * CarbonLib: in CarbonLib 1.0 and later
6503 * Non-Carbon CFM: in AppearanceLib 1.0 and later
6504 }
GetMenuItemTextEncodingnull6505 function GetMenuItemTextEncoding( inMenu: MenuRef; inItem: MenuItemIndex; var outScriptID: TextEncoding ): OSErr; external name '_GetMenuItemTextEncoding';
6506 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6507
6508
6509 {
6510 * SetItemIcon() *** DEPRECATED ***
6511 *
6512 * Deprecated:
6513 * Use SetMenuItemIconHandle instead of SetItemIcon.
6514 *
6515 * Summary:
6516 * Sets the resource ID of an icon resource to be displayed in a
6517 * menu item.
6518 *
6519 * Mac OS X threading:
6520 * Not thread safe
6521 *
6522 * Availability:
6523 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6524 * CarbonLib: in CarbonLib 1.0 and later
6525 * Non-Carbon CFM: in InterfaceLib 7.1 and later
6526 }
6527 procedure SetItemIcon( theMenu: MenuRef; item: MenuItemIndex; iconIndex: SInt16 ); external name '_SetItemIcon';
6528 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6529
6530
6531 {
6532 * GetItemIcon() *** DEPRECATED ***
6533 *
6534 * Deprecated:
6535 * Use GetMenuItemIconHandle instead of GetItemIcon.
6536 *
6537 * Summary:
6538 * Retrieves the resource ID of an icon resource to be displayed in
6539 * a menu item.
6540 *
6541 * Mac OS X threading:
6542 * Not thread safe
6543 *
6544 * Availability:
6545 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6546 * CarbonLib: in CarbonLib 1.0 and later
6547 * Non-Carbon CFM: in InterfaceLib 7.1 and later
6548 }
6549 procedure GetItemIcon( theMenu: MenuRef; item: MenuItemIndex; var iconIndex: SInt16 ); external name '_GetItemIcon';
6550 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6551
6552
6553 {
6554 * SetMenuItemHierarchicalID() *** DEPRECATED ***
6555 *
6556 * Deprecated:
6557 * Use SetMenuItemHierarchicalMenu instead of
6558 * SetMenuItemHierarchicalID.
6559 *
6560 * Summary:
6561 * Sets the menu ID of the submenu of a menu item.
6562 *
6563 * Mac OS X threading:
6564 * Not thread safe
6565 *
6566 * Availability:
6567 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6568 * CarbonLib: in CarbonLib 1.0 and later
6569 * Non-Carbon CFM: in AppearanceLib 1.0 and later
6570 }
SetMenuItemHierarchicalIDnull6571 function SetMenuItemHierarchicalID( inMenu: MenuRef; inItem: MenuItemIndex; inHierID: MenuID ): OSErr; external name '_SetMenuItemHierarchicalID';
6572 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6573
6574
6575 {
6576 * GetMenuItemHierarchicalID() *** DEPRECATED ***
6577 *
6578 * Deprecated:
6579 * Use GetMenuItemHierarchicalMenu instead of
6580 * GetMenuItemHierarchicalID.
6581 *
6582 * Summary:
6583 * Retrieves the menu ID of the submenu of a menu item.
6584 *
6585 * Mac OS X threading:
6586 * Not thread safe
6587 *
6588 * Availability:
6589 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6590 * CarbonLib: in CarbonLib 1.0 and later
6591 * Non-Carbon CFM: in AppearanceLib 1.0 and later
6592 }
GetMenuItemHierarchicalIDnull6593 function GetMenuItemHierarchicalID( inMenu: MenuRef; inItem: MenuItemIndex; var outHierID: MenuID ): OSErr; external name '_GetMenuItemHierarchicalID';
6594 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6595
6596
6597 {
6598 * GetMenuRetainCount() *** DEPRECATED ***
6599 *
6600 * Deprecated:
6601 * In Mac OS X 10.2 and later, use CFGetRetainCount instead of
6602 * GetMenuRetainCount.
6603 *
6604 * Summary:
6605 * Returns the retain count of a menu.
6606 *
6607 * Mac OS X threading:
6608 * Not thread safe
6609 *
6610 * Parameters:
6611 *
6612 * inMenu:
6613 * The menu whose retain count to return.
6614 *
6615 * Availability:
6616 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6617 * CarbonLib: in CarbonLib 1.1 and later
6618 * Non-Carbon CFM: not available
6619 }
GetMenuRetainCountnull6620 function GetMenuRetainCount( inMenu: MenuRef ): ItemCount; external name '_GetMenuRetainCount';
6621 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6622
6623
6624 {
6625 * RetainMenu() *** DEPRECATED ***
6626 *
6627 * Deprecated:
6628 * In Mac OS X 10.2 and later, use CFRetain instead of RetainMenu.
6629 *
6630 * Summary:
6631 * Increments the retain count of a menu.
6632 *
6633 * Mac OS X threading:
6634 * Not thread safe
6635 *
6636 * Parameters:
6637 *
6638 * inMenu:
6639 * The menu whose retain count to increment.
6640 *
6641 * Availability:
6642 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6643 * CarbonLib: in CarbonLib 1.1 and later
6644 * Non-Carbon CFM: not available
6645 }
RetainMenunull6646 function RetainMenu( inMenu: MenuRef ): OSStatus; external name '_RetainMenu';
6647 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6648
6649
6650 {
6651 * ReleaseMenu() *** DEPRECATED ***
6652 *
6653 * Deprecated:
6654 * In Mac OS X 10.2 and later, use CFRelease instead of ReleaseMenu.
6655 *
6656 * Summary:
6657 * Decrements the retain count of a menu.
6658 *
6659 * Mac OS X threading:
6660 * Not thread safe
6661 *
6662 * Parameters:
6663 *
6664 * inMenu:
6665 * The menu whose retain count to decrement. If the retain count
6666 * falls to zero, the menu is destroyed.
6667 *
6668 * Availability:
6669 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6670 * CarbonLib: in CarbonLib 1.1 and later
6671 * Non-Carbon CFM: not available
6672 }
ReleaseMenunull6673 function ReleaseMenu( inMenu: MenuRef ): OSStatus; external name '_ReleaseMenu';
6674 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6675
6676
6677 {
6678 * InsertResMenu() *** DEPRECATED ***
6679 *
6680 * Deprecated:
6681 * The most comment use for this API has been to create a font menu
6682 * containing the names of 'FOND' resources. For this purpose, use
6683 * CreateStandardFontMenu, or use a font panel window instead of a
6684 * menu.
6685 *
6686 * Summary:
6687 * Inserts menu items containing the names of resources of a
6688 * specified resource type.
6689 *
6690 * Mac OS X threading:
6691 * Not thread safe
6692 *
6693 * Availability:
6694 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6695 * CarbonLib: in CarbonLib 1.0 and later
6696 * Non-Carbon CFM: in InterfaceLib 7.1 and later
6697 }
6698 procedure InsertResMenu( theMenu: MenuRef; theType: ResType; afterItem: MenuItemIndex ); external name '_InsertResMenu';
6699 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6700
6701
6702 {
6703 * AppendResMenu() *** DEPRECATED ***
6704 *
6705 * Deprecated:
6706 * The most comment use for this API has been to create a font menu
6707 * containing the names of 'FOND' resources. For this purpose, use
6708 * CreateStandardFontMenu, or use a font panel window instead of a
6709 * menu.
6710 *
6711 * Summary:
6712 * Appends menu items containing the names of resources of a
6713 * specified resource type.
6714 *
6715 * Mac OS X threading:
6716 * Not thread safe
6717 *
6718 * Availability:
6719 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6720 * CarbonLib: in CarbonLib 1.0 and later
6721 * Non-Carbon CFM: in InterfaceLib 7.1 and later
6722 }
6723 procedure AppendResMenu( theMenu: MenuRef; theType: ResType ); external name '_AppendResMenu';
6724 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6725
6726
6727 {
6728 * InsertFontResMenu() *** DEPRECATED ***
6729 *
6730 * Deprecated:
6731 * Use CreateStandardFontMenu or a font panel window instead of
6732 * InsertFontResMenu.
6733 *
6734 * Summary:
6735 * Inserts menu items containing the names of font resources.
6736 *
6737 * Mac OS X threading:
6738 * Not thread safe
6739 *
6740 * Availability:
6741 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6742 * CarbonLib: in CarbonLib 1.0 and later
6743 * Non-Carbon CFM: in InterfaceLib 7.1 and later
6744 }
6745 procedure InsertFontResMenu( theMenu: MenuRef; afterItem: MenuItemIndex; scriptFilter: SInt16 ); external name '_InsertFontResMenu';
6746 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6747
6748
6749 {
6750 * InsertIntlResMenu() *** DEPRECATED ***
6751 *
6752 * Deprecated:
6753 * The most comment use for this API has been to create a font menu
6754 * containing the names of 'FOND' resources. For this purpose, use
6755 * CreateStandardFontMenu, or use a font panel window instead of a
6756 * menu.
6757 *
6758 * Summary:
6759 * Inserts menu items containing the names of resources of a
6760 * specified resource type.
6761 *
6762 * Mac OS X threading:
6763 * Not thread safe
6764 *
6765 * Availability:
6766 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6767 * CarbonLib: in CarbonLib 1.0 and later
6768 * Non-Carbon CFM: in InterfaceLib 7.1 and later
6769 }
6770 procedure InsertIntlResMenu( theMenu: MenuRef; theType: ResType; afterItem: MenuItemIndex; scriptFilter: SInt16 ); external name '_InsertIntlResMenu';
6771 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6772
6773
6774 {
6775 * MenuKey() *** DEPRECATED ***
6776 *
6777 * Deprecated:
6778 * Use MenuEvent, IsMenuKeyEvent, or a kEventCommandProcess Carbon
6779 * event handler instead of MenuKey.
6780 *
6781 * Summary:
6782 * Determines if a character matches a menu item command key.
6783 *
6784 * Mac OS X threading:
6785 * Not thread safe
6786 *
6787 * Availability:
6788 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6789 * CarbonLib: in CarbonLib 1.0 and later
6790 * Non-Carbon CFM: in InterfaceLib 7.1 and later
6791 }
MenuKeynull6792 function MenuKey( ch: CharParameter ): SInt32; external name '_MenuKey';
6793 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6794
6795
6796 {
6797 * SetMenuFlashCount() *** DEPRECATED ***
6798 *
6799 * Deprecated:
6800 * This function has no effect on Mac OS X.
6801 *
6802 * Summary:
6803 * Sets the number of times that a selected menu item will blink.
6804 *
6805 * Mac OS X threading:
6806 * Not thread safe
6807 *
6808 * Availability:
6809 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6810 * CarbonLib: in CarbonLib 1.0 and later
6811 * Non-Carbon CFM: in CarbonAccessors.o 1.3 and later
6812 }
6813 procedure SetMenuFlashCount( count: SInt16 ); external name '_SetMenuFlashCount';
6814 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6815
6816
6817 {
6818 * InitContextualMenus() *** DEPRECATED ***
6819 *
6820 * Deprecated:
6821 * On Mac OS X, it is not necessary to call InitContextualMenus.
6822 *
6823 * Summary:
6824 * Adds the current process to the system registry of contextual
6825 * menu clients.
6826 *
6827 * Discussion:
6828 * On Mac OS 8.x and 9.x, your program should call the
6829 * InitContextualMenus function early in your startup code to
6830 * register your application as a contextual menu client. If you do
6831 * not register your program, some system-level functions may
6832 * respond as though your program does not use contextual menus. Not
6833 * registering your program may also cause
6834 * ProcessIsContextualMenuClient to return an incorrect value.
6835 *
6836 * Mac OS X threading:
6837 * Not thread safe
6838 *
6839 * Availability:
6840 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6841 * CarbonLib: in CarbonLib 1.0 and later
6842 * Non-Carbon CFM: in ContextualMenu 1.0 and later
6843 }
InitContextualMenusnull6844 function InitContextualMenus: OSStatus; external name '_InitContextualMenus';
6845 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6846
6847
6848 {
6849 * ProcessIsContextualMenuClient() *** DEPRECATED ***
6850 *
6851 * Deprecated:
6852 * There is no reason for an application to call this API.
6853 *
6854 * Summary:
6855 * Determines whether the specified process is a contextual menu
6856 * client.
6857 *
6858 * Discussion:
6859 * On Mac OS 9, this API consults a global table of all processes
6860 * that have registered with the Contextual Menu Manager by calling
6861 * InitContextualMenus. On Mac OS X, this API ignores the inPSN
6862 * parameter and always returns whether the current process is
6863 * registered with the Contextual Menu Manager.
6864 *
6865 * Mac OS X threading:
6866 * Not thread safe
6867 *
6868 * Parameters:
6869 *
6870 * inPSN:
6871 * The process to examine.
6872 *
6873 * Result:
6874 * Whether the specified process (or, on Mac OS X, the current
6875 * process) is registered with the Contextual Menu Manager.
6876 *
6877 * Availability:
6878 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6879 * CarbonLib: in CarbonLib 1.0 and later
6880 * Non-Carbon CFM: in ContextualMenu 1.0 and later
6881 }
ProcessIsContextualMenuClientnull6882 function ProcessIsContextualMenuClient( var inPSN: ProcessSerialNumber ): Boolean; external name '_ProcessIsContextualMenuClient';
6883 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6884
6885
6886 {��������������������������������������������������������������������������������������}
6887 { � Menu Item Color Tables }
6888 { Menu color manipulation is considered deprecated with the advent of the Appearance }
6889 { Manager. Avoid using these routines if possible }
6890 {��������������������������������������������������������������������������������������}
6891 {
6892 * DeleteMCEntries() *** DEPRECATED ***
6893 *
6894 * Deprecated:
6895 * Mac OS X does not support menu color tables; this API has no
6896 * effect.
6897 *
6898 * Summary:
6899 * Removes color table entries for a menu.
6900 *
6901 * Mac OS X threading:
6902 * Not thread safe
6903 *
6904 * Availability:
6905 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6906 * CarbonLib: in CarbonLib 1.0 and later
6907 * Non-Carbon CFM: in InterfaceLib 7.1 and later
6908 }
6909 procedure DeleteMCEntries( menuID_: MenuID; menuItem: SInt16 ); external name '_DeleteMCEntries';
6910 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6911
6912
6913 {
6914 * GetMCInfo() *** DEPRECATED ***
6915 *
6916 * Deprecated:
6917 * Mac OS X does not support menu color tables; this API has no
6918 * effect.
6919 *
6920 * Summary:
6921 * Retrieves color table entries for the current process.
6922 *
6923 * Mac OS X threading:
6924 * Not thread safe
6925 *
6926 * Availability:
6927 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6928 * CarbonLib: in CarbonLib 1.0 and later
6929 * Non-Carbon CFM: in InterfaceLib 7.1 and later
6930 }
GetMCInfonull6931 function GetMCInfo: MCTableHandle; external name '_GetMCInfo';
6932 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6933
6934
6935 {
6936 * SetMCInfo() *** DEPRECATED ***
6937 *
6938 * Deprecated:
6939 * Mac OS X does not support menu color tables; this API has no
6940 * effect.
6941 *
6942 * Summary:
6943 * Sets color table info for the current process.
6944 *
6945 * Mac OS X threading:
6946 * Not thread safe
6947 *
6948 * Availability:
6949 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6950 * CarbonLib: in CarbonLib 1.0 and later
6951 * Non-Carbon CFM: in InterfaceLib 7.1 and later
6952 }
6953 procedure SetMCInfo( menuCTbl: MCTableHandle ); external name '_SetMCInfo';
6954 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6955
6956
6957 {
6958 * DisposeMCInfo() *** DEPRECATED ***
6959 *
6960 * Deprecated:
6961 * Mac OS X does not support menu color tables; this API has no
6962 * effect.
6963 *
6964 * Summary:
6965 * Releases the memory used by a menu color table.
6966 *
6967 * Mac OS X threading:
6968 * Not thread safe
6969 *
6970 * Availability:
6971 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6972 * CarbonLib: in CarbonLib 1.0 and later
6973 * Non-Carbon CFM: in InterfaceLib 7.1 and later
6974 }
6975 procedure DisposeMCInfo( menuCTbl: MCTableHandle ); external name '_DisposeMCInfo';
6976 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6977
6978
6979 {
6980 * GetMCEntry() *** DEPRECATED ***
6981 *
6982 * Deprecated:
6983 * Mac OS X does not support menu color tables; this API has no
6984 * effect.
6985 *
6986 * Summary:
6987 * Returns a pointer to the menu color table entry for a menu item.
6988 *
6989 * Mac OS X threading:
6990 * Not thread safe
6991 *
6992 * Availability:
6993 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
6994 * CarbonLib: in CarbonLib 1.0 and later
6995 * Non-Carbon CFM: in InterfaceLib 7.1 and later
6996 }
GetMCEntrynull6997 function GetMCEntry( menuID_: MenuID; menuItem: SInt16 ): MCEntryPtr; external name '_GetMCEntry';
6998 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
6999
7000
7001 {
7002 * SetMCEntries() *** DEPRECATED ***
7003 *
7004 * Deprecated:
7005 * Mac OS X does not support menu color tables; this API has no
7006 * effect.
7007 *
7008 * Summary:
7009 * Sets entries in the menu color table for the current process.
7010 *
7011 * Mac OS X threading:
7012 * Not thread safe
7013 *
7014 * Availability:
7015 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
7016 * CarbonLib: in CarbonLib 1.0 and later
7017 * Non-Carbon CFM: in InterfaceLib 7.1 and later
7018 }
7019 procedure SetMCEntries( numEntries: SInt16; menuCEntries: MCTablePtr ); external name '_SetMCEntries';
7020 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
7021
7022
7023 {��������������������������������������������������������������������������������������}
7024 { ��MDEF support }
7025 {��������������������������������������������������������������������������������������}
7026 {
7027 * EraseMenuBackground() *** DEPRECATED ***
7028 *
7029 * Deprecated:
7030 * In Mac OS X 10.3 and later, use a custom HIView instead of a menu
7031 * definition function to customize the appearance of a menu.
7032 *
7033 * Summary:
7034 * Erases a portion of a menu background in preparation for further
7035 * drawing.
7036 *
7037 * Discussion:
7038 * It is necessary to erase the menu background before calling
7039 * DrawThemeMenuBackground because some themes (such as Aqua on Mac
7040 * OS X) draw the menu background using the alpha channel, and if
7041 * the area underneath the menu background is not erased, portions
7042 * of the old image will show through the menu background.
7043 *
7044 * Mac OS X threading:
7045 * Not thread safe
7046 *
7047 * Parameters:
7048 *
7049 * inMenu:
7050 * The menu whose background to erase.
7051 *
7052 * inEraseRect:
7053 * The bounds of the area to erase, in local coordinates to the
7054 * current port.
7055 *
7056 * inContext:
7057 * The CG context to erase. If NULL, EraseMenuBackground will
7058 * create a context based on the current port.
7059 *
7060 * Availability:
7061 * Mac OS X: in version 10.1 and later in Carbon.framework [32-bit only] but deprecated in 10.5
7062 * CarbonLib: in CarbonLib 1.5 and later
7063 * Non-Carbon CFM: not available
7064 }
EraseMenuBackgroundnull7065 function EraseMenuBackground( inMenu: MenuRef; const (*var*) inEraseRect: Rect; inContext: CGContextRef { can be NULL } ): OSStatus; external name '_EraseMenuBackground';
7066 (* AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
7067
7068
7069 {
7070 * ScrollMenuImage() *** DEPRECATED ***
7071 *
7072 * Deprecated:
7073 * In Mac OS X 10.3 and later, use a custom HIView instead of a menu
7074 * definition function to customize the appearance of a menu.
7075 *
7076 * Summary:
7077 * Scrolls a portion of the menu image.
7078 *
7079 * Discussion:
7080 * Menus on Mac OS X use an alpha channel, and QuickDraw does not
7081 * support alpha channels. Therefore, scrolling a menu image with
7082 * ScrollRect or other QuickDraw APIs does not work correctly; it
7083 * results in the destruction of the alpha channel data. The
7084 * ScrollMenuImage API uses CoreGraphics to move the menu image,
7085 * preserving the alpha channel.
7086 *
7087 * Mac OS X threading:
7088 * Not thread safe
7089 *
7090 * Parameters:
7091 *
7092 * inMenu:
7093 * The menu whose image to scroll.
7094 *
7095 * inScrollRect:
7096 * The bounds of the rect to scroll.
7097 *
7098 * inHScroll:
7099 * The distance to scroll horizontally.
7100 *
7101 * inVScroll:
7102 * The distance to scroll vertically.
7103 *
7104 * inContext:
7105 * The CG context to erase. If NULL, ScrollMenuImage will create a
7106 * context based on the current port.
7107 *
7108 * Availability:
7109 * Mac OS X: in version 10.1 and later in Carbon.framework [32-bit only] but deprecated in 10.5
7110 * CarbonLib: in CarbonLib 1.5 and later
7111 * Non-Carbon CFM: not available
7112 }
ScrollMenuImagenull7113 function ScrollMenuImage( inMenu: MenuRef; const (*var*) inScrollRect: Rect; inHScroll: SInt32; inVScroll: SInt32; inContext: CGContextRef { can be NULL } ): OSStatus; external name '_ScrollMenuImage';
7114 (* AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
7115
7116
7117 {$endc} {not TARGET_CPU_64}
7118
7119 type
selectornull7120 MenuBarDefProcPtr = function( selector: SInt16; message: SInt16; parameter1: SInt16; parameter2: SIGNEDLONG ): SIGNEDLONG;
7121 MenuHookProcPtr = procedure;
7122 MBarHookProcPtr = function( var menuRect: Rect ): SInt16;
7123 MenuBarDefUPP = MenuBarDefProcPtr;
7124 MenuHookUPP = MenuHookProcPtr;
7125 MBarHookUPP = MBarHookProcPtr;
7126 {
7127 * NewMenuBarDefUPP()
7128 *
7129 * Availability:
7130 * Mac OS X: not available
7131 * CarbonLib: not available
7132 * Non-Carbon CFM: available as macro/inline
7133 }
7134
7135 {
7136 * NewMenuHookUPP()
7137 *
7138 * Availability:
7139 * Mac OS X: not available
7140 * CarbonLib: not available
7141 * Non-Carbon CFM: available as macro/inline
7142 }
7143
7144 {
7145 * NewMBarHookUPP()
7146 *
7147 * Availability:
7148 * Mac OS X: not available
7149 * CarbonLib: not available
7150 * Non-Carbon CFM: available as macro/inline
7151 }
7152
7153 {
7154 * DisposeMenuBarDefUPP()
7155 *
7156 * Availability:
7157 * Mac OS X: not available
7158 * CarbonLib: not available
7159 * Non-Carbon CFM: available as macro/inline
7160 }
7161
7162 {
7163 * DisposeMenuHookUPP()
7164 *
7165 * Availability:
7166 * Mac OS X: not available
7167 * CarbonLib: not available
7168 * Non-Carbon CFM: available as macro/inline
7169 }
7170
7171 {
7172 * DisposeMBarHookUPP()
7173 *
7174 * Availability:
7175 * Mac OS X: not available
7176 * CarbonLib: not available
7177 * Non-Carbon CFM: available as macro/inline
7178 }
7179
7180 {
7181 * InvokeMenuBarDefUPP()
7182 *
7183 * Availability:
7184 * Mac OS X: not available
7185 * CarbonLib: not available
7186 * Non-Carbon CFM: available as macro/inline
7187 }
7188
7189 {
7190 * InvokeMenuHookUPP()
7191 *
7192 * Availability:
7193 * Mac OS X: not available
7194 * CarbonLib: not available
7195 * Non-Carbon CFM: available as macro/inline
7196 }
7197
7198 {
7199 * InvokeMBarHookUPP()
7200 *
7201 * Availability:
7202 * Mac OS X: not available
7203 * CarbonLib: not available
7204 * Non-Carbon CFM: available as macro/inline
7205 }
7206
7207 {$endc} {TARGET_OS_MAC}
7208
7209 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
7210 implementation
7211
7212 {$ifc TARGET_OS_MAC}
7213 {$ifc not TARGET_CPU_64}
7214
7215
7216
7217 procedure GetItemMark( theMenu: MenuRef; item: MenuItemIndex; var markChar: CharParameter ); inline;
7218 var
7219 markCharInt: UInt16;
7220 begin
7221 __GetItemMark( theMenu, item, markCharInt);
7222 markChar:= CharParameter( markCharInt)
7223 end;
7224
7225 procedure GetItemCmd( theMenu: MenuRef; item: MenuItemIndex; var cmdChar: CharParameter ); inline;
7226 var
7227 cmdCharInt: UInt16;
7228 begin
7229 __GetItemCmd( theMenu, item, cmdCharInt);
7230 cmdChar:= CharParameter( cmdCharInt)
7231 end;
7232
7233
7234 {$endc} {not TARGET_CPU_64}
7235
7236 {$endc} {TARGET_OS_MAC}
7237
7238 end.
7239
7240 {$endc} {not MACOSALLINCLUDE}
7241