1 {
2 File: HIToolbox/Events.h
3
4 Contains: Event 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: Gorazd Krosl, <gorazd_1957@yahoo.ca>, October 2009 }
19 { Pascal Translation Updated: Jonas Maebe, <jonas@freepascal.org>, October 2012 }
20 {
21 Modified for use with Free Pascal
22 Version 308
23 Please report any bugs to <gpc@microbizz.nl>
24 }
25
26 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
27 {$mode macpas}
28 {$modeswitch cblocks}
29 {$packenum 1}
30 {$macro on}
31 {$inline on}
32 {$calling mwpascal}
33
34 unit Events;
35 interface
36 {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
37 {$setc GAP_INTERFACES_VERSION := $0308}
38
39 {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
40 {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
41 {$endc}
42
43 {$ifc defined CPUPOWERPC and defined CPUI386}
44 {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
45 {$endc}
46 {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
47 {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
48 {$endc}
49
50 {$ifc not defined __ppc__ and defined CPUPOWERPC32}
51 {$setc __ppc__ := 1}
52 {$elsec}
53 {$setc __ppc__ := 0}
54 {$endc}
55 {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
56 {$setc __ppc64__ := 1}
57 {$elsec}
58 {$setc __ppc64__ := 0}
59 {$endc}
60 {$ifc not defined __i386__ and defined CPUI386}
61 {$setc __i386__ := 1}
62 {$elsec}
63 {$setc __i386__ := 0}
64 {$endc}
65 {$ifc not defined __x86_64__ and defined CPUX86_64}
66 {$setc __x86_64__ := 1}
67 {$elsec}
68 {$setc __x86_64__ := 0}
69 {$endc}
70 {$ifc not defined __arm__ and defined CPUARM}
71 {$setc __arm__ := 1}
72 {$elsec}
73 {$setc __arm__ := 0}
74 {$endc}
75 {$ifc not defined __arm64__ and defined CPUAARCH64}
76 {$setc __arm64__ := 1}
77 {$elsec}
78 {$setc __arm64__ := 0}
79 {$endc}
80
81 {$ifc defined cpu64}
82 {$setc __LP64__ := 1}
83 {$elsec}
84 {$setc __LP64__ := 0}
85 {$endc}
86
87
88 {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
89 {$error Conflicting definitions for __ppc__ and __i386__}
90 {$endc}
91
92 {$ifc defined __ppc__ and __ppc__}
93 {$setc TARGET_CPU_PPC := TRUE}
94 {$setc TARGET_CPU_PPC64 := FALSE}
95 {$setc TARGET_CPU_X86 := FALSE}
96 {$setc TARGET_CPU_X86_64 := FALSE}
97 {$setc TARGET_CPU_ARM := FALSE}
98 {$setc TARGET_CPU_ARM64 := FALSE}
99 {$setc TARGET_OS_MAC := TRUE}
100 {$setc TARGET_OS_IPHONE := FALSE}
101 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
102 {$setc TARGET_OS_EMBEDDED := FALSE}
103 {$elifc defined __ppc64__ and __ppc64__}
104 {$setc TARGET_CPU_PPC := FALSE}
105 {$setc TARGET_CPU_PPC64 := TRUE}
106 {$setc TARGET_CPU_X86 := FALSE}
107 {$setc TARGET_CPU_X86_64 := FALSE}
108 {$setc TARGET_CPU_ARM := FALSE}
109 {$setc TARGET_CPU_ARM64 := FALSE}
110 {$setc TARGET_OS_MAC := TRUE}
111 {$setc TARGET_OS_IPHONE := FALSE}
112 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
113 {$setc TARGET_OS_EMBEDDED := FALSE}
114 {$elifc defined __i386__ and __i386__}
115 {$setc TARGET_CPU_PPC := FALSE}
116 {$setc TARGET_CPU_PPC64 := FALSE}
117 {$setc TARGET_CPU_X86 := TRUE}
118 {$setc TARGET_CPU_X86_64 := FALSE}
119 {$setc TARGET_CPU_ARM := FALSE}
120 {$setc TARGET_CPU_ARM64 := FALSE}
121 {$ifc defined iphonesim}
122 {$setc TARGET_OS_MAC := FALSE}
123 {$setc TARGET_OS_IPHONE := TRUE}
124 {$setc TARGET_IPHONE_SIMULATOR := TRUE}
125 {$elsec}
126 {$setc TARGET_OS_MAC := TRUE}
127 {$setc TARGET_OS_IPHONE := FALSE}
128 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
129 {$endc}
130 {$setc TARGET_OS_EMBEDDED := FALSE}
131 {$elifc defined __x86_64__ and __x86_64__}
132 {$setc TARGET_CPU_PPC := FALSE}
133 {$setc TARGET_CPU_PPC64 := FALSE}
134 {$setc TARGET_CPU_X86 := FALSE}
135 {$setc TARGET_CPU_X86_64 := TRUE}
136 {$setc TARGET_CPU_ARM := FALSE}
137 {$setc TARGET_CPU_ARM64 := FALSE}
138 {$ifc defined iphonesim}
139 {$setc TARGET_OS_MAC := FALSE}
140 {$setc TARGET_OS_IPHONE := TRUE}
141 {$setc TARGET_IPHONE_SIMULATOR := TRUE}
142 {$elsec}
143 {$setc TARGET_OS_MAC := TRUE}
144 {$setc TARGET_OS_IPHONE := FALSE}
145 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
146 {$endc}
147 {$setc TARGET_OS_EMBEDDED := FALSE}
148 {$elifc defined __arm__ and __arm__}
149 {$setc TARGET_CPU_PPC := FALSE}
150 {$setc TARGET_CPU_PPC64 := FALSE}
151 {$setc TARGET_CPU_X86 := FALSE}
152 {$setc TARGET_CPU_X86_64 := FALSE}
153 {$setc TARGET_CPU_ARM := TRUE}
154 {$setc TARGET_CPU_ARM64 := FALSE}
155 {$setc TARGET_OS_MAC := FALSE}
156 {$setc TARGET_OS_IPHONE := TRUE}
157 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
158 {$setc TARGET_OS_EMBEDDED := TRUE}
159 {$elifc defined __arm64__ and __arm64__}
160 {$setc TARGET_CPU_PPC := FALSE}
161 {$setc TARGET_CPU_PPC64 := FALSE}
162 {$setc TARGET_CPU_X86 := FALSE}
163 {$setc TARGET_CPU_X86_64 := FALSE}
164 {$setc TARGET_CPU_ARM := FALSE}
165 {$setc TARGET_CPU_ARM64 := TRUE}
166 {$ifc defined ios}
167 {$setc TARGET_OS_MAC := FALSE}
168 {$setc TARGET_OS_IPHONE := TRUE}
169 {$setc TARGET_OS_EMBEDDED := TRUE}
170 {$elsec}
171 {$setc TARGET_OS_MAC := TRUE}
172 {$setc TARGET_OS_IPHONE := FALSE}
173 {$setc TARGET_OS_EMBEDDED := FALSE}
174 {$endc}
175 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
176 {$elsec}
177 {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
178 {$endc}
179
180 {$ifc defined __LP64__ and __LP64__ }
181 {$setc TARGET_CPU_64 := TRUE}
182 {$elsec}
183 {$setc TARGET_CPU_64 := FALSE}
184 {$endc}
185
186 {$ifc defined FPC_BIG_ENDIAN}
187 {$setc TARGET_RT_BIG_ENDIAN := TRUE}
188 {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
189 {$elifc defined FPC_LITTLE_ENDIAN}
190 {$setc TARGET_RT_BIG_ENDIAN := FALSE}
191 {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
192 {$elsec}
193 {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
194 {$endc}
195 {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
196 {$setc CALL_NOT_IN_CARBON := FALSE}
197 {$setc OLDROUTINENAMES := FALSE}
198 {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
199 {$setc OPAQUE_UPP_TYPES := TRUE}
200 {$setc OTCARBONAPPLICATION := TRUE}
201 {$setc OTKERNEL := FALSE}
202 {$setc PM_USE_SESSION_APIS := TRUE}
203 {$setc TARGET_API_MAC_CARBON := TRUE}
204 {$setc TARGET_API_MAC_OS8 := FALSE}
205 {$setc TARGET_API_MAC_OSX := TRUE}
206 {$setc TARGET_CARBON := TRUE}
207 {$setc TARGET_CPU_68K := FALSE}
208 {$setc TARGET_CPU_MIPS := FALSE}
209 {$setc TARGET_CPU_SPARC := FALSE}
210 {$setc TARGET_OS_UNIX := FALSE}
211 {$setc TARGET_OS_WIN32 := FALSE}
212 {$setc TARGET_RT_MAC_68881 := FALSE}
213 {$setc TARGET_RT_MAC_CFM := FALSE}
214 {$setc TARGET_RT_MAC_MACHO := TRUE}
215 {$setc TYPED_FUNCTION_POINTERS := TRUE}
216 {$setc TYPE_BOOL := FALSE}
217 {$setc TYPE_EXTENDED := FALSE}
218 {$setc TYPE_LONGLONG := TRUE}
219 uses MacTypes,OSUtils,QuickdrawTypes,Endian;
220 {$endc} {not MACOSALLINCLUDE}
221
222
223 {$ifc TARGET_OS_MAC}
224
225 {$ALIGN MAC68K}
226
227 type
228 EventKind = UInt16;
229 EventMask = UInt16;
230 const
231 nullEvent = 0;
232 mouseDown = 1;
233 mouseUp = 2;
234 keyDown = 3;
235 keyUp = 4;
236 autoKey = 5;
237 updateEvt = 6;
238 diskEvt = 7; { Not sent in Carbon. See kEventClassVolume in CarbonEvents.h}
239 activateEvt = 8;
240 osEvt = 15;
241 kHighLevelEvent = 23;
242
243 const
244 mDownMask = 1 shl mouseDown; { mouse button pressed}
245 mUpMask = 1 shl mouseUp; { mouse button released}
246 keyDownMask = 1 shl keyDown; { key pressed}
247 keyUpMask = 1 shl keyUp; { key released}
248 autoKeyMask = 1 shl autoKey; { key repeatedly held down}
249 updateMask = 1 shl updateEvt; { window needs updating}
250 diskMask = 1 shl diskEvt; { disk inserted}
251 activMask = 1 shl activateEvt; { activate/deactivate window}
252 highLevelEventMask = $0400; { high-level events (includes AppleEvents)}
253 osMask = 1 shl osEvt; { operating system events (suspend, resume)}
254 everyEvent = $FFFF; { all of the above}
255
256 const
257 charCodeMask = $000000FF;
258 keyCodeMask = $0000FF00;
259 adbAddrMask = $00FF0000;
260 osEvtMessageMask = $FF000000;
261
262 const
263 { OS event messages. Event (sub)code is in the high byte of the message field.}
264 mouseMovedMessage = $00FA;
265 suspendResumeMessage = $0001;
266
267 const
268 resumeFlag = 1; { Bit 0 of message indicates resume vs suspend}
269
270
271 {
272 CARBON ALERT! BATTLESTATIONS!
273
274 The EventModifiers bits defined here are also used in the newer Carbon Event
275 key modifiers parameters. There are two main differences:
276
277 1) The Carbon key modifiers parameter is a UInt32, not a UInt16. Never try to
278 extract the key modifiers parameter from a Carbon Event into an EventModifiers
279 type. You will probably get your stack trashed.
280 2) The Carbon key modifiers is just that: key modifiers. That parameter will
281 never contain the button state bit.
282 }
283 type
284 EventModifiers = UInt16;
285 const
286 { modifiers }
287 activeFlagBit = 0; { activate? (activateEvt and mouseDown)}
288 btnStateBit = 7; { state of button?}
289 cmdKeyBit = 8; { command key down?}
290 shiftKeyBit = 9; { shift key down?}
291 alphaLockBit = 10; { alpha lock down?}
292 optionKeyBit = 11; { option key down?}
293 controlKeyBit = 12; { control key down?}
294 rightShiftKeyBit = 13; { right shift key down? Not supported on Mac OS X.}
295 rightOptionKeyBit = 14; { right Option key down? Not supported on Mac OS X.}
296 rightControlKeyBit = 15; { right Control key down? Not supported on Mac OS X.}
297
298 const
299 activeFlag = 1 shl activeFlagBit;
300 btnState = 1 shl btnStateBit;
301 cmdKey = 1 shl cmdKeyBit;
302 shiftKey = 1 shl shiftKeyBit;
303 alphaLock = 1 shl alphaLockBit;
304 optionKey = 1 shl optionKeyBit;
305 controlKey = 1 shl controlKeyBit;
306 rightShiftKey = 1 shl rightShiftKeyBit; { Not supported on Mac OS X.}
307 rightOptionKey = 1 shl rightOptionKeyBit; { Not supported on Mac OS X.}
308 rightControlKey = 1 shl rightControlKeyBit; { Not supported on Mac OS X.}
309
310 { MacRoman character codes}
311 const
312 kNullCharCode = 0;
313 kHomeCharCode = 1;
314 kEnterCharCode = 3;
315 kEndCharCode = 4;
316 kHelpCharCode = 5;
317 kBellCharCode = 7;
318 kBackspaceCharCode = 8;
319 kTabCharCode = 9;
320 kLineFeedCharCode = 10;
321 kVerticalTabCharCode = 11;
322 kPageUpCharCode = 11;
323 kFormFeedCharCode = 12;
324 kPageDownCharCode = 12;
325 kReturnCharCode = 13;
326 kFunctionKeyCharCode = 16;
327 kCommandCharCode = 17; { glyph available only in system fonts}
328 kCheckCharCode = 18; { glyph available only in system fonts}
329 kDiamondCharCode = 19; { glyph available only in system fonts}
330 kAppleLogoCharCode = 20; { glyph available only in system fonts}
331 kEscapeCharCode = 27;
332 kClearCharCode = 27;
333 kLeftArrowCharCode = 28;
334 kRightArrowCharCode = 29;
335 kUpArrowCharCode = 30;
336 kDownArrowCharCode = 31;
337 kSpaceCharCode = 32;
338 kDeleteCharCode = 127;
339 kBulletCharCode = 165;
340 kNonBreakingSpaceCharCode = 202;
341
342 { useful Unicode code points}
343 const
344 kShiftUnicode = $21E7; { Unicode UPWARDS WHITE ARROW}
345 kControlUnicode = $2303; { Unicode UP ARROWHEAD}
346 kOptionUnicode = $2325; { Unicode OPTION KEY}
347 kCommandUnicode = $2318; { Unicode PLACE OF INTEREST SIGN}
348 kPencilUnicode = $270E; { Unicode LOWER RIGHT PENCIL; actually pointed left until Mac OS X 10.3}
349 kPencilLeftUnicode = $F802; { Unicode LOWER LEFT PENCIL; available in Mac OS X 10.3 and later}
350 kCheckUnicode = $2713; { Unicode CHECK MARK}
351 kDiamondUnicode = $25C6; { Unicode BLACK DIAMOND}
352 kBulletUnicode = $2022; { Unicode BULLET}
353 kAppleLogoUnicode = $F8FF; { Unicode APPLE LOGO}
354
355
356 {
357 * Summary:
358 * Virtual keycodes
359 *
360 * Discussion:
361 * These constants are the virtual keycodes defined originally in
362 * Inside Mac Volume V, pg. V-191. They identify physical keys on a
363 * keyboard. Those constants with "ANSI" in the name are labeled
364 * according to the key position on an ANSI-standard US keyboard.
365 * For example, kVK_ANSI_A indicates the virtual keycode for the key
366 * with the letter 'A' in the US keyboard layout. Other keyboard
367 * layouts may have the 'A' key label on a different physical key;
368 * in this case, pressing 'A' will generate a different virtual
369 * keycode.
370 }
371 const
372 kVK_ANSI_A = $00;
373 kVK_ANSI_S = $01;
374 kVK_ANSI_D = $02;
375 kVK_ANSI_F = $03;
376 kVK_ANSI_H = $04;
377 kVK_ANSI_G = $05;
378 kVK_ANSI_Z = $06;
379 kVK_ANSI_X = $07;
380 kVK_ANSI_C = $08;
381 kVK_ANSI_V = $09;
382 kVK_ANSI_B = $0B;
383 kVK_ANSI_Q = $0C;
384 kVK_ANSI_W = $0D;
385 kVK_ANSI_E = $0E;
386 kVK_ANSI_R = $0F;
387 kVK_ANSI_Y = $10;
388 kVK_ANSI_T = $11;
389 kVK_ANSI_1 = $12;
390 kVK_ANSI_2 = $13;
391 kVK_ANSI_3 = $14;
392 kVK_ANSI_4 = $15;
393 kVK_ANSI_6 = $16;
394 kVK_ANSI_5 = $17;
395 kVK_ANSI_Equal = $18;
396 kVK_ANSI_9 = $19;
397 kVK_ANSI_7 = $1A;
398 kVK_ANSI_Minus = $1B;
399 kVK_ANSI_8 = $1C;
400 kVK_ANSI_0 = $1D;
401 kVK_ANSI_RightBracket = $1E;
402 kVK_ANSI_O = $1F;
403 kVK_ANSI_U = $20;
404 kVK_ANSI_LeftBracket = $21;
405 kVK_ANSI_I = $22;
406 kVK_ANSI_P = $23;
407 kVK_ANSI_L = $25;
408 kVK_ANSI_J = $26;
409 kVK_ANSI_Quote = $27;
410 kVK_ANSI_K = $28;
411 kVK_ANSI_Semicolon = $29;
412 kVK_ANSI_Backslash = $2A;
413 kVK_ANSI_Comma = $2B;
414 kVK_ANSI_Slash = $2C;
415 kVK_ANSI_N = $2D;
416 kVK_ANSI_M = $2E;
417 kVK_ANSI_Period = $2F;
418 kVK_ANSI_Grave = $32;
419 kVK_ANSI_KeypadDecimal = $41;
420 kVK_ANSI_KeypadMultiply = $43;
421 kVK_ANSI_KeypadPlus = $45;
422 kVK_ANSI_KeypadClear = $47;
423 kVK_ANSI_KeypadDivide = $4B;
424 kVK_ANSI_KeypadEnter = $4C;
425 kVK_ANSI_KeypadMinus = $4E;
426 kVK_ANSI_KeypadEquals = $51;
427 kVK_ANSI_Keypad0 = $52;
428 kVK_ANSI_Keypad1 = $53;
429 kVK_ANSI_Keypad2 = $54;
430 kVK_ANSI_Keypad3 = $55;
431 kVK_ANSI_Keypad4 = $56;
432 kVK_ANSI_Keypad5 = $57;
433 kVK_ANSI_Keypad6 = $58;
434 kVK_ANSI_Keypad7 = $59;
435 kVK_ANSI_Keypad8 = $5B;
436 kVK_ANSI_Keypad9 = $5C;
437
438 { keycodes for keys that are independent of keyboard layout}
439 const
440 kVK_Return = $24;
441 kVK_Tab = $30;
442 kVK_Space = $31;
443 kVK_Delete = $33;
444 kVK_Escape = $35;
445 kVK_Command = $37;
446 kVK_Shift = $38;
447 kVK_CapsLock = $39;
448 kVK_Option = $3A;
449 kVK_Control = $3B;
450 kVK_RightShift = $3C;
451 kVK_RightOption = $3D;
452 kVK_RightControl = $3E;
453 kVK_Function = $3F;
454 kVK_F17 = $40;
455 kVK_VolumeUp = $48;
456 kVK_VolumeDown = $49;
457 kVK_Mute = $4A;
458 kVK_F18 = $4F;
459 kVK_F19 = $50;
460 kVK_F20 = $5A;
461 kVK_F5 = $60;
462 kVK_F6 = $61;
463 kVK_F7 = $62;
464 kVK_F3 = $63;
465 kVK_F8 = $64;
466 kVK_F9 = $65;
467 kVK_F11 = $67;
468 kVK_F13 = $69;
469 kVK_F16 = $6A;
470 kVK_F14 = $6B;
471 kVK_F10 = $6D;
472 kVK_F12 = $6F;
473 kVK_F15 = $71;
474 kVK_Help = $72;
475 kVK_Home = $73;
476 kVK_PageUp = $74;
477 kVK_ForwardDelete = $75;
478 kVK_F4 = $76;
479 kVK_End = $77;
480 kVK_F2 = $78;
481 kVK_PageDown = $79;
482 kVK_F1 = $7A;
483 kVK_LeftArrow = $7B;
484 kVK_RightArrow = $7C;
485 kVK_DownArrow = $7D;
486 kVK_UpArrow = $7E;
487
488 { ISO keyboards only}
489 const
490 kVK_ISO_Section = $0A;
491
492 { JIS keyboards only}
493 const
494 kVK_JIS_Yen = $5D;
495 kVK_JIS_Underscore = $5E;
496 kVK_JIS_KeypadComma = $5F;
497 kVK_JIS_Eisu = $66;
498 kVK_JIS_Kana = $68;
499
500 type
501 EventRecord = record
502 what: EventKind;
503 message: UNSIGNEDLONG;
504 when: UInt32;
505 where: Point;
506 modifiers: EventModifiers;
507 end;
508 EventRecordPtr = ^EventRecord;
509 type
510 FKEYProcPtr = procedure;
511 FKEYUPP = FKEYProcPtr;
512 {
513 * NewFKEYUPP()
514 *
515 * Availability:
516 * Mac OS X: not available
517 * CarbonLib: not available
518 * Non-Carbon CFM: available as macro/inline
519 }
520
521 {
522 * DisposeFKEYUPP()
523 *
524 * Availability:
525 * Mac OS X: not available
526 * CarbonLib: not available
527 * Non-Carbon CFM: available as macro/inline
528 }
529
530 {
531 * InvokeFKEYUPP()
532 *
533 * Availability:
534 * Mac OS X: not available
535 * CarbonLib: not available
536 * Non-Carbon CFM: available as macro/inline
537 }
538
539 {$ifc not TARGET_CPU_64}
540 {
541 * GetMouse() *** DEPRECATED ***
542 *
543 * Deprecated:
544 * Use HIGetMousePosition instead.
545 *
546 * Mac OS X threading:
547 * Not thread safe
548 *
549 * Availability:
550 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
551 * CarbonLib: in CarbonLib 1.0 and later
552 * Non-Carbon CFM: in InterfaceLib 7.1 and later
553 }
554 procedure GetMouse( var mouseLoc: Point ); external name '_GetMouse';
555 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
556
557
558 {$endc} {not TARGET_CPU_64}
559
560 {
561 * Button() *** DEPRECATED ***
562 *
563 * Deprecated:
564 * Use GetCurrentButtonState or GetCurrentEventButtonState instead.
565 *
566 * Mac OS X threading:
567 * Not thread safe
568 *
569 * Availability:
570 * Mac OS X: in version 10.0 and later in Carbon.framework but deprecated in 10.6
571 * CarbonLib: in CarbonLib 1.0 and later
572 * Non-Carbon CFM: in InterfaceLib 7.1 and later
573 }
Buttonnull574 function Button: Boolean; external name '_Button';
575 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)
576
577
578 {$ifc not TARGET_CPU_64}
579 {
580 * StillDown()
581 *
582 * Mac OS X threading:
583 * Not thread safe
584 *
585 * Availability:
586 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
587 * CarbonLib: in CarbonLib 1.0 and later
588 * Non-Carbon CFM: in InterfaceLib 7.1 and later
589 }
StillDownnull590 function StillDown: Boolean; external name '_StillDown';
591 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
592
593
594 {
595 * WaitMouseUp()
596 *
597 * Mac OS X threading:
598 * Not thread safe
599 *
600 * Availability:
601 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
602 * CarbonLib: in CarbonLib 1.0 and later
603 * Non-Carbon CFM: in InterfaceLib 7.1 and later
604 }
WaitMouseUpnull605 function WaitMouseUp: Boolean; external name '_WaitMouseUp';
606 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
607
608
609 {
610 * KeyTranslate() *** DEPRECATED ***
611 *
612 * Deprecated:
613 * Use UCKeyTranslate instead.
614 *
615 * Mac OS X threading:
616 * Not thread safe
617 *
618 * Availability:
619 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.6
620 * CarbonLib: in CarbonLib 1.0 and later
621 * Non-Carbon CFM: in InterfaceLib 7.1 and later
622 }
KeyTranslatenull623 function KeyTranslate( transData: {const} UnivPtr; keycode: UInt16; var state: UInt32 ): UInt32; external name '_KeyTranslate';
624 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)
625
626
627 {
628 * GetCaretTime()
629 *
630 * Mac OS X threading:
631 * Not thread safe
632 *
633 * Availability:
634 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
635 * CarbonLib: in CarbonLib 1.0 and later
636 * Non-Carbon CFM: in InterfaceLib 7.1 and later
637 }
GetCaretTimenull638 function GetCaretTime: UInt32; external name '_GetCaretTime';
639 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
640
641
642 {$endc} {not TARGET_CPU_64}
643
644 {
645 QuickTime 3.0 supports GetKeys() on unix and win32
646 }
647 type
648 KeyMap = packed array [0..127] of boolean;
649 {
650 * GetKeys()
651 *
652 * Mac OS X threading:
653 * Not thread safe
654 *
655 * Availability:
656 * Mac OS X: in version 10.0 and later in Carbon.framework
657 * CarbonLib: in CarbonLib 1.0 and later
658 * Non-Carbon CFM: in InterfaceLib 7.1 and later
659 }
660 procedure __GetKeys( var theKeys: KeyMap ); external name '_GetKeys';
661 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
662
663 {
664 With GPC and FPC on PowerPC, the bytes of the KeyMap must be swapped
665 }
666
667 procedure GetKeys( var theKeys: KeyMap );
668
669 { Obsolete event types & masks }
670 const
671 networkEvt = 10;
672 driverEvt = 11;
673 app1Evt = 12;
674 app2Evt = 13;
675 app3Evt = 14;
676 app4Evt = 15;
677 networkMask = $0400;
678 driverMask = $0800;
679 app1Mask = $1000;
680 app2Mask = $2000;
681 app3Mask = $4000;
682 app4Mask = $8000;
683
684 type
685 EvQEl = record
686 qLink: QElemPtr;
687 qType: SInt16;
688 evtQWhat: EventKind; { this part is identical to the EventRecord as defined above }
689 evtQMessage: UNSIGNEDLONG;
690 evtQWhen: UInt32;
691 evtQWhere: Point;
692 evtQModifiers: EventModifiers;
693 end;
694 EvQElPtr = ^EvQEl;
695 type
696 GetNextEventFilterProcPtr = procedure( var theEvent: EventRecord; var result: Boolean );
697 GetNextEventFilterUPP = GetNextEventFilterProcPtr;
698 {
699 * NewGetNextEventFilterUPP()
700 *
701 * Availability:
702 * Mac OS X: not available
703 * CarbonLib: not available
704 * Non-Carbon CFM: available as macro/inline
705 }
706
707 {
708 * DisposeGetNextEventFilterUPP()
709 *
710 * Availability:
711 * Mac OS X: not available
712 * CarbonLib: not available
713 * Non-Carbon CFM: available as macro/inline
714 }
715
716 {
717 * InvokeGetNextEventFilterUPP()
718 *
719 * Availability:
720 * Mac OS X: not available
721 * CarbonLib: not available
722 * Non-Carbon CFM: available as macro/inline
723 }
724
725 type
726 GNEFilterUPP = GetNextEventFilterUPP;
727 {$ifc not TARGET_CPU_64}
728 {
729 * GetDblTime()
730 *
731 * Summary:
732 * Returns the maximum time (in units of 1/60th of a second) allowed
733 * between two consecutive mouse-down events in order for the second
734 * click to be considered a double-click.
735 *
736 * Discussion:
737 * In 64-bit applications, you may replace calls to this API with
738 * calls to NXClickTime (declared in
739 * <IOKit/hidsystem/event_status_driver.h>) or with +[NSEvent
740 * doubleClickInterval] (available in Mac OS X 10.6 and later).
741 *
742 * Mac OS X threading:
743 * Not thread safe
744 *
745 * Result:
746 * The maximum time between mouse-downs allowed for a double-click.
747 *
748 * Availability:
749 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
750 * CarbonLib: in CarbonLib 1.0 and later
751 * Non-Carbon CFM: in InterfaceLib 7.1 and later
752 }
GetDblTimenull753 function GetDblTime: UInt32; external name '_GetDblTime';
754 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
755
756
757 {
758 * SetEventMask()
759 *
760 * Mac OS X threading:
761 * Not thread safe
762 *
763 * Availability:
764 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
765 * CarbonLib: in CarbonLib 1.0 and later
766 * Non-Carbon CFM: in InterfaceLib 7.1 and later
767 }
768 procedure SetEventMask( value: EventMask ); external name '_SetEventMask';
769 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
770
771
772 {
773 * GetNextEvent() *** DEPRECATED ***
774 *
775 * Deprecated:
776 * Use ReceiveNextEvent instead.
777 *
778 * Mac OS X threading:
779 * Not thread safe
780 *
781 * Availability:
782 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.6
783 * CarbonLib: in CarbonLib 1.0 and later
784 * Non-Carbon CFM: in InterfaceLib 7.1 and later
785 }
GetNextEventnull786 function GetNextEvent( eventMask_: EventMask; var theEvent: EventRecord ): Boolean; external name '_GetNextEvent';
787 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)
788
789
790 {
791 * WaitNextEvent() *** DEPRECATED ***
792 *
793 * Deprecated:
794 * Use ReceiveNextEvent instead.
795 *
796 * Mac OS X threading:
797 * Not thread safe
798 *
799 * Availability:
800 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.6
801 * CarbonLib: in CarbonLib 1.0 and later
802 * Non-Carbon CFM: in InterfaceLib 7.1 and later
803 }
WaitNextEventnull804 function WaitNextEvent( eventMask_: EventMask; var theEvent: EventRecord; sleep: UInt32; mouseRgn: RgnHandle { can be NULL } ): Boolean; external name '_WaitNextEvent';
805 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)
806
807
808 {
809 * EventAvail() *** DEPRECATED ***
810 *
811 * Deprecated:
812 * Use FindSpecificEventInQueue instead.
813 *
814 * Mac OS X threading:
815 * Not thread safe
816 *
817 * Availability:
818 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.6
819 * CarbonLib: in CarbonLib 1.0 and later
820 * Non-Carbon CFM: in InterfaceLib 7.1 and later
821 }
EventAvailnull822 function EventAvail( eventMask_: EventMask; var theEvent: EventRecord ): Boolean; external name '_EventAvail';
823 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)
824
825
826 {
827 * PostEvent() *** DEPRECATED ***
828 *
829 * Deprecated:
830 * Use PostEventToQueue or CGEventPost instead.
831 *
832 * Mac OS X threading:
833 * Not thread safe
834 *
835 * Availability:
836 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.6
837 * CarbonLib: in CarbonLib 1.0 and later
838 * Non-Carbon CFM: in InterfaceLib 7.1 and later
839 }
PostEventnull840 function PostEvent( eventNum: EventKind; eventMsg: UInt32 ): OSErr; external name '_PostEvent';
841 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)
842
843
844 {$endc} {not TARGET_CPU_64}
845
846 {
847 * FlushEvents() *** DEPRECATED ***
848 *
849 * Deprecated:
850 * Use FlushEventsMatchingListFromQueue,
851 * FlushSpecificEventsFromQueue, or FlushEventQueue instead.
852 *
853 * Mac OS X threading:
854 * Not thread safe
855 *
856 * Availability:
857 * Mac OS X: in version 10.0 and later in Carbon.framework but deprecated in 10.6
858 * CarbonLib: in CarbonLib 1.0 and later
859 * Non-Carbon CFM: in InterfaceLib 7.1 and later
860 }
861 procedure FlushEvents( whichMask: EventMask; stopMask: EventMask ); external name '_FlushEvents';
862 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)
863
864
865 (*
866 #if OLDROUTINENAMES
867 #define KeyTrans(transData, keycode, state) KeyTranslate(transData, keycode, state)
868 #endif { OLDROUTINENAMES }
869 *)
870
871
872 {$ifc not TARGET_CPU_64}
873 {
874 * KeyScript() *** DEPRECATED ***
875 *
876 * Deprecated:
877 * Use TISSelectInputSource API for positive verbs (ScriptCode).
878 * Use TSMDocument properties to restrict input sources:
879 * kTSMDocumentEnabledInputSourcesPropertyTag
880 * kTSMDocumentInputSourceOverridePropertyTag
881 *
882 * Summary:
883 * Switch to the specified script's default (last used) input source.
884 *
885 * Mac OS X threading:
886 * Not thread safe
887 *
888 * Availability:
889 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only] but deprecated in 10.5
890 * CarbonLib: in CarbonLib 1.0 and later
891 * Non-Carbon CFM: in InterfaceLib 7.1 and later
892 }
893 procedure KeyScript( code: SInt16 ); external name '_KeyScript';
894 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
895
896
897 {$endc} {not TARGET_CPU_64}
898
899 {
900 * IsCmdChar() *** DEPRECATED ***
901 *
902 * Deprecated:
903 * Use IsUserCancelEventRef or CheckEventQueueForUserCancel instead.
904 *
905 * Mac OS X threading:
906 * Not thread safe
907 *
908 * Availability:
909 * Mac OS X: in version 10.0 and later in Carbon.framework but deprecated in 10.6
910 * CarbonLib: in CarbonLib 1.0 and later
911 * Non-Carbon CFM: in InterfaceLib 7.1 and later
912 }
IsCmdCharnull913 function IsCmdChar( const (*var*) event: EventRecord; test: SInt16 ): Boolean; external name '_IsCmdChar';
914 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_6 *)
915
916
917 {
918 LowMem accessor functions previously in LowMem.h
919 }
920 {
921 * LMGetKeyThresh()
922 *
923 * Mac OS X threading:
924 * Not thread safe
925 *
926 * Availability:
927 * Mac OS X: in version 10.0 and later in Carbon.framework
928 * CarbonLib: in CarbonLib 1.0 and later
929 * Non-Carbon CFM: in InterfaceLib 7.1 and later
930 }
LMGetKeyThreshnull931 function LMGetKeyThresh: SInt16; external name '_LMGetKeyThresh';
932 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
933
934
935 {$ifc not TARGET_CPU_64}
936 {
937 * LMSetKeyThresh()
938 *
939 * Mac OS X threading:
940 * Not thread safe
941 *
942 * Availability:
943 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
944 * CarbonLib: in CarbonLib 1.0 and later
945 * Non-Carbon CFM: in InterfaceLib 7.1 and later
946 }
947 procedure LMSetKeyThresh( value: SInt16 ); external name '_LMSetKeyThresh';
948 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
949
950
951 {$endc} {not TARGET_CPU_64}
952
953 {
954 * LMGetKeyRepThresh()
955 *
956 * Mac OS X threading:
957 * Not thread safe
958 *
959 * Availability:
960 * Mac OS X: in version 10.0 and later in Carbon.framework
961 * CarbonLib: in CarbonLib 1.0 and later
962 * Non-Carbon CFM: in InterfaceLib 7.1 and later
963 }
LMGetKeyRepThreshnull964 function LMGetKeyRepThresh: SInt16; external name '_LMGetKeyRepThresh';
965 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
966
967
968 {$ifc not TARGET_CPU_64}
969 {
970 * LMSetKeyRepThresh()
971 *
972 * Mac OS X threading:
973 * Not thread safe
974 *
975 * Availability:
976 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
977 * CarbonLib: in CarbonLib 1.0 and later
978 * Non-Carbon CFM: in InterfaceLib 7.1 and later
979 }
980 procedure LMSetKeyRepThresh( value: SInt16 ); external name '_LMSetKeyRepThresh';
981 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
982
983
984 {$endc} {not TARGET_CPU_64}
985
986 {
987 * LMGetKbdLast()
988 *
989 * Mac OS X threading:
990 * Not thread safe
991 *
992 * Availability:
993 * Mac OS X: in version 10.0 and later in Carbon.framework
994 * CarbonLib: in CarbonLib 1.0 and later
995 * Non-Carbon CFM: in InterfaceLib 7.1 and later
996 }
LMGetKbdLastnull997 function LMGetKbdLast: UInt8; external name '_LMGetKbdLast';
998 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
999
1000
1001 {$ifc not TARGET_CPU_64}
1002 {
1003 * LMSetKbdLast()
1004 *
1005 * Mac OS X threading:
1006 * Not thread safe
1007 *
1008 * Availability:
1009 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1010 * CarbonLib: in CarbonLib 1.0 and later
1011 * Non-Carbon CFM: in InterfaceLib 7.1 and later
1012 }
1013 procedure LMSetKbdLast( value: UInt8 ); external name '_LMSetKbdLast';
1014 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1015
1016
1017 {$endc} {not TARGET_CPU_64}
1018
1019 {
1020 * LMGetKbdType()
1021 *
1022 * Mac OS X threading:
1023 * Not thread safe
1024 *
1025 * Availability:
1026 * Mac OS X: in version 10.0 and later in Carbon.framework
1027 * CarbonLib: in CarbonLib 1.0 and later
1028 * Non-Carbon CFM: in InterfaceLib 7.1 and later
1029 }
LMGetKbdTypenull1030 function LMGetKbdType: UInt8; external name '_LMGetKbdType';
1031 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1032
1033
1034 {$ifc not TARGET_CPU_64}
1035 {
1036 * LMSetKbdType()
1037 *
1038 * Mac OS X threading:
1039 * Not thread safe
1040 *
1041 * Availability:
1042 * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
1043 * CarbonLib: in CarbonLib 1.0 and later
1044 * Non-Carbon CFM: in InterfaceLib 7.1 and later
1045 }
1046 procedure LMSetKbdType( value: UInt8 ); external name '_LMSetKbdType';
1047 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1048
1049
1050 {$endc} {not TARGET_CPU_64}
1051 {$endc} {TARGET_OS_MAC}
1052
1053 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
1054 implementation
1055
1056 {$ifc TARGET_OS_MAC}
1057
1058
1059 {$ifc TARGET_RT_BIG_ENDIAN}
1060
1061 procedure GetKeys( var theKeys: KeyMap );
1062 var
1063 theReverseKeys: KeyMap;
1064 theKey: 0..127;
1065 begin
1066 __GetKeys( theReverseKeys);
1067 for theKey:= 0 to 127 do
1068 theKeys[ theKey]:= theReverseKeys[ ((theKey div 8) * 8) + (7 - (theKey mod 8))]
1069 end;
1070
1071 {$elsec}
1072
1073 procedure GetKeys( var theKeys: KeyMap );
1074 begin
1075 __GetKeys( theKeys)
1076 end;
1077
1078 {$endc}
1079
1080
1081 {$endc} {TARGET_OS_MAC}
1082
1083 end.
1084
1085 {$endc} {not MACOSALLINCLUDE}
1086