1 {
2      File:       HIToolbox/CarbonEventsCore.h
3 
4      Contains:   Carbon Event Manager
5 
6      Version:    HIToolbox-624~3
7 
8      Copyright:  � 1999-2008 by Apple 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:  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 CarbonEventsCore;
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,CFBase,CGEventTypes,HIGeometry;
219 {$endc} {not MACOSALLINCLUDE}
220 
221 
222 
223 {$ifc TARGET_OS_MAC}
224 
225 {$ALIGN MAC68K}
226 
227 {======================================================================================}
228 {  The core data structure of the Carbon Event system                                  }
229 {======================================================================================}
230 type
231 	EventRef = ^OpaqueEventRef; { an opaque type }
232 	OpaqueEventRef = record end;
233 	EventRefPtr = ^EventRef;
234 {======================================================================================}
235 {  EVENT COMMON                                                                        }
236 {======================================================================================}
237 
238 
239 {
240  *  Discussion:
241  *    The following are all errors which can be returned from the
242  *    routines contained in this file.
243  }
244 const
245 {
246    * This is returned from PostEventToQueue if the event in question is
247    * already in the queue you are posting it to (or any other queue).
248    }
249 	eventAlreadyPostedErr = -9860;
250 
251   {
252    * You are attempting to modify a target that is currently in use,
253    * such as when dispatching.
254    }
255 	eventTargetBusyErr = -9861;
256 
257   {
258    * This is obsolete and will be removed.
259    }
260 	eventClassInvalidErr = -9862;
261 
262   {
263    * This is obsolete and will be removed.
264    }
265 	eventClassIncorrectErr = -9864;
266 
267   {
268    * This is what you should return from a kEventClassAccessibility
269    * event handler when asked to process a directly dispached event
270    * that would cause your handler proc to not return after more than a
271    * split-second. This will cause the accessibility engine to defer
272    * the event until a later time when your handler will be able to
273    * take all the time it needs without causing timeout problems for
274    * the assistive application. See kEventClassAccessibility and
275    * kEventAccessiblePerformNamedAction for more information. You
276    * should only return this on Mac OS X 10.3 and later; earlier
277    * versions will treat this like a true failure, which prevents
278    * assistive applications from getting the functionality they need.
279    }
280 	eventDeferAccessibilityEventErr = -9865;
281 
282   {
283    * Returned from InstallEventHandler if the handler proc you pass is
284    * already installed for a given event type you are trying to
285    * register.
286    }
287 	eventHandlerAlreadyInstalledErr = -9866;
288 
289   {
290    * A generic error.
291    }
292 	eventInternalErr = -9868;
293 
294   {
295    * This is obsolete and will be removed.
296    }
297 	eventKindIncorrectErr = -9869;
298 
299   {
300    * The piece of data you are requesting from an event is not present.
301    }
302 	eventParameterNotFoundErr = -9870;
303 
304   {
305    * This is what you should return from an event handler when your
306    * handler has received an event it doesn't currently want to (or
307    * isn't able to) handle. If you handle an event, you should return
308    * noErr from your event handler. Any return value other than
309    * eventNotHandledErr will cause event handling to stop; the event
310    * will not be sent to any other event handler, and the return value
311    * will be provided to the original caller of SendEventToTarget.
312    }
313 	eventNotHandledErr = -9874;
314 
315   {
316    * The event loop has timed out. This can be returned from calls to
317    * ReceiveNextEvent or RunCurrentEventLoop.
318    }
319 	eventLoopTimedOutErr = -9875;
320 
321   {
322    * The event loop was quit, probably by a call to QuitEventLoop. This
323    * can be returned from ReceiveNextEvent or RunCurrentEventLoop.
324    }
325 	eventLoopQuitErr = -9876;
326 
327   {
328    * Returned from RemoveEventFromQueue when trying to remove an event
329    * that's not in any queue.
330    }
331 	eventNotInQueueErr = -9877;
332 
333   {
334    * Returned from RegisterEventHotKey when an attempt is made to
335    * register a hotkey that is already registered in the current
336    * process. (Note that it is not an error to register the same hotkey
337    * in multiple processes.) Also returned if an attempt is made to
338    * register a hotkey using the kEventHotKeyExclusive option when
339    * another process has already registered the same hotkey with the
340    * kEventHotKeyExclusive option.
341    }
342 	eventHotKeyExistsErr = -9878;
343 
344   {
345    * This error code is not currently used.
346    }
347 	eventHotKeyInvalidErr = -9879;
348 
349   {
350    * When returned from an event handler, causes the event dispatcher
351    * to abandon event dispatching on this target, and pass the event to
352    * the first handler on the next event target. Any event handlers
353    * installed beneath the current handler on the current target will
354    * not receive the event. Although newly documented in Mac OS X 10.3,
355    * this error code is actually available on Mac OS X 10.0 and
356    * CarbonLib 1.3 and later.
357    }
358 	eventPassToNextTargetErr = -9880;
359 
360 {======================================================================================}
361 {  EVENT CORE                                                                          }
362 {======================================================================================}
363 {��������������������������������������������������������������������������������������}
364 {  � Core Event Parameters                                                             }
365 {��������������������������������������������������������������������������������������}
366 const
367 	kEventParamDirectObject = FourCharCode('----'); { type varies depending on event}
368 	kEventParamDragRef = FourCharCode('drag'); { typeDragRef}
369 
370 {��������������������������������������������������������������������������������������}
371 {  � Core Event Types                                                                  }
372 {��������������������������������������������������������������������������������������}
373 {
374     Some Carbon event data types will be retained when added to an EventRef in
375     Mac OS X 10.2 and later, and released when the EventRef is destroyed.
376 
377         Retained in 10.2 and later:
378 
379             typeCFStringRef
380             typeCFMutableStringRef
381             typeCFMutableArrayRef
382             typeCFTypeRef
383             typeHIAccessibleObjectRef
384 
385         Retained in 10.3 and later:
386 
387             typeEventRef
388             typeCFArrayRef
389             typeCFDictionaryRef:
390             typeCFMutableDictionaryRef
391 
392         Retained in 10.4 and later:
393 
394             typeHIShapeRef
395             typeMenuRef
396 
397         Retained in 10.5 and later:
398 
399             typeCTFontRef
400             typeCTGlyphInfoRef
401             typeCFAttributedStringRef
402 
403     Note that other data types may be retained in future releases of Mac OS X.
404     Apple recommends that if you need to know whether a particular data type
405     (other than the ones documented here) is retained, that you check the retain
406     count of an instance of that data type before and after adding it to an EventRef.
407 }
408 const
409 	typeDragRef = FourCharCode('drag'); { DragRef}
410 	typeCTFontRef = FourCharCode('ctfr'); { CTFontRef}
411 	typeCTGlyphInfoRef = FourCharCode('ctgi'); { CTGlyphInfoRef}
412 
413 {��������������������������������������������������������������������������������������}
414 {  � Event Flags, options                                                              }
415 {��������������������������������������������������������������������������������������}
416 
417 {
418  *  EventPriority
419  *
420  *  Discussion:
421  *    These values define the relative priority of an event, and are
422  *    used when posting events with PostEventToQueue. In general events
423  *    are pulled from the queue in order of first posted to last
424  *    posted. These priorities are a way to alter that when posting
425  *    events. You can post a standard priority event and then a high
426  *    priority event and the high priority event will be pulled from
427  *    the queue first.
428  }
429 type
430 	EventPriority = SInt16;
431 const
432 {
433    * Lowest priority. Currently only window update events are posted at
434    * this priority.
435    }
436 	kEventPriorityLow = 0;
437 
438   {
439    * Normal priority of events. Most events are standard priority.
440    }
441 	kEventPriorityStandard = 1;
442 
443   {
444    * Highest priority.
445    }
446 	kEventPriorityHigh = 2;
447 
448 const
449 	kEventLeaveInQueue = false;
450 	kEventRemoveFromQueue = true;
451 
452 {��������������������������������������������������������������������������������������}
453 { � Event Times                                                                        }
454 { EventTime is in seconds since boot. Use the constants to make life easy.             }
455 {��������������������������������������������������������������������������������������}
456 type
457 	EventTime = Float64;
458 	EventTimePtr = ^EventTime;
459 type
460 	EventTimeout = EventTime;
461 	EventTimeoutPtr = ^EventTimeout;
462 type
463 	EventTimerInterval = EventTime;
464 	EventTimerIntervalPtr = ^EventTimerInterval;
465 
466 const
467 	kEventDurationSecond		= 1.0;
468 	kEventDurationMillisecond	= kEventDurationSecond/1000;
469 	kEventDurationMicrosecond	= kEventDurationSecond/1000000;
470 	kEventDurationNanosecond	= kEventDurationSecond/1000000000;
471 	kEventDurationMinute		= kEventDurationSecond*60;
472 	kEventDurationHour			= kEventDurationMinute*60;
473 	kEventDurationDay			= kEventDurationHour*24;
474 	kEventDurationNoWait		= 0.0;
475 	kEventDurationForever		= -1.0;
476 
477 { Helpful doodads to convert to and from ticks and event times}
478 //    #define TicksToEventTime( t )   ((EventTime)( (t) / 60.0 ))
479 //    #define EventTimeToTicks( t )   ((UInt32)( ((t) * 60) + 0.5 ))
480 
481 
482 {��������������������������������������������������������������������������������������}
483 { EventTypeSpec structure                                                              }
484 { This structure is used in many routines to pass a list of event types to a function. }
485 { You typically would declare a const array of these types to pass in.                 }
486 {��������������������������������������������������������������������������������������}
487 
488 {
489  *  EventTypeSpec
490  *
491  *  Discussion:
492  *    This structure is used to specify an event. Typically, a static
493  *    array of EventTypeSpecs are passed into functions such as
494  *    InstallEventHandler, as well as routines such as
495  *    FlushEventsMatchingListFromQueue.
496  }
497 type
498 	EventTypeSpec = record
499 		eventClass: OSType;
500 		eventKind: UInt32;
501 	end;
502 	EventTypeSpecPtr = ^EventTypeSpec;
503 {A helpful macro for dealing with EventTypeSpecs }
504 // #define GetEventTypeCount( t )  (sizeof( (t) ) / sizeof( EventTypeSpec ))
505 
506 type
507 	EventParamName = OSType;
508 	EventParamNamePtr = ^EventParamName;
509 	EventParamType = OSType;
510 	EventParamTypePtr = ^EventParamType;
511 {��������������������������������������������������������������������������������������}
512 {  � EventLoop                                                                         }
513 {��������������������������������������������������������������������������������������}
514 
515 {
516  *  EventLoopRef
517  *
518  *  Discussion:
519  *    An EventLoopRef represents an 'event loop', which is the
520  *    conceptual entity that you 'run' to fetch events from hardware
521  *    and other sources and also fires timers that might be installed
522  *    with InstallEventLoopTimer. The term 'run' is a bit of a
523  *    misnomer, as the event loop's goal is to stay as blocked as
524  *    possible to minimize CPU usage for the current application. The
525  *    event loop is run implicitly thru APIs like ReceiveNextEvent,
526  *    RunApplicationEventLoop, or even WaitNextEvent. It can also be
527  *    run explicitly thru a call to RunCurrentEventLoop. Each
528  *    preemptive thread can have an event loop. Cooperative threads
529  *    share the main thread's event loop.
530  }
531 type
532 	EventLoopRef = ^OpaqueEventLoopRef; { an opaque type }
533 	OpaqueEventLoopRef = record end;
534 {
535  *  GetCurrentEventLoop()
536  *
537  *  Discussion:
538  *    Returns the current event loop for the current thread. If the
539  *    current thread is a cooperative thread, the main event loop is
540  *    returned.
541  *
542  *  Mac OS X threading:
543  *    Thread safe
544  *
545  *  Result:
546  *    An event loop reference.
547  *
548  *  Availability:
549  *    Mac OS X:         in version 10.0 and later in Carbon.framework
550  *    CarbonLib:        in CarbonLib 1.1 and later
551  *    Non-Carbon CFM:   not available
552  }
GetCurrentEventLoopnull553 function GetCurrentEventLoop: EventLoopRef; external name '_GetCurrentEventLoop';
554 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
555 
556 
557 {
558  *  GetMainEventLoop()
559  *
560  *  Discussion:
561  *    Returns the event loop object for the main application thread.
562  *
563  *  Mac OS X threading:
564  *    Thread safe
565  *
566  *  Result:
567  *    An event loop reference.
568  *
569  *  Availability:
570  *    Mac OS X:         in version 10.0 and later in Carbon.framework
571  *    CarbonLib:        in CarbonLib 1.1 and later
572  *    Non-Carbon CFM:   not available
573  }
GetMainEventLoopnull574 function GetMainEventLoop: EventLoopRef; external name '_GetMainEventLoop';
575 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
576 
577 
578 {
579  *  RunCurrentEventLoop()
580  *
581  *  Discussion:
582  *    This routine 'runs' the event loop, returning only if aborted or
583  *    the timeout specified is reached. The event loop is mostly
584  *    blocked while in this function, occasionally waking up to fire
585  *    timers or pick up events. The typical use of this function is to
586  *    cause the current thread to wait for some operation to complete,
587  *    most likely on another thread of execution.
588  *
589  *  Mac OS X threading:
590  *    Thread safe
591  *
592  *  Parameters:
593  *
594  *    inTimeout:
595  *      The time to wait until returning (can be kEventDurationForever).
596  *
597  *  Availability:
598  *    Mac OS X:         in version 10.0 and later in Carbon.framework
599  *    CarbonLib:        in CarbonLib 1.1 and later
600  *    Non-Carbon CFM:   not available
601  }
RunCurrentEventLoopnull602 function RunCurrentEventLoop( inTimeout: EventTimeout ): OSStatus; external name '_RunCurrentEventLoop';
603 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
604 
605 
606 {
607  *  QuitEventLoop()
608  *
609  *  Discussion:
610  *    Causes a specific event loop to terminate. Usage of this is
611  *    similar to WakeUpProcess, in that it causes the eventloop
612  *    specified to return immediately (as opposed to timing out).
613  *    Typically this call is used in conjunction with
614  *    RunCurrentEventLoop.
615  *
616  *    Note that this call is meant to be used while the event loop is
617  *    running; i.e., you would typically call this API from a timer
618  *    callback or some other callback that is invoked by
619  *    RunCurrentEventLoop or ReceiveNextEvent. This API has no effect
620  *    if it is called while you are not inside the event loop.
621  *
622  *  Mac OS X threading:
623  *    Thread safe
624  *
625  *  Parameters:
626  *
627  *    inEventLoop:
628  *      The event loop to terminate.
629  *
630  *  Result:
631  *    An operating system result code.
632  *
633  *  Availability:
634  *    Mac OS X:         in version 10.0 and later in Carbon.framework
635  *    CarbonLib:        in CarbonLib 1.1 and later
636  *    Non-Carbon CFM:   not available
637  }
QuitEventLoopnull638 function QuitEventLoop( inEventLoop: EventLoopRef ): OSStatus; external name '_QuitEventLoop';
639 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
640 
641 
642 {
643  *  GetCFRunLoopFromEventLoop()
644  *
645  *  Discussion:
646  *    Returns the corresponding CFRunLoopRef for the given EventLoop.
647  *    This is not necessarily a one-to-one mapping, hence the need for
648  *    this function. In Carbon, all cooperative threads use the same
649  *    run loop under the covers, so using CFRunLoopGetCurrent might
650  *    yield the wrong result. In general, you would only need to use
651  *    this function if you wished to add your own sources to the run
652  *    loop. If you don't know what I'm talking about, then you probably
653  *    don't need to use this.
654  *
655  *  Mac OS X threading:
656  *    Thread safe
657  *
658  *  Parameters:
659  *
660  *    inEventLoop:
661  *      The event loop to get the CFRunLoop for.
662  *
663  *  Result:
664  *    The CFRunLoopRef for inEventLoop.
665  *
666  *  Availability:
667  *    Mac OS X:         in version 10.1 and later in Carbon.framework
668  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
669  *    Non-Carbon CFM:   not available
670  }
GetCFRunLoopFromEventLoopnull671 function GetCFRunLoopFromEventLoop( inEventLoop: EventLoopRef ): CFTypeRef; external name '_GetCFRunLoopFromEventLoop';
672 (* AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER *)
673 
674 
675 {��������������������������������������������������������������������������������������}
676 {  � Low-level event fetching                                                          }
677 {��������������������������������������������������������������������������������������}
678 {
679  *  ReceiveNextEvent()
680  *
681  *  Discussion:
682  *    This routine tries to fetch the next event of a specified type.
683  *    If no events in the event queue match, this routine will run the
684  *    current event loop until an event that matches arrives, or the
685  *    timeout expires. Except for timers firing, your application is
686  *    blocked waiting for events to arrive when inside this function.
687  *
688  *  Mac OS X threading:
689  *    Thread safe
690  *
691  *  Parameters:
692  *
693  *    inNumTypes:
694  *      The number of event types we are waiting for (0 if any event
695  *      should cause this routine to return).
696  *
697  *    inList:
698  *      The list of event types we are waiting for (pass NULL if any
699  *      event should cause this routine to return).
700  *
701  *    inTimeout:
702  *      The time to wait (passing kEventDurationForever is preferred).
703  *
704  *    inPullEvent:
705  *      Pass true for this parameter to actually remove the next
706  *      matching event from the queue.
707  *
708  *    outEvent:
709  *      The next event that matches the list passed in. If inPullEvent
710  *      is true, the event is owned by you, and you will need to
711  *      release it when done.
712  *
713  *  Result:
714  *    A result indicating whether an event was received, the timeout
715  *    expired, or the current event loop was quit.
716  *
717  *  Availability:
718  *    Mac OS X:         in version 10.0 and later in Carbon.framework
719  *    CarbonLib:        in CarbonLib 1.1 and later
720  *    Non-Carbon CFM:   not available
721  }
ReceiveNextEventnull722 function ReceiveNextEvent( inNumTypes: ItemCount; {const} inList: {variable-size-array} EventTypeSpecPtr; inTimeout: EventTimeout; inPullEvent: Boolean; var outEvent: EventRef ): OSStatus; external name '_ReceiveNextEvent';
723 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
724 
725 
726 {��������������������������������������������������������������������������������������}
727 {  � Core event lifetime APIs                                                          }
728 {��������������������������������������������������������������������������������������}
729 
730 {
731  *  EventAttributes
732  *
733  *  Summary:
734  *    Attributes of a Carbon event.
735  }
736 type
737 	EventAttributes = UInt32;
738 const
739 {
740    * The absence of any attributes.
741    }
742 	kEventAttributeNone = 0;
743 
744   {
745    * Indicates that the event is considered user input; for example, a
746    * mouse event or keyboard event. Not appropriate for higher-level
747    * events such as a window update or activate.
748    }
749 	kEventAttributeUserEvent = 1 shl 0;
750 
751   {
752    * This event was not originally targeted to this process, but has
753    * been provided to this process because someone has installed an
754    * event handler for this event type on the event monitoring target.
755    * Events with this attribute are sent directly to the event monitor
756    * target by the event dispatcher.
757    }
758 	kEventAttributeMonitored = 1 shl 3;
759 
760 {
761  *  [Mac]CreateEvent()
762  *
763  *  Summary:
764  *    Creates a new Carbon event.
765  *
766  *  Mac OS X threading:
767  *    Thread safe
768  *
769  *  Parameters:
770  *
771  *    inAllocator:
772  *      The CFAllocator to use to allocate the event data. You can pass
773  *      NULL or kCFAllocatorDefault to use the standard allocator.
774  *
775  *    inClassID:
776  *      The event class for the event.
777  *
778  *    inKind:
779  *      The event kind for the event.
780  *
781  *    inWhen:
782  *      The event timestamp to be recorded in the event. You may pass 0
783  *      to indicate the current time.
784  *
785  *    inAttributes:
786  *      The event attributes. Typically this should be
787  *      kEventAttributeNone.
788  *
789  *    outEvent:
790  *      On exit, contains the new event.
791  *
792  *  Availability:
793  *    Mac OS X:         in version 10.0 and later in Carbon.framework
794  *    CarbonLib:        in CarbonLib 1.1 and later
795  *    Non-Carbon CFM:   not available
796  }
CreateEventnull797 function CreateEvent( inAllocator: CFAllocatorRef { can be NULL }; inClassID: OSType; inKind: UInt32; inWhen: EventTime; inAttributes: EventAttributes; var outEvent: EventRef ): OSStatus; external name '_CreateEvent';
798 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
MacCreateEvent__NAMED_CreateEventnull799 function MacCreateEvent__NAMED_CreateEvent( inAllocator: CFAllocatorRef { can be NULL }; inClassID: OSType; inKind: UInt32; inWhen: EventTime; inAttributes: EventAttributes; var outEvent: EventRef ): OSStatus; external name '_MacCreateEvent__NAMED_CreateEvent';
800 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
801 
802 
803 {
804  *  CopyEvent()
805  *
806  *  Summary:
807  *    Copies an existing event.
808  *
809  *  Mac OS X threading:
810  *    Not thread safe
811  *
812  *  Parameters:
813  *
814  *    inOther:
815  *      The original event to copy.
816  *
817  *  Result:
818  *    The newly created event, or NULL if either the input event was
819  *    NULL or the memory for the event could not be allocated. The new
820  *    event is allocated using the same allocator as the original event.
821  *
822  *  Availability:
823  *    Mac OS X:         in version 10.0 and later in Carbon.framework
824  *    CarbonLib:        in CarbonLib 1.1 and later
825  *    Non-Carbon CFM:   not available
826  }
CopyEventnull827 function CopyEvent( inOther: EventRef ): EventRef; external name '_CopyEvent';
828 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
829 
830 
831 {
832  *  CopyEventAs()
833  *
834  *  Summary:
835  *    Copies an existing event, allowing you to change the class and
836  *    kind of the event.
837  *
838  *  Discussion:
839  *    CopyEventAs may be useful during event flow and transformation.
840  *    For example, this API is used when upgrading a raw mouse down to
841  *    a window click event, to ensure that the window click event has
842  *    exactly the same parameters as the original mouse down event.
843  *
844  *  Mac OS X threading:
845  *    Not thread safe
846  *
847  *  Parameters:
848  *
849  *    inAllocator:
850  *      The CFAllocator to use to allocate the event data. You can pass
851  *      NULL or kCFAllocatorDefault to use the standard allocator.
852  *
853  *    inOther:
854  *      The original event to copy.
855  *
856  *    inEventClass:
857  *      The new event class for the copy of the event.
858  *
859  *    inEventKind:
860  *      The new event kind for the copy of the event.
861  *
862  *  Result:
863  *    The newly created event, or NULL if either the input event was
864  *    NULL or the memory for the event could not be allocated.
865  *
866  *  Availability:
867  *    Mac OS X:         in version 10.3 and later in Carbon.framework
868  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
869  *    Non-Carbon CFM:   not available
870  }
CopyEventAsnull871 function CopyEventAs( inAllocator: CFAllocatorRef { can be NULL }; inOther: EventRef; inEventClass: OSType; inEventKind: UInt32 ): EventRef; external name '_CopyEventAs';
872 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
873 
874 
875 {
876  *  RetainEvent()
877  *
878  *  Summary:
879  *    Increments the retain count of an event.
880  *
881  *  Discussion:
882  *    Note that EventRefs are not CoreFoundation types, and therefore
883  *    you cannot use CFRetain on an EventRef; you must use RetainEvent.
884  *
885  *  Mac OS X threading:
886  *    Thread safe
887  *
888  *  Parameters:
889  *
890  *    inEvent:
891  *      The event to retain.
892  *
893  *  Result:
894  *    The event that was retained.
895  *
896  *  Availability:
897  *    Mac OS X:         in version 10.0 and later in Carbon.framework
898  *    CarbonLib:        in CarbonLib 1.1 and later
899  *    Non-Carbon CFM:   not available
900  }
RetainEventnull901 function RetainEvent( inEvent: EventRef ): EventRef; external name '_RetainEvent';
902 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
903 
904 
905 {
906  *  GetEventRetainCount()
907  *
908  *  Summary:
909  *    Returns the retain count of an event.
910  *
911  *  Discussion:
912  *    Note that EventRefs are not CoreFoundation types, and therefore
913  *    you cannot use CFGetRetainCount on an EventRef; you must use
914  *    GetEventRetainCount.
915  *
916  *  Mac OS X threading:
917  *    Thread safe
918  *
919  *  Parameters:
920  *
921  *    inEvent:
922  *      The event whose retain count to return.
923  *
924  *  Result:
925  *    The event's retain count.
926  *
927  *  Availability:
928  *    Mac OS X:         in version 10.0 and later in Carbon.framework
929  *    CarbonLib:        in CarbonLib 1.1 and later
930  *    Non-Carbon CFM:   not available
931  }
GetEventRetainCountnull932 function GetEventRetainCount( inEvent: EventRef ): ItemCount; external name '_GetEventRetainCount';
933 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
934 
935 
936 {
937  *  ReleaseEvent()
938  *
939  *  Summary:
940  *    Decrements the retain count of an event. If the retain count
941  *    reaches zero, the event is destroyed.
942  *
943  *  Discussion:
944  *    Note that EventRefs are not CoreFoundation types, and therefore
945  *    you cannot use CFRelease on an EventRef; you must use
946  *    ReleaseEvent.
947  *
948  *  Mac OS X threading:
949  *    Thread safe
950  *
951  *  Parameters:
952  *
953  *    inEvent:
954  *      The event to release.
955  *
956  *  Availability:
957  *    Mac OS X:         in version 10.0 and later in Carbon.framework
958  *    CarbonLib:        in CarbonLib 1.1 and later
959  *    Non-Carbon CFM:   not available
960  }
961 procedure ReleaseEvent( inEvent: EventRef ); external name '_ReleaseEvent';
962 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
963 
964 
965 {
966  *  SetEventParameter()
967  *
968  *  Summary:
969  *    Sets a piece of data for the given event.
970  *
971  *  Discussion:
972  *    SetEventParameter is thread-safe to the extent of allowing
973  *    multiple threads to each modify a separate event, but it is not
974  *    safe to have multiple threads call SetEventParameter on the same
975  *    event. Multiple threads modifying the same event can cause
976  *    corruption of the event data.
977  *
978  *  Mac OS X threading:
979  *    Not thread safe
980  *
981  *  Parameters:
982  *
983  *    inEvent:
984  *      The event to set the data for.
985  *
986  *    inName:
987  *      The symbolic name of the parameter.
988  *
989  *    inType:
990  *      The symbolic type of the parameter.
991  *
992  *    inSize:
993  *      The size of the parameter data.
994  *
995  *    inDataPtr:
996  *      The pointer to the parameter data.
997  *
998  *  Result:
999  *    An operating system result code.
1000  *
1001  *  Availability:
1002  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1003  *    CarbonLib:        in CarbonLib 1.1 and later
1004  *    Non-Carbon CFM:   not available
1005  }
SetEventParameternull1006 function SetEventParameter( inEvent: EventRef; inName: EventParamName; inType: EventParamType; inSize: ByteCount; inDataPtr: {const} UnivPtr ): OSStatus; external name '_SetEventParameter';
1007 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1008 
1009 
1010 {
1011  *  GetEventParameter()
1012  *
1013  *  Discussion:
1014  *    Gets a piece of data from the given event, if it exists.
1015  *
1016  *  Mac OS X threading:
1017  *    Not thread safe
1018  *
1019  *  Parameters:
1020  *
1021  *    inEvent:
1022  *      The event to get the parameter from.
1023  *
1024  *    inName:
1025  *      The symbolic name of the parameter.
1026  *
1027  *    inDesiredType:
1028  *      The desired type of the parameter. The Carbon Event Manager
1029  *      will automatically use AppleEvent coercion handlers to convert
1030  *      the data in the event into the desired type, if possible. You
1031  *      may also pass typeWildCard to request that the data be returned
1032  *      in its original format.
1033  *
1034  *    outActualType:
1035  *      The actual type of the parameter, or NULL if you are not
1036  *      interested in receiving this information.
1037  *
1038  *    inBufferSize:
1039  *      The size of the output buffer specified by ioBuffer. You may
1040  *      pass zero for this parameter and NULL for the outData parameter
1041  *      if you don't want the data returned.
1042  *
1043  *    outActualSize:
1044  *      The actual size of the data, or NULL if you don't want this
1045  *      information.
1046  *
1047  *    outData:
1048  *      The pointer to the buffer which will receive the parameter
1049  *      data, or NULL if you don't want the data returned. If you pass
1050  *      NULL, you must also pass zero for the inBufferSize parameter.
1051  *
1052  *  Result:
1053  *    An operating system result code.
1054  *
1055  *  Availability:
1056  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1057  *    CarbonLib:        in CarbonLib 1.1 and later
1058  *    Non-Carbon CFM:   not available
1059  }
GetEventParameternull1060 function GetEventParameter( inEvent: EventRef; inName: EventParamName; inDesiredType: EventParamType; outActualType: EventParamTypePtr { can be NULL }; inBufferSize: ByteCount; outActualSize: ByteCountPtr { can be NULL }; outData: UnivPtr { can be NULL } ): OSStatus; external name '_GetEventParameter';
1061 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1062 
1063 
1064 {
1065  *  RemoveEventParameter()
1066  *
1067  *  Summary:
1068  *    Removes a piece of data from the given event, if it exists.
1069  *
1070  *  Mac OS X threading:
1071  *    Not thread safe
1072  *
1073  *  Parameters:
1074  *
1075  *    inEvent:
1076  *      The event to remove the data from.
1077  *
1078  *    inName:
1079  *      The symbolic name of the parameter.
1080  *
1081  *  Result:
1082  *    An operating system result code. eventParameterNotFoundErr is
1083  *    returned if the specified parameter is not present in the event.
1084  *
1085  *  Availability:
1086  *    Mac OS X:         in version 10.5 and later in Carbon.framework
1087  *    CarbonLib:        not available
1088  *    Non-Carbon CFM:   not available
1089  }
RemoveEventParameternull1090 function RemoveEventParameter( inEvent: EventRef; inName: EventParamName ): OSStatus; external name '_RemoveEventParameter';
1091 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
1092 
1093 
1094 {��������������������������������������������������������������������������������������}
1095 {  � Getters for 'base-class' event info                                               }
1096 {��������������������������������������������������������������������������������������}
1097 {
1098  *  GetEventClass()
1099  *
1100  *  Discussion:
1101  *    Returns the class of the given event, such as mouse, keyboard,
1102  *    etc.
1103  *
1104  *  Mac OS X threading:
1105  *    Thread safe
1106  *
1107  *  Parameters:
1108  *
1109  *    inEvent:
1110  *      The event in question.
1111  *
1112  *  Result:
1113  *    The class ID of the event.
1114  *
1115  *  Availability:
1116  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1117  *    CarbonLib:        in CarbonLib 1.1 and later
1118  *    Non-Carbon CFM:   not available
1119  }
GetEventClassnull1120 function GetEventClass( inEvent: EventRef ): OSType; external name '_GetEventClass';
1121 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1122 
1123 
1124 {
1125  *  GetEventKind()
1126  *
1127  *  Discussion:
1128  *    Returns the kind of the given event (mousedown, etc.). Event
1129  *    kinds overlap between event classes, e.g. kEventMouseDown and
1130  *    kEventAppActivated have the same value (1). The combination of
1131  *    class and kind is what determines an event signature.
1132  *
1133  *  Mac OS X threading:
1134  *    Thread safe
1135  *
1136  *  Parameters:
1137  *
1138  *    inEvent:
1139  *      The event in question.
1140  *
1141  *  Result:
1142  *    The kind of the event.
1143  *
1144  *  Availability:
1145  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1146  *    CarbonLib:        in CarbonLib 1.1 and later
1147  *    Non-Carbon CFM:   not available
1148  }
GetEventKindnull1149 function GetEventKind( inEvent: EventRef ): UInt32; external name '_GetEventKind';
1150 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1151 
1152 
1153 {
1154  *  GetEventTime()
1155  *
1156  *  Discussion:
1157  *    Returns the time the event specified occurred, specified in
1158  *    EventTime, which is a floating point number representing seconds
1159  *    since the last system startup.
1160  *
1161  *  Mac OS X threading:
1162  *    Thread safe
1163  *
1164  *  Parameters:
1165  *
1166  *    inEvent:
1167  *      The event in question.
1168  *
1169  *  Result:
1170  *    The time the event occurred.
1171  *
1172  *  Availability:
1173  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1174  *    CarbonLib:        in CarbonLib 1.1 and later
1175  *    Non-Carbon CFM:   not available
1176  }
GetEventTimenull1177 function GetEventTime( inEvent: EventRef ): EventTime; external name '_GetEventTime';
1178 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1179 
1180 
1181 {��������������������������������������������������������������������������������������}
1182 {  � Setters for 'base-class' event info                                               }
1183 {��������������������������������������������������������������������������������������}
1184 {
1185  *  SetEventTime()
1186  *
1187  *  Discussion:
1188  *    This routine allows you to set the time of a given event, if you
1189  *    so desire. In general, you would never use this routine, except
1190  *    for those special cases where you reuse an event from time to
1191  *    time instead of creating a new event each time.
1192  *
1193  *  Mac OS X threading:
1194  *    Thread safe
1195  *
1196  *  Parameters:
1197  *
1198  *    inEvent:
1199  *      The event in question.
1200  *
1201  *    inTime:
1202  *      The new time.
1203  *
1204  *  Result:
1205  *    An operating system result code.
1206  *
1207  *  Availability:
1208  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1209  *    CarbonLib:        in CarbonLib 1.1 and later
1210  *    Non-Carbon CFM:   not available
1211  }
SetEventTimenull1212 function SetEventTime( inEvent: EventRef; inTime: EventTime ): OSStatus; external name '_SetEventTime';
1213 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1214 
1215 
1216 {��������������������������������������������������������������������������������������}
1217 {  � CGEventRef support                                                                }
1218 {��������������������������������������������������������������������������������������}
1219 {
1220  *  CreateEventWithCGEvent()
1221  *
1222  *  Summary:
1223  *    Creates a Carbon event using the contents of a CGEventRef. The
1224  *    event class and kind are determined by the type of CGEventRef
1225  *    that is passed, and cannot be specified by the caller. The event
1226  *    timestamp is copied from the CGEventRef timestamp.
1227  *
1228  *  Mac OS X threading:
1229  *    Not thread safe
1230  *
1231  *  Parameters:
1232  *
1233  *    inAllocator:
1234  *      The CFAllocator to use to allocate the event data. You can pass
1235  *      NULL or kCFAllocatorDefault to use the standard allocator.
1236  *
1237  *    inEvent:
1238  *      The CGEventRef from which the Carbon event should be created.
1239  *      This parameter will be retained by the Carbon event, and
1240  *      released when the Carbon event is released.
1241  *
1242  *    inAttributes:
1243  *      The event attributes. Typically this should be
1244  *      kEventAttributeNone.
1245  *
1246  *    outEvent:
1247  *      On exit, if this function returns noErr, then the new event
1248  *      will be written to this location.
1249  *
1250  *  Result:
1251  *    An operating system result code, including paramErr if the
1252  *    CGEventRef is not of a type that can be converted into a Carbon
1253  *    event.
1254  *
1255  *  Availability:
1256  *    Mac OS X:         in version 10.5 and later in Carbon.framework
1257  *    CarbonLib:        not available
1258  *    Non-Carbon CFM:   not available
1259  }
CreateEventWithCGEventnull1260 function CreateEventWithCGEvent( inAllocator: CFAllocatorRef; inEvent: CGEventRef; inAttributes: EventAttributes; var outEvent: EventRef ): OSStatus; external name '_CreateEventWithCGEvent';
1261 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
1262 
1263 
1264 {
1265  *  CopyEventCGEvent()
1266  *
1267  *  Summary:
1268  *    Returns the CGEventRef associated with a Carbon event, or NULL if
1269  *    the event has no CGEventRef.
1270  *
1271  *  Discussion:
1272  *    This API returns the CGEventRef associated with a Carbon event if
1273  *    the Carbon event was originally created using a CGEventRef.
1274  *    Typically, this only applies to user-input Carbon events such as
1275  *    keyboard and mouse events. Carbon events that were created using
1276  *    CreateEvent do not have a CGEventRef associated with them; for
1277  *    example, kEventWindowUpdate has no CGEventRef. For such events,
1278  *    this API returns NULL.
1279  *
1280  *  Mac OS X threading:
1281  *    Not thread safe
1282  *
1283  *  Parameters:
1284  *
1285  *    inEvent:
1286  *      The Carbon event whose CGEventRef you would like.
1287  *
1288  *  Result:
1289  *    The CGEventRef associated with the Carbon event, or NULL if the
1290  *    event has no CGEventRef. If a CGEventRef is returned, then it has
1291  *    been retained by this function, and should be released by the
1292  *    caller.
1293  *
1294  *  Availability:
1295  *    Mac OS X:         in version 10.5 and later in Carbon.framework
1296  *    CarbonLib:        not available
1297  *    Non-Carbon CFM:   not available
1298  }
CopyEventCGEventnull1299 function CopyEventCGEvent( inEvent: EventRef ): CGEventRef; external name '_CopyEventCGEvent';
1300 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
1301 
1302 
1303 {��������������������������������������������������������������������������������������}
1304 {  � Event Queue routines (posting, finding, flushing)                                 }
1305 {��������������������������������������������������������������������������������������}
1306 
1307 type
1308 	EventQueueRef = ^OpaqueEventQueueRef; { an opaque type }
1309 	OpaqueEventQueueRef = record end;
1310 {
1311  *  GetCurrentEventQueue()
1312  *
1313  *  Discussion:
1314  *    Returns the current event queue for the current thread. If the
1315  *    current thread is a cooperative thread, the main event queue is
1316  *    returned.
1317  *
1318  *  Mac OS X threading:
1319  *    Thread safe
1320  *
1321  *  Result:
1322  *    An event queue reference.
1323  *
1324  *  Availability:
1325  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1326  *    CarbonLib:        in CarbonLib 1.1 and later
1327  *    Non-Carbon CFM:   not available
1328  }
GetCurrentEventQueuenull1329 function GetCurrentEventQueue: EventQueueRef; external name '_GetCurrentEventQueue';
1330 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1331 
1332 
1333 {
1334  *  GetMainEventQueue()
1335  *
1336  *  Discussion:
1337  *    Returns the event queue object for the main application thread.
1338  *
1339  *
1340  *    GetMainEventQueue is threadsafe in Mac OS X 10.4 and later. On
1341  *    earlier versions of Mac OS X, you should call GetMainEventQueue
1342  *    once before creating any other threads if those other threads
1343  *    will be calling GetMainEventQueue themselves.
1344  *
1345  *  Mac OS X threading:
1346  *    Thread safe since version 10.4
1347  *
1348  *  Result:
1349  *    An event queue reference.
1350  *
1351  *  Availability:
1352  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1353  *    CarbonLib:        in CarbonLib 1.1 and later
1354  *    Non-Carbon CFM:   not available
1355  }
GetMainEventQueuenull1356 function GetMainEventQueue: EventQueueRef; external name '_GetMainEventQueue';
1357 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1358 
1359 
1360 {
1361  *  EventComparatorProcPtr
1362  *
1363  *  Discussion:
1364  *    Type of a callback function used by queue searches.
1365  *
1366  *  Parameters:
1367  *
1368  *    inEvent:
1369  *      The event to compare.
1370  *
1371  *    inCompareData:
1372  *      The data used to compare the event.
1373  *
1374  *  Result:
1375  *    A boolean value indicating whether the event matches (true) or
1376  *    not (false).
1377  }
1378 type
inEventnull1379 	EventComparatorProcPtr = function( inEvent: EventRef; inCompareData: UnivPtr ): Boolean;
1380 type
1381 	EventComparatorUPP = EventComparatorProcPtr;
1382 {
1383  *  NewEventComparatorUPP()
1384  *
1385  *  Availability:
1386  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1387  *    CarbonLib:        in CarbonLib 1.1 and later
1388  *    Non-Carbon CFM:   available as macro/inline
1389  }
NewEventComparatorUPPnull1390 function NewEventComparatorUPP( userRoutine: EventComparatorProcPtr ): EventComparatorUPP; external name '_NewEventComparatorUPP';
1391 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1392 
1393 {
1394  *  DisposeEventComparatorUPP()
1395  *
1396  *  Availability:
1397  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1398  *    CarbonLib:        in CarbonLib 1.1 and later
1399  *    Non-Carbon CFM:   available as macro/inline
1400  }
1401 procedure DisposeEventComparatorUPP( userUPP: EventComparatorUPP ); external name '_DisposeEventComparatorUPP';
1402 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1403 
1404 {
1405  *  InvokeEventComparatorUPP()
1406  *
1407  *  Availability:
1408  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1409  *    CarbonLib:        in CarbonLib 1.1 and later
1410  *    Non-Carbon CFM:   available as macro/inline
1411  }
InvokeEventComparatorUPPnull1412 function InvokeEventComparatorUPP( inEvent: EventRef; inCompareData: UnivPtr; userUPP: EventComparatorUPP ): Boolean; external name '_InvokeEventComparatorUPP';
1413 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1414 
1415 {
1416  *  PostEventToQueue()
1417  *
1418  *  Discussion:
1419  *    Posts an event to the specified queue and increments the event's
1420  *    retain count. This automatically wakes up the event loop of the
1421  *    thread to which the queue belongs. After posting the event, you
1422  *    may release the event, since it is retained by the queue. If the
1423  *    event is already contained in any event queue,
1424  *    eventAlreadyPostedErr will be returned and the event will not be
1425  *    posted.
1426  *
1427  *    If the event is posted to the main event queue, then the event
1428  *    will be retrieved and dispatched by a subsequent call to the
1429  *    event loop by the main thread. If the event is posted to an event
1430  *    queue of a non-main thread, then that thread must be running its
1431  *    own event loop (calling ReceiveNextEvent and dispatching the
1432  *    event) for the event to be removed and dispatched.
1433  *
1434  *    If the event uses a standard event class (such as
1435  *    kEventClassWindow), then the event dispatcher will send the event
1436  *    to an appropriate event target (such as the specified window); if
1437  *    the event uses a custom event class, then the event dispatcher
1438  *    will send the event to the application target.
1439  *
1440  *    For custom event classes, you may specify a destination event
1441  *    target other than the application target by adding the
1442  *    kEventParamPostTarget event parameter to the event before posting
1443  *    it. The parameter should contain the event target to which the
1444  *    event should be sent. You may specify custom event target sending
1445  *    options by adding the kEventParamPostOptions event parameter to
1446  *    the event.
1447  *
1448  *  Mac OS X threading:
1449  *    Thread safe
1450  *
1451  *  Parameters:
1452  *
1453  *    inQueue:
1454  *      The event queue to post the event onto.
1455  *
1456  *    inEvent:
1457  *      The event to post.
1458  *
1459  *    inPriority:
1460  *      The priority of the event.
1461  *
1462  *  Result:
1463  *    An operating system result code. eventAlreadyPostedErr is
1464  *    returned if the event is already contained in any event queue,
1465  *    and in this case the event will not be posted.
1466  *
1467  *  Availability:
1468  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1469  *    CarbonLib:        in CarbonLib 1.1 and later
1470  *    Non-Carbon CFM:   not available
1471  }
PostEventToQueuenull1472 function PostEventToQueue( inQueue: EventQueueRef; inEvent: EventRef; inPriority: EventPriority ): OSStatus; external name '_PostEventToQueue';
1473 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1474 
1475 
1476 {
1477  *  FlushEventsMatchingListFromQueue()
1478  *
1479  *  Discussion:
1480  *    Flushes events matching a specified list of classes and kinds
1481  *    from an event queue.
1482  *
1483  *    This API may be safely used by any thread to flush the events
1484  *    from that thread's event queue. Prior to Mac OS X 10.5, it is
1485  *    unsafe to call this API from any thread other than the main
1486  *    thread when flushing the main event queue. The main event queue
1487  *    may be flushed from any thread in Mac OS X 10.5 and later.
1488  *
1489  *  Mac OS X threading:
1490  *    Thread safe
1491  *
1492  *  Parameters:
1493  *
1494  *    inQueue:
1495  *      The event queue to flush events from.
1496  *
1497  *    inNumTypes:
1498  *      The number of event kinds to flush.
1499  *
1500  *    inList:
1501  *      The list of event classes and kinds to flush from the queue.
1502  *
1503  *  Result:
1504  *    An operating system result code.
1505  *
1506  *  Availability:
1507  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1508  *    CarbonLib:        in CarbonLib 1.1 and later
1509  *    Non-Carbon CFM:   not available
1510  }
FlushEventsMatchingListFromQueuenull1511 function FlushEventsMatchingListFromQueue( inQueue: EventQueueRef; inNumTypes: ItemCount; {const} inList: {variable-size-array} EventTypeSpecPtr ): OSStatus; external name '_FlushEventsMatchingListFromQueue';
1512 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1513 
1514 
1515 {
1516  *  FlushSpecificEventsFromQueue()
1517  *
1518  *  Discussion:
1519  *    Flushes events that match a comparator function.
1520  *
1521  *    This API may be safely used by any thread to flush the events
1522  *    from that thread's event queue. Prior to Mac OS X 10.5, it is
1523  *    unsafe to call this API from any thread other than the main
1524  *    thread when flushing the main event queue. The main event queue
1525  *    may be flushed from any thread in Mac OS X 10.5 and later.
1526  *
1527  *  Mac OS X threading:
1528  *    Thread safe
1529  *
1530  *  Parameters:
1531  *
1532  *    inQueue:
1533  *      The event queue to flush events from.
1534  *
1535  *    inComparator:
1536  *      The comparison function to invoke for each event in the queue.
1537  *
1538  *    inCompareData:
1539  *      The data you wish to pass to your comparison function.
1540  *
1541  *  Result:
1542  *    An operating system result code.
1543  *
1544  *  Availability:
1545  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1546  *    CarbonLib:        in CarbonLib 1.1 and later
1547  *    Non-Carbon CFM:   not available
1548  }
FlushSpecificEventsFromQueuenull1549 function FlushSpecificEventsFromQueue( inQueue: EventQueueRef; inComparator: EventComparatorUPP; inCompareData: UnivPtr ): OSStatus; external name '_FlushSpecificEventsFromQueue';
1550 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1551 
1552 
1553 {
1554  *  FlushEventQueue()
1555  *
1556  *  Discussion:
1557  *    Flushes all events from an event queue.
1558  *
1559  *    This API may be safely used by any thread to flush the events
1560  *    from that thread's event queue. Prior to Mac OS X 10.5, it is
1561  *    unsafe to call this API from any thread other than the main
1562  *    thread when flushing the main event queue. The main event queue
1563  *    may be flushed from any thread in Mac OS X 10.5 and later.
1564  *
1565  *  Mac OS X threading:
1566  *    Thread safe
1567  *
1568  *  Parameters:
1569  *
1570  *    inQueue:
1571  *      The event queue to flush.
1572  *
1573  *  Result:
1574  *    An operating system result code.
1575  *
1576  *  Availability:
1577  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1578  *    CarbonLib:        in CarbonLib 1.1 and later
1579  *    Non-Carbon CFM:   not available
1580  }
FlushEventQueuenull1581 function FlushEventQueue( inQueue: EventQueueRef ): OSStatus; external name '_FlushEventQueue';
1582 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1583 
1584 
1585 {
1586  *  FindSpecificEventInQueue()
1587  *
1588  *  Discussion:
1589  *    Returns the first event that matches a comparator function, or
1590  *    NULL if no events match.
1591  *
1592  *  Mac OS X threading:
1593  *    Thread safe
1594  *
1595  *  Parameters:
1596  *
1597  *    inQueue:
1598  *      The event queue to search.
1599  *
1600  *    inComparator:
1601  *      The comparison function to invoke for each event in the queue.
1602  *
1603  *    inCompareData:
1604  *      The data you wish to pass to your comparison function.
1605  *
1606  *  Result:
1607  *    An event reference. The event is still in the queue when
1608  *    FindSpecificEventInQueue returns; you can remove it from the
1609  *    queue with RemoveEventFromQueue. The returned event does not need
1610  *    to be released by the caller.
1611  *
1612  *  Availability:
1613  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1614  *    CarbonLib:        in CarbonLib 1.1 and later
1615  *    Non-Carbon CFM:   not available
1616  }
FindSpecificEventInQueuenull1617 function FindSpecificEventInQueue( inQueue: EventQueueRef; inComparator: EventComparatorUPP; inCompareData: UnivPtr ): EventRef; external name '_FindSpecificEventInQueue';
1618 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1619 
1620 
1621 {
1622  *  GetNumEventsInQueue()
1623  *
1624  *  Discussion:
1625  *    Returns the number of events in an event queue.
1626  *
1627  *  Mac OS X threading:
1628  *    Thread safe
1629  *
1630  *  Parameters:
1631  *
1632  *    inQueue:
1633  *      The event queue to query.
1634  *
1635  *  Result:
1636  *    The number of items in the queue.
1637  *
1638  *  Availability:
1639  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1640  *    CarbonLib:        in CarbonLib 1.1 and later
1641  *    Non-Carbon CFM:   not available
1642  }
GetNumEventsInQueuenull1643 function GetNumEventsInQueue( inQueue: EventQueueRef ): ItemCount; external name '_GetNumEventsInQueue';
1644 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1645 
1646 
1647 {
1648  *  RemoveEventFromQueue()
1649  *
1650  *  Discussion:
1651  *    Removes the given event from the specified queue and decrements
1652  *    the event's retain count. If it was your intention to hold onto
1653  *    the event, you must retain the event before removing it from the
1654  *    queue.
1655  *
1656  *  Mac OS X threading:
1657  *    Thread safe
1658  *
1659  *  Parameters:
1660  *
1661  *    inQueue:
1662  *      The queue to remove the event from.
1663  *
1664  *    inEvent:
1665  *      The event to remove.
1666  *
1667  *  Result:
1668  *    An operating system result code. eventNotInQueueErr is returned
1669  *    if the event is not actually contained in the specified queue.
1670  *
1671  *  Availability:
1672  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1673  *    CarbonLib:        in CarbonLib 1.1 and later
1674  *    Non-Carbon CFM:   not available
1675  }
RemoveEventFromQueuenull1676 function RemoveEventFromQueue( inQueue: EventQueueRef; inEvent: EventRef ): OSStatus; external name '_RemoveEventFromQueue';
1677 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1678 
1679 
1680 {
1681  *  IsEventInQueue()
1682  *
1683  *  Discussion:
1684  *    Returns true if the specified event is posted to a queue.
1685  *
1686  *  Mac OS X threading:
1687  *    Not thread safe
1688  *
1689  *  Parameters:
1690  *
1691  *    inQueue:
1692  *      The queue to check.
1693  *
1694  *    inEvent:
1695  *      The event in question.
1696  *
1697  *  Result:
1698  *    A boolean value.
1699  *
1700  *  Availability:
1701  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1702  *    CarbonLib:        in CarbonLib 1.1 and later
1703  *    Non-Carbon CFM:   not available
1704  }
IsEventInQueuenull1705 function IsEventInQueue( inQueue: EventQueueRef; inEvent: EventRef ): Boolean; external name '_IsEventInQueue';
1706 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1707 
1708 
1709 const
1710 {
1711    * Currently, the only value you can pass to
1712    * AcquireFirstMatchingEventInQueue in its inOptions parameter.
1713    }
1714 	kEventQueueOptionsNone = 0;
1715 
1716 {
1717  *  AcquireFirstMatchingEventInQueue()
1718  *
1719  *  Discussion:
1720  *    Returns the first event that matches the list of event classes
1721  *    and kinds passed in. This call does not call the event loop, and
1722  *    hence no timers will fire nor will any window flushing occur when
1723  *    this API is called. New events will be pulled from the window
1724  *    server, however. Overall this API should have better performance
1725  *    characteristics than the older EventAvail API.
1726  *
1727  *  Mac OS X threading:
1728  *    Not thread safe
1729  *
1730  *  Parameters:
1731  *
1732  *    inQueue:
1733  *      The queue to check.
1734  *
1735  *    inNumTypes:
1736  *      The number of event kinds to search for. You may pass zero for
1737  *      this parameter if you also pass NULL for inList.
1738  *
1739  *    inList:
1740  *      The list of event classes and kinds to search for in the queue.
1741  *      You may pass NULL for this parameter if you also pass zero for
1742  *      inNumTypes. This effectively matches ANY event in the queue,
1743  *      and will merely return the first event in the queue.
1744  *
1745  *    inOptions:
1746  *      Currently, you must pass kEventQueueOptionsNone for this
1747  *      parameter.
1748  *
1749  *  Result:
1750  *    An event reference, or NULL if no events match the list passed.
1751  *    The event returned has had its refcount incremented (i.e. it has
1752  *    been retained). As a result, you must release this value
1753  *    (assuming it's non-NULL). The event is not removed from the queue
1754  *    by this API; you should call RemoveEventFromQueue if necessary.
1755  *
1756  *  Availability:
1757  *    Mac OS X:         in version 10.3 and later in Carbon.framework
1758  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
1759  *    Non-Carbon CFM:   not available
1760  }
AcquireFirstMatchingEventInQueuenull1761 function AcquireFirstMatchingEventInQueue( inQueue: EventQueueRef; inNumTypes: ItemCount; {const} inList: {variable-size-array} EventTypeSpecPtr; inOptions: OptionBits ): EventRef; external name '_AcquireFirstMatchingEventInQueue';
1762 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
1763 
1764 
1765 {��������������������������������������������������������������������������������������}
1766 {  Queue-synchronized event and input device state                                     }
1767 {��������������������������������������������������������������������������������������}
1768 {
1769  *  GetCurrentEvent()
1770  *
1771  *  Summary:
1772  *    Returns the user input event currently being handled.
1773  *
1774  *  Discussion:
1775  *    When an event with kEventAttributeUserEvent is dispatched by the
1776  *    event dispatcher target, it is recorded internally by the Event
1777  *    Manager. At any time during the handling of that event (or of any
1778  *    other event which is created and sent during the handling of the
1779  *    original event), GetCurrentEvent may be used to retrieve the
1780  *    original EventRef.
1781  *
1782  *  Mac OS X threading:
1783  *    Not thread safe
1784  *
1785  *  Result:
1786  *    The user input (mouse or keyboard) event currently being handled.
1787  *    May be NULL if no event is currently being handled, or if the
1788  *    current event was not a user input event. The returned event is
1789  *    not retained, and its lifetime should be considered to be no
1790  *    longer than the current function; if you need to keep the event
1791  *    alive past that time, you should retain it.
1792  *
1793  *  Availability:
1794  *    Mac OS X:         in version 10.2 and later in Carbon.framework
1795  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
1796  *    Non-Carbon CFM:   not available
1797  }
GetCurrentEventnull1798 function GetCurrentEvent: EventRef; external name '_GetCurrentEvent';
1799 (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
1800 
1801 
1802 {
1803  *  GetCurrentEventButtonState()
1804  *
1805  *  Summary:
1806  *    Returns the current queue-synchronized mouse button state on the
1807  *    primary input device.
1808  *
1809  *  Discussion:
1810  *    At any point in the handling of user input, there are two
1811  *    different mouse button states: the queue-synchronized state and
1812  *    the hardware state. The hardware state reflects the actual
1813  *    current state of the mouse attached to the user's machine. The
1814  *    queue-synchronized state reflects the state according to the
1815  *    events that have been processed at that point by the application.
1816  *    These two states may be different if there are unprocessed events
1817  *    in the event queue, or if events are being artificially
1818  *    introduced into the event queue from an outside source.
1819  *    GetCurrentEventButtonState returns the queue-synchronized button
1820  *    state. This state is determined by user input events that are
1821  *    sent through the event dispatcher target; whenever a user input
1822  *    event (mouse or keyboard) is handled by the Carbon event
1823  *    dispatcher, its button state is recorded, and that button state
1824  *    will be returned by GetCurrentEventButtonState.
1825  *
1826  *    The "current event" referenced in the API name is the event most
1827  *    recently dispatched through the event dispatcher target, which is
1828  *    not necessarily the event that your event handler is handling.
1829  *    For example, if a mouse-down event occurs, and you have a handler
1830  *    for the kEventWindowHandleContentClick event that is generated
1831  *    from the mouse-down, then the button state will be that which was
1832  *    attached to the mouse-down. The ContentClick event itself does
1833  *    also have MouseButton and MouseChord parameters, which are copied
1834  *    from the the mouse-down event, but GetCurrentEventButtonState
1835  *    returns the button state from the mouse-down, not from the
1836  *    ContentClick event, since it was the mouse-down that was most
1837  *    recently dispatched through the event dispatcher. Usually, this
1838  *    is the behavior that you want anyways.
1839  *
1840  *    Note that events that are not sent through the event dispatcher
1841  *    target will not update the current event button state. Also, note
1842  *    that events arriving from outside the application, such as an
1843  *    AppleEvent or an Accessibility event, also will not update the
1844  *    modifiers. If your application modifies its behavior based on
1845  *    button state, we recommend that you parameterize your core code
1846  *    with the event buttons, and determine the button state based on
1847  *    the origin of the behavior request. For a request that originates
1848  *    directly from user input, you can use GetCurrentEventButtonState,
1849  *    but for a request that originates from an AppleEvent or
1850  *    Accessibility event, you would probably use no button state, or
1851  *    perhaps just left-button-pressed.
1852  *
1853  *    It is generally better to use this API than to use the Button
1854  *    function or the GetCurrentButtonState function (which return the
1855  *    hardware state). This gives a more consistent user experience
1856  *    when the user input queue is being remoted controlled or
1857  *    manipulated via non-hardware event sources such as speech or
1858  *    AppleEvents; using GetCurrentEventButtonState is also much faster
1859  *    than using Button or GetCurrentButtonState.
1860  *
1861  *    Note that GetCurrentEventButtonState only returns a valid button
1862  *    state if your application is the active application. If your
1863  *    application is not active, then user input events are not flowing
1864  *    through the event dispatcher and the queue-synchronized state is
1865  *    not updated.
1866  *
1867  *  Mac OS X threading:
1868  *    Not thread safe
1869  *
1870  *  Result:
1871  *    The queue-synchronized state of the mouse buttons. Bit zero
1872  *    indicates the state of the primary button, bit one the state of
1873  *    the secondary button, and so on.
1874  *
1875  *  Availability:
1876  *    Mac OS X:         in version 10.2 and later in Carbon.framework
1877  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
1878  *    Non-Carbon CFM:   not available
1879  }
GetCurrentEventButtonStatenull1880 function GetCurrentEventButtonState: UInt32; external name '_GetCurrentEventButtonState';
1881 (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
1882 
1883 
1884 {
1885  *  GetCurrentEventKeyModifiers()
1886  *
1887  *  Summary:
1888  *    Returns the current queue-synchronized keyboard modifier state.
1889  *
1890  *  Discussion:
1891  *    At any point in the handling of user input, there are two
1892  *    different keyboard modifier states: the queue-synchronized state
1893  *    and the hardware state. The hardware state reflects the actual
1894  *    current state of the keyboard attached to the user's machine. The
1895  *    queue-synchronized state reflects the state according to the
1896  *    events that have been processed at that point by the application.
1897  *    These two states may be different if there are unprocessed events
1898  *    in the event queue, or if events are being artificially
1899  *    introduced into the event queue from an outside source.
1900  *    GetCurrentEventKeyModifiers returns the queue-synchronized
1901  *    modifier state. This state is determined by user input events
1902  *    that are sent through the event dispatcher target; whenever a
1903  *    user input event (mouse or keyboard) is handled by the Carbon
1904  *    event dispatcher, its modifiers are recorded, and those modifiers
1905  *    will be returned by GetCurrentEventKeyModifiers.
1906  *
1907  *    The "current event" referenced in the API name is the event most
1908  *    recently dispatched through the event dispatcher target, which is
1909  *    not necessarily the event that your event handler is handling.
1910  *    For example, if a mouse-down event occurs, and you have a handler
1911  *    for the kEventWindowHandleContentClick event that is generated
1912  *    from the mouse-down, then the modifiers will be those that were
1913  *    attached to the mouse-down. The ContentClick event itself does
1914  *    also have a KeyModifiers parameter, which is copied from the
1915  *    mouse-down event, but GetCurrentEventKeyModifiers returns the
1916  *    modifiers from the mouse-down, not from the ContentClick event,
1917  *    since it was the mouse-down that was most recently dispatched
1918  *    through the event dispatcher. Usually, this is the behavior that
1919  *    you want anyways.
1920  *
1921  *    Note that events that are not sent through the event dispatcher
1922  *    target will not update the current event key modifiers. Also,
1923  *    note that events arriving from outside the application, such as
1924  *    an AppleEvent or an Accessibility event, also will not update the
1925  *    modifiers. If your application modifies its behavior based on
1926  *    modifier state, we recommend that you parameterize your core code
1927  *    with the event modifiers, and determine the modifiers based on
1928  *    the origin of the behavior request. For a request that originates
1929  *    directly from user input, you can use
1930  *    GetCurrentEventKeyModifiers, but for a request that originates
1931  *    from an AppleEvent or Accessibility event, you would probably use
1932  *    no modifiers.
1933  *    BR> It is generally better to use this API than to use the
1934  *    GetCurrentKeyModifiers API (which returns the hardware state).
1935  *    This gives a more consistent user experience when the user input
1936  *    queue is being remoted controlled or manipulated via non-hardware
1937  *    event sources such as speech or AppleEvents; using
1938  *    GetCurrentEventKeyModifiers is also much faster than using
1939  *    EventAvail(0, &eventRecord) or GetCurrentKeyModifiers.
1940  *
1941  *    Note that GetCurrentEventKeyModifiers only returns a valid
1942  *    modifier state if your application is the active application. If
1943  *    your application is not active, then user input events are not
1944  *    flowing through the event dispatcher and the queue-synchronized
1945  *    state is not updated.
1946  *
1947  *  Mac OS X threading:
1948  *    Not thread safe
1949  *
1950  *  Result:
1951  *    The queue-synchronized state of the keyboard modifiers. The
1952  *    format of the return value is the same as the modifiers field of
1953  *    an EventRecord (but only includes keyboard modifiers and not the
1954  *    other modifier flags included in an EventRecord).
1955  *
1956  *  Availability:
1957  *    Mac OS X:         in version 10.2 and later in Carbon.framework
1958  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
1959  *    Non-Carbon CFM:   not available
1960  }
GetCurrentEventKeyModifiersnull1961 function GetCurrentEventKeyModifiers: UInt32; external name '_GetCurrentEventKeyModifiers';
1962 (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
1963 
1964 
1965 {��������������������������������������������������������������������������������������}
1966 {  Non-synchronized input device state                                                 }
1967 {��������������������������������������������������������������������������������������}
1968 
1969 {
1970  *  HIGetMousePosition()
1971  *
1972  *  Summary:
1973  *    Returns the position of the mouse relative to the given object.
1974  *
1975  *  Mac OS X threading:
1976  *    Not thread safe
1977  *
1978  *  Parameters:
1979  *
1980  *    inSpace:
1981  *      The HICoordinateSpace constant specifying the desired
1982  *      coordinate space that the mouse position is to be relative to.
1983  *
1984  *    inObject:
1985  *      A specific object defining the destination coordinate space
1986  *      that the point is to be returned in. You might pass a WindowRef
1987  *      or an HIViewRef. If no object is necessary, you must pass NULL.
1988  *      See the HICoordinateSpace documentation for details on which
1989  *      HICoordinateSpaces require objects.
1990  *
1991  *    outPoint:
1992  *      A pointer to an HIPoint that will contain the mouse position on
1993  *      exit. If any parameter is invalid, this will be returned as the
1994  *      zero point.
1995  *
1996  *  Result:
1997  *    A pointer to the HIPoint passed in outPoint.
1998  *
1999  *  Availability:
2000  *    Mac OS X:         in version 10.5 and later in Carbon.framework
2001  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.5 and later
2002  *    Non-Carbon CFM:   not available
2003  }
HIGetMousePositionnull2004 function HIGetMousePosition( inSpace: HICoordinateSpace; inObject: UnivPtr; var outPoint: HIPoint ): HIPointPtr; external name '_HIGetMousePosition';
2005 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
2006 
2007 
2008 {$ifc not TARGET_CPU_64}
2009 {
2010  *  GetGlobalMouse()
2011  *
2012  *  Summary:
2013  *    Returns the position of the mouse in global coordinates.
2014  *
2015  *  Mac OS X threading:
2016  *    Not thread safe
2017  *
2018  *  Parameters:
2019  *
2020  *    globalMouse:
2021  *      On exit, contains the mouse position in global coordinates.
2022  *
2023  *  Availability:
2024  *    Mac OS X:         in version 10.0 and later in Carbon.framework [32-bit only]
2025  *    CarbonLib:        in CarbonLib 1.0 and later
2026  *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
2027  }
2028 procedure GetGlobalMouse( var globalMouse: Point ); external name '_GetGlobalMouse';
2029 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2030 
2031 
2032 {$endc} {not TARGET_CPU_64}
2033 
2034 {
2035  *  GetCurrentButtonState()
2036  *
2037  *  Summary:
2038  *    Returns the current hardware mouse button state on the primary
2039  *    input device.
2040  *
2041  *  Discussion:
2042  *    In most cases, you should not use GetCurrentButtonState, but
2043  *    should use the GetCurrentEventButtonState function instead.
2044  *    GetCurrentEventButtonState is much faster than
2045  *    GetCurrentButtonState because it returns the locally cached
2046  *    button state; GetCurrentButtonState must get the mouse button
2047  *    state from the window server, which is slower. Using
2048  *    GetCurrentButtonState also can prevent your application from
2049  *    being operated by remote posting of events, since the hardware
2050  *    input device is not actually changing state in that case. Most
2051  *    commonly, you might need to use GetCurrentButtonState when your
2052  *    application is not the active application (as determined by the
2053  *    Process Manager function GetFrontProcess). In that case, the
2054  *    cached button state returned by GetCurrentEventButtonState is not
2055  *    valid because mouse button events are not flowing to your
2056  *    application, and you must use GetCurrentButtonState to determine
2057  *    the current hardware state.
2058  *
2059  *  Mac OS X threading:
2060  *    Not thread safe
2061  *
2062  *  Result:
2063  *    The state of the mouse buttons on the mouse hardware. Bit zero
2064  *    indicates the state of the primary button, bit one the state of
2065  *    the secondary button, and so on.
2066  *
2067  *  Availability:
2068  *    Mac OS X:         in version 10.2 and later in Carbon.framework
2069  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
2070  *    Non-Carbon CFM:   not available
2071  }
GetCurrentButtonStatenull2072 function GetCurrentButtonState: UInt32; external name '_GetCurrentButtonState';
2073 (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
2074 
2075 
2076 {
2077  *  GetCurrentKeyModifiers()
2078  *
2079  *  Summary:
2080  *    Returns the current hardware keyboard modifier state.
2081  *
2082  *  Discussion:
2083  *    In most cases, you should not use GetCurrentKeyModifiers, but
2084  *    should use the GetCurrentEventKeyModifiers function instead.
2085  *    GetCurrentEventKeyModifiers is much faster than
2086  *    GetCurrentKeyModifiers because it returns the locally cached
2087  *    modifier state; GetCurrentKeyModifiers must get the modifier
2088  *    state from the window server, which is slower. Using
2089  *    GetCurrentKeyModifiers also can prevent your application from
2090  *    being operated by remote posting of events, since the hardware
2091  *    input device is not actually changing state in that case. Most
2092  *    commonly, you might need to use GetCurrentKeyModifiers when your
2093  *    application is not the active application (as determined by the
2094  *    Process Manager function GetFrontProcess). In that case, the
2095  *    cached modifier state returned by GetCurrentEventKeyModifiers is
2096  *    not valid because modifier-changed events are not flowing to your
2097  *    application, and you must use GetCurrentKeyModifiers to determine
2098  *    the current hardware state.
2099  *
2100  *  Mac OS X threading:
2101  *    Not thread safe
2102  *
2103  *  Result:
2104  *    The hardware state of the keyboard modifiers. The format of the
2105  *    return value is the same as the modifiers field of an EventRecord
2106  *    (but only includes keyboard modifiers and not the other modifier
2107  *    flags included in an EventRecord).
2108  *
2109  *  Availability:
2110  *    Mac OS X:         in version 10.0 and later in Carbon.framework
2111  *    CarbonLib:        in CarbonLib 1.0 and later
2112  *    Non-Carbon CFM:   not available
2113  }
GetCurrentKeyModifiersnull2114 function GetCurrentKeyModifiers: UInt32; external name '_GetCurrentKeyModifiers';
2115 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2116 
2117 
2118 {��������������������������������������������������������������������������������������}
2119 {  � Helpful utilities                                                                 }
2120 {��������������������������������������������������������������������������������������}
2121 
2122 {
2123  *  GetCurrentEventTime()
2124  *
2125  *  Discussion:
2126  *    Returns the current time since last system startup in seconds.
2127  *
2128  *  Mac OS X threading:
2129  *    Thread safe
2130  *
2131  *  Result:
2132  *    EventTime.
2133  *
2134  *  Availability:
2135  *    Mac OS X:         in version 10.0 and later in Carbon.framework
2136  *    CarbonLib:        in CarbonLib 1.1 and later
2137  *    Non-Carbon CFM:   not available
2138  }
GetCurrentEventTimenull2139 function GetCurrentEventTime: EventTime; external name '_GetCurrentEventTime';
2140 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2141 
2142 
2143 {��������������������������������������������������������������������������������������}
2144 {  � Timers                                                                            }
2145 {��������������������������������������������������������������������������������������}
2146 
2147 {
2148  *  EventLoopTimerRef
2149  *
2150  *  Discussion:
2151  *    An EventLoopTimerRef represents what we term a 'timer'. A timer
2152  *    is a function that is called either once or at regular intervals.
2153  *    It executes at task level and should not be confused with Time
2154  *    Manager Tasks or any other interrupt-level callback. This means
2155  *    you can call Toolbox routines, allocate memory and draw. When a
2156  *    timer 'fires', it calls a callback that you specify when the
2157  *    timer is installed. Timers in general have two uses - as a
2158  *    timeout mechanism and as a periodic task. An everyday example of
2159  *    using a timer for a timeout might be a light that goes out if no
2160  *    motion is detected in a room for 5 minutes. For this, you might
2161  *    install a timer which will fire in 5 minutes. If motion is
2162  *    detected, you would reset the timer fire time and let the clock
2163  *    start over. If no motion is detected for the full 5 minutes, the
2164  *    timer will fire and you could power off the light. A periodic
2165  *    timer is one that fires at regular intervals (say every second or
2166  *    so). You might use such a timer to blink the insertion point in
2167  *    your editor, etc. One advantage of timers is that you can install
2168  *    the timer right from the code that wants the time. For example,
2169  *    the standard Toolbox Edit Text control can install a timer to
2170  *    blink the cursor when it's active, meaning that IdleControls is a
2171  *    no-op for that control and doesn't need to be called. When the
2172  *    control is inactive, it removes its timer and doesn't waste CPU
2173  *    time in that state. NOTE: Currently, if you do decide to draw
2174  *    when your timer is called, be sure to save and restore the
2175  *    current port so that calling your timer doesn't inadvertently
2176  *    change the port out from under someone.
2177  }
2178 type
2179 	EventLoopTimerRef = ^__EventLoopTimer; { an opaque type }
2180 	__EventLoopTimer = record end;
2181 
2182 {
2183  *  EventLoopTimerProcPtr
2184  *
2185  *  Discussion:
2186  *    Called when a timer fires.
2187  *
2188  *  Parameters:
2189  *
2190  *    inTimer:
2191  *      The timer that fired.
2192  *
2193  *    inUserData:
2194  *      The data passed into InstallEventLoopTimer.
2195  }
2196 type
2197 	EventLoopTimerProcPtr = procedure( inTimer: EventLoopTimerRef; inUserData: UnivPtr );
2198 
2199 {
2200  *  Discussion:
2201  *    Event Loop Idle Timer Messages
2202  }
2203 const
2204 {
2205    * The user has gone idle (not touched an input device) for the
2206    * duration specified in your idle timer. This is the first message
2207    * you will receive. Start your engines!
2208    }
2209 	kEventLoopIdleTimerStarted = 1;
2210 
2211   {
2212    * If you specified an interval on your idle timer, your idle timer
2213    * proc will be called with this message, letting you know it is
2214    * merely firing at the interval specified. You will receive this
2215    * message for the first time at the specified interval after you
2216    * receive kEventLoopIdleTimerStarted. If you did not specify an
2217    * interval, this message is not sent.
2218    }
2219 	kEventLoopIdleTimerIdling = 2;
2220 
2221   {
2222    * The user is back! Stop everything! This is your cue to stop any
2223    * processing if you need to.
2224    }
2225 	kEventLoopIdleTimerStopped = 3;
2226 
2227 type
2228 	EventLoopIdleTimerMessage = UInt16;
2229 
2230 {
2231  *  EventLoopIdleTimerProcPtr
2232  *
2233  *  Discussion:
2234  *    Called when an idle timer fires.
2235  *
2236  *  Parameters:
2237  *
2238  *    inTimer:
2239  *      The timer that fired.
2240  *
2241  *    inState:
2242  *      The current state of the timer.
2243  *
2244  *    inUserData:
2245  *      The data passed into InstallEventLoopTimer.
2246  }
2247 type
2248 	EventLoopIdleTimerProcPtr = procedure( inTimer: EventLoopTimerRef; inState: EventLoopIdleTimerMessage; inUserData: UnivPtr );
2249 type
2250 	EventLoopTimerUPP = EventLoopTimerProcPtr;
2251 type
2252 	EventLoopIdleTimerUPP = EventLoopIdleTimerProcPtr;
2253 {
2254  *  NewEventLoopTimerUPP()
2255  *
2256  *  Availability:
2257  *    Mac OS X:         in version 10.0 and later in Carbon.framework
2258  *    CarbonLib:        in CarbonLib 1.1 and later
2259  *    Non-Carbon CFM:   available as macro/inline
2260  }
NewEventLoopTimerUPPnull2261 function NewEventLoopTimerUPP( userRoutine: EventLoopTimerProcPtr ): EventLoopTimerUPP; external name '_NewEventLoopTimerUPP';
2262 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2263 
2264 {
2265  *  NewEventLoopIdleTimerUPP()
2266  *
2267  *  Availability:
2268  *    Mac OS X:         in version 10.2 and later in Carbon.framework
2269  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
2270  *    Non-Carbon CFM:   available as macro/inline
2271  }
NewEventLoopIdleTimerUPPnull2272 function NewEventLoopIdleTimerUPP( userRoutine: EventLoopIdleTimerProcPtr ): EventLoopIdleTimerUPP; external name '_NewEventLoopIdleTimerUPP';
2273 (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
2274 
2275 {
2276  *  DisposeEventLoopTimerUPP()
2277  *
2278  *  Availability:
2279  *    Mac OS X:         in version 10.0 and later in Carbon.framework
2280  *    CarbonLib:        in CarbonLib 1.1 and later
2281  *    Non-Carbon CFM:   available as macro/inline
2282  }
2283 procedure DisposeEventLoopTimerUPP( userUPP: EventLoopTimerUPP ); external name '_DisposeEventLoopTimerUPP';
2284 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2285 
2286 {
2287  *  DisposeEventLoopIdleTimerUPP()
2288  *
2289  *  Availability:
2290  *    Mac OS X:         in version 10.2 and later in Carbon.framework
2291  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
2292  *    Non-Carbon CFM:   available as macro/inline
2293  }
2294 procedure DisposeEventLoopIdleTimerUPP( userUPP: EventLoopIdleTimerUPP ); external name '_DisposeEventLoopIdleTimerUPP';
2295 (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
2296 
2297 {
2298  *  InvokeEventLoopTimerUPP()
2299  *
2300  *  Availability:
2301  *    Mac OS X:         in version 10.0 and later in Carbon.framework
2302  *    CarbonLib:        in CarbonLib 1.1 and later
2303  *    Non-Carbon CFM:   available as macro/inline
2304  }
2305 procedure InvokeEventLoopTimerUPP( inTimer: EventLoopTimerRef; inUserData: UnivPtr; userUPP: EventLoopTimerUPP ); external name '_InvokeEventLoopTimerUPP';
2306 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2307 
2308 {
2309  *  InvokeEventLoopIdleTimerUPP()
2310  *
2311  *  Availability:
2312  *    Mac OS X:         in version 10.2 and later in Carbon.framework
2313  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
2314  *    Non-Carbon CFM:   available as macro/inline
2315  }
2316 procedure InvokeEventLoopIdleTimerUPP( inTimer: EventLoopTimerRef; inState: EventLoopIdleTimerMessage; inUserData: UnivPtr; userUPP: EventLoopIdleTimerUPP ); external name '_InvokeEventLoopIdleTimerUPP';
2317 (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
2318 
2319 {
2320  *  InstallEventLoopTimer()
2321  *
2322  *  Discussion:
2323  *    Installs a timer onto the event loop specified. The timer can
2324  *    either fire once or repeatedly at a specified interval depending
2325  *    on the parameters passed to this function.
2326  *
2327  *  Mac OS X threading:
2328  *    Thread safe
2329  *
2330  *  Parameters:
2331  *
2332  *    inEventLoop:
2333  *      The event loop to add the timer.
2334  *
2335  *    inFireDelay:
2336  *      The delay before first firing this timer (can be 0, to request
2337  *      that the timer be fired as soon as control returns to your
2338  *      event loop). In Mac OS X and CarbonLib 1.5 and later, you may
2339  *      pass kEventDurationForever to stop the timer from firing at all
2340  *      until SetEventLoopTimerNextFireTime is used to start it; in
2341  *      earlier CarbonLibs, to achieve the same effect, just pass zero
2342  *      and then immediately call SetEventLoopTimerNextFireTime( timer,
2343  *      kEventDurationForever ) before returning control to your event
2344  *      loop.
2345  *
2346  *    inInterval:
2347  *      The timer interval (pass 0 for a one-shot timer, which executes
2348  *      once but does not repeat). In Mac OS X and CarbonLib 1.5 and
2349  *      later, you may also pass kEventDurationForever to create a
2350  *      one-shot timer.
2351  *
2352  *    inTimerProc:
2353  *      The routine to call when the timer fires.
2354  *
2355  *    inTimerData:
2356  *      Data to pass to the timer proc when called.
2357  *
2358  *    outTimer:
2359  *      A reference to the newly installed timer.
2360  *
2361  *  Result:
2362  *    An operating system status code.
2363  *
2364  *  Availability:
2365  *    Mac OS X:         in version 10.0 and later in Carbon.framework
2366  *    CarbonLib:        in CarbonLib 1.1 and later
2367  *    Non-Carbon CFM:   not available
2368  }
InstallEventLoopTimernull2369 function InstallEventLoopTimer( inEventLoop: EventLoopRef; inFireDelay: EventTimerInterval; inInterval: EventTimerInterval; inTimerProc: EventLoopTimerUPP; inTimerData: UnivPtr; var outTimer: EventLoopTimerRef ): OSStatus; external name '_InstallEventLoopTimer';
2370 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2371 
2372 
2373 {$ifc not TARGET_CPU_64}
2374 {
2375  *  InstallEventLoopIdleTimer()
2376  *
2377  *  Discussion:
2378  *    Installs a timer onto the event loop specified. Idle timers are
2379  *    only called when there is no user activity occuring in the
2380  *    application. This means that the user is not actively
2381  *    clicking/typing, and is also not in the middle of tracking a
2382  *    control, menu, or window. TrackMouseLocation actually disables
2383  *    all idle timers automatically for you.
2384  *
2385  *  Mac OS X threading:
2386  *    Thread safe
2387  *
2388  *  Parameters:
2389  *
2390  *    inEventLoop:
2391  *      The event loop to add the timer.
2392  *
2393  *    inDelay:
2394  *      The delay before firing this timer after a user input event has
2395  *      come in. For example, if you want to start your timer 2 seconds
2396  *      after the user stops typing, etc. you would pass 2.0 into this
2397  *      parameter. Each time the user types a key (or whatever), this
2398  *      timer is reset. If we are considered to be idle when an idle
2399  *      timer is installed, the first time it fires will be inDelay
2400  *      seconds from the time it is installed. So if you installed it
2401  *      in the middle of control tracking, say, it wouldn't fire until
2402  *      the user stopped tracking. But if you installed it at app
2403  *      startup and the user hasn't typed/clicked, it would fire in
2404  *      inDelay seconds. On Mac OS X 10.3 and earlier, the delay must
2405  *      be greater than zero. On Mac OS X 10.4 and later, the delay
2406  *      must be greather than or equal to zero. You cannot use
2407  *      kEventDurationForever for the delay.
2408  *
2409  *    inInterval:
2410  *      The timer interval (pass 0 for a one-shot timer, which executes
2411  *      once but does not repeat). You may also pass
2412  *      kEventDurationForever to create a one-shot timer.
2413  *
2414  *    inTimerProc:
2415  *      The routine to call when the timer fires.
2416  *
2417  *    inTimerData:
2418  *      Data to pass to the timer proc when called.
2419  *
2420  *    outTimer:
2421  *      A reference to the newly installed timer.
2422  *
2423  *  Result:
2424  *    An operating system status code.
2425  *
2426  *  Availability:
2427  *    Mac OS X:         in version 10.2 and later in Carbon.framework [32-bit only]
2428  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
2429  *    Non-Carbon CFM:   not available
2430  }
InstallEventLoopIdleTimernull2431 function InstallEventLoopIdleTimer( inEventLoop: EventLoopRef; inDelay: EventTimerInterval; inInterval: EventTimerInterval; inTimerProc: EventLoopIdleTimerUPP; inTimerData: UnivPtr; var outTimer: EventLoopTimerRef ): OSStatus; external name '_InstallEventLoopIdleTimer';
2432 (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
2433 
2434 
2435 {$endc} {not TARGET_CPU_64}
2436 
2437 {
2438  *  RemoveEventLoopTimer()
2439  *
2440  *  Discussion:
2441  *    Removes a timer that was previously installed by a call to
2442  *    InstallEventLoopTimer. You call this function when you are done
2443  *    using a timer.
2444  *
2445  *  Mac OS X threading:
2446  *    Thread safe
2447  *
2448  *  Parameters:
2449  *
2450  *    inTimer:
2451  *      The timer to remove.
2452  *
2453  *  Result:
2454  *    An operating system status code.
2455  *
2456  *  Availability:
2457  *    Mac OS X:         in version 10.0 and later in Carbon.framework
2458  *    CarbonLib:        in CarbonLib 1.1 and later
2459  *    Non-Carbon CFM:   not available
2460  }
RemoveEventLoopTimernull2461 function RemoveEventLoopTimer( inTimer: EventLoopTimerRef ): OSStatus; external name '_RemoveEventLoopTimer';
2462 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2463 
2464 
2465 {
2466  *  SetEventLoopTimerNextFireTime()
2467  *
2468  *  Discussion:
2469  *    This routine is used to 'reset' a timer. It controls the next
2470  *    time the timer fires. This will override any interval you might
2471  *    have set. For example, if you have a timer that fires every
2472  *    second, and you call this function setting the next time to five
2473  *    seconds from now, the timer will sleep for five seconds, then
2474  *    fire. It will then resume its one-second interval after that. It
2475  *    is as if you removed the timer and reinstalled it with a new
2476  *    first-fire delay.
2477  *
2478  *  Mac OS X threading:
2479  *    Thread safe
2480  *
2481  *  Parameters:
2482  *
2483  *    inTimer:
2484  *      The timer to adjust
2485  *
2486  *    inNextFire:
2487  *      The interval from the current time to wait until firing the
2488  *      timer again. You may pass kEventDurationForever to stop the
2489  *      timer from firing at all.
2490  *
2491  *  Result:
2492  *    An operating system status code.
2493  *
2494  *  Availability:
2495  *    Mac OS X:         in version 10.0 and later in Carbon.framework
2496  *    CarbonLib:        in CarbonLib 1.1 and later
2497  *    Non-Carbon CFM:   not available
2498  }
SetEventLoopTimerNextFireTimenull2499 function SetEventLoopTimerNextFireTime( inTimer: EventLoopTimerRef; inNextFire: EventTimerInterval ): OSStatus; external name '_SetEventLoopTimerNextFireTime';
2500 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2501 
2502 
2503 {======================================================================================}
2504 {  EVENT HANDLERS                                                                      }
2505 {======================================================================================}
2506 
2507 type
2508 	EventHandlerRef = ^OpaqueEventHandlerRef; { an opaque type }
2509 	OpaqueEventHandlerRef = record end;
2510 	EventHandlerRefPtr = ^EventHandlerRef;
2511 	EventHandlerCallRef = ^OpaqueEventHandlerCallRef; { an opaque type }
2512 	OpaqueEventHandlerCallRef = record end;
2513 	EventHandlerCallRefPtr = ^EventHandlerCallRef;
2514 
2515 {��������������������������������������������������������������������������������������}
2516 {  � EventHandler specification                                                        }
2517 {��������������������������������������������������������������������������������������}
2518 {��������������������������������������������������������������������������������������}
2519 {  � C++ Methods as Event Handlers                                                     }
2520 { To use a C++ method as an Event Handler callback, it must be declared in its class   }
2521 { as a static method.  Otherwise, the implicit "this" parameter will make the function }
2522 { not match the EventHandlerProcPtr prototype.                                         }
2523 {��������������������������������������������������������������������������������������}
2524 
2525 {
2526  *  EventHandlerProcPtr
2527  *
2528  *  Discussion:
2529  *    Callback for receiving events sent to a target this callback is
2530  *    installed on.
2531  *
2532  *  Parameters:
2533  *
2534  *    inHandlerCallRef:
2535  *      A reference to the current handler call chain. This is sent to
2536  *      your handler so that you can call CallNextEventHandler if you
2537  *      need to.
2538  *
2539  *    inEvent:
2540  *      The Event.
2541  *
2542  *    inUserData:
2543  *      The app-specified data you passed in a call to
2544  *      InstallEventHandler.
2545  *
2546  *  Result:
2547  *    An operating system result code. Returning noErr indicates you
2548  *    handled the event. Returning eventNotHandledErr indicates you did
2549  *    not handle the event and perhaps the toolbox should take other
2550  *    action.
2551  }
2552 type
inHandlerCallRefnull2553 	EventHandlerProcPtr = function( inHandlerCallRef: EventHandlerCallRef; inEvent: EventRef; inUserData: UnivPtr ): OSStatus;
2554 type
2555 	EventHandlerUPP = EventHandlerProcPtr;
2556 {
2557  *  NewEventHandlerUPP()
2558  *
2559  *  Availability:
2560  *    Mac OS X:         in version 10.0 and later in Carbon.framework
2561  *    CarbonLib:        in CarbonLib 1.1 and later
2562  *    Non-Carbon CFM:   available as macro/inline
2563  }
NewEventHandlerUPPnull2564 function NewEventHandlerUPP( userRoutine: EventHandlerProcPtr ): EventHandlerUPP; external name '_NewEventHandlerUPP';
2565 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2566 
2567 {
2568  *  DisposeEventHandlerUPP()
2569  *
2570  *  Availability:
2571  *    Mac OS X:         in version 10.0 and later in Carbon.framework
2572  *    CarbonLib:        in CarbonLib 1.1 and later
2573  *    Non-Carbon CFM:   available as macro/inline
2574  }
2575 procedure DisposeEventHandlerUPP( userUPP: EventHandlerUPP ); external name '_DisposeEventHandlerUPP';
2576 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2577 
2578 {
2579  *  InvokeEventHandlerUPP()
2580  *
2581  *  Availability:
2582  *    Mac OS X:         in version 10.0 and later in Carbon.framework
2583  *    CarbonLib:        in CarbonLib 1.1 and later
2584  *    Non-Carbon CFM:   available as macro/inline
2585  }
InvokeEventHandlerUPPnull2586 function InvokeEventHandlerUPP( inHandlerCallRef: EventHandlerCallRef; inEvent: EventRef; inUserData: UnivPtr; userUPP: EventHandlerUPP ): OSStatus; external name '_InvokeEventHandlerUPP';
2587 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2588 
2589 type
2590 	EventTargetRef = ^OpaqueEventTargetRef; { an opaque type }
2591 	OpaqueEventTargetRef = record end;
2592 {��������������������������������������������������������������������������������������}
2593 {  � Installing Event Handlers                                                         }
2594 { Use these routines to install event handlers for a specific toolbox object. You may  }
2595 { pass zero for inNumTypes and NULL for inList if you need to be in a situation where  }
2596 { you know you will be receiving events, but not exactly which ones at the time you    }
2597 { are installing the handler. Later, your application can call the Add/Remove routines }
2598 { listed below this section.                                                           }
2599 { You can only install a specific handler once. The combination of inHandler and       }
2600 { inUserData is considered the 'signature' of a handler. Any attempt to install a new  }
2601 { handler with the same proc and user data as an already-installed handler will result }
2602 { in eventHandlerAlreadyInstalledErr. Installing the same proc and user data on a      }
2603 { different object is legal.                                                           }
2604 { Upon successful completion of this routine, you are returned an EventHandlerRef,     }
2605 { which you can use in various other calls. It is not possible to retrieve any         }
2606 { information from an EventHandlerRef about which object the handler is attached to;   }
2607 { to keep track of the target object of an event handler, use the inUserData paramter  }
2608 { to InstallEventHandler to specify the object.                                        }
2609 {��������������������������������������������������������������������������������������}
2610 {
2611  *  InstallEventHandler()
2612  *
2613  *  Discussion:
2614  *    Installs an event handler on a specified target. Your handler
2615  *    proc will be called with the events you registered with when an
2616  *    event of the corresponding type and class are send to the target
2617  *    you are installing your handler on.
2618  *
2619  *  Mac OS X threading:
2620  *    Not thread safe
2621  *
2622  *  Parameters:
2623  *
2624  *    inTarget:
2625  *      The target to register your handler with.
2626  *
2627  *    inHandler:
2628  *      A pointer to your handler function.
2629  *
2630  *    inNumTypes:
2631  *      The number of events you are registering for.
2632  *
2633  *    inList:
2634  *      A pointer to an array of EventTypeSpec entries representing the
2635  *      events you are interested in.
2636  *
2637  *    inUserData:
2638  *      The value passed in this parameter is passed on to your event
2639  *      handler proc when it is called.
2640  *
2641  *    outRef:
2642  *      Receives an EventHandlerRef, which you can use later to remove
2643  *      the handler. You can pass null if you don't want the reference
2644  *      - when the target is disposed, the handler will be disposed as
2645  *      well.
2646  *
2647  *  Result:
2648  *    An operating system result code.
2649  *
2650  *  Availability:
2651  *    Mac OS X:         in version 10.0 and later in Carbon.framework
2652  *    CarbonLib:        in CarbonLib 1.1 and later
2653  *    Non-Carbon CFM:   not available
2654  }
InstallEventHandlernull2655 function InstallEventHandler( inTarget: EventTargetRef; inHandler: EventHandlerUPP; inNumTypes: ItemCount; {const} inList: {variable-size-array} EventTypeSpecPtr; inUserData: UnivPtr; outRef: EventHandlerRefPtr { can be NULL } ): OSStatus; external name '_InstallEventHandler';
2656 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2657 
2658 
2659 {
2660  *  RemoveEventHandler()
2661  *
2662  *  Summary:
2663  *    Removes an event handler from the target it was bound to.
2664  *
2665  *  Discussion:
2666  *    As of Mac OS X 10.1, it is safe to remove an event handler from
2667  *    inside the handler function. This is not safe to do in CarbonLib
2668  *    or earlier releases of Mac OS X.
2669  *
2670  *  Mac OS X threading:
2671  *    Not thread safe
2672  *
2673  *  Parameters:
2674  *
2675  *    inHandlerRef:
2676  *      The handler ref to remove (returned in a call to
2677  *      InstallEventHandler). After you call this function, the handler
2678  *      ref is considered to be invalid and can no longer be used.
2679  *
2680  *  Result:
2681  *    An operating system result code.
2682  *
2683  *  Availability:
2684  *    Mac OS X:         in version 10.0 and later in Carbon.framework
2685  *    CarbonLib:        in CarbonLib 1.1 and later
2686  *    Non-Carbon CFM:   not available
2687  }
RemoveEventHandlernull2688 function RemoveEventHandler( inHandlerRef: EventHandlerRef ): OSStatus; external name '_RemoveEventHandler';
2689 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2690 
2691 
2692 {$ifc not TARGET_CPU_64}
2693 {
2694  *  InstallStandardEventHandler()
2695  *
2696  *  Summary:
2697  *    Installs the standard event handler (if any) for an event target.
2698  *
2699  *  Discussion:
2700  *    All event targets have default handlers installed on them by the
2701  *    toolbox to perform certain basic operations common to that type
2702  *    of target. Some targets also have standard handlers which are not
2703  *    installed by default, but may be requested. A standard handler
2704  *    typically provides higher-level behavior for its target. Prior to
2705  *    Mac OS X 10.5, only  window event targets have a standard
2706  *    handler; the window standard event hander may also be installed
2707  *    by setting the kWindowStandardHandlerAttribute flag. In Mac OS X
2708  *    10.5 and later, the application and menubar event targets also
2709  *    support standard event handlers. Calling
2710  *    InstallStandardEventHandler on any other type of target (control,
2711  *    menu, etc.) has no effect.
2712  *
2713  *    In Mac OS X 10.5 and later, InstallStandardEventHandler records
2714  *    the number of installation requests, and
2715  *    RemoveStandardEventHandler does not actually remove the standard
2716  *    handler until the count has been reduced to zero.
2717  *
2718  *  Mac OS X threading:
2719  *    Not thread safe
2720  *
2721  *  Parameters:
2722  *
2723  *    inTarget:
2724  *      The target whose standard handler should be installed.
2725  *
2726  *  Result:
2727  *    An operating system result code.
2728  *
2729  *  Availability:
2730  *    Mac OS X:         in version 10.0 and later in Carbon.framework [32-bit only]
2731  *    CarbonLib:        in CarbonLib 1.1 and later
2732  *    Non-Carbon CFM:   not available
2733  }
InstallStandardEventHandlernull2734 function InstallStandardEventHandler( inTarget: EventTargetRef ): OSStatus; external name '_InstallStandardEventHandler';
2735 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2736 
2737 
2738 {
2739  *  RemoveStandardEventHandler()
2740  *
2741  *  Summary:
2742  *    Removes the standard event handler (if any) for an event target.
2743  *
2744  *  Discussion:
2745  *    InstallStandardEventHandler records the number of installation
2746  *    requests, and RemoveStandardEventHandler does not actually remove
2747  *    the standard handler until the count has been reduced to zero.
2748  *
2749  *  Mac OS X threading:
2750  *    Not thread safe
2751  *
2752  *  Parameters:
2753  *
2754  *    inTarget:
2755  *      The target whose standard handler should be removed.
2756  *
2757  *  Result:
2758  *    An operating system result code.
2759  *
2760  *  Availability:
2761  *    Mac OS X:         in version 10.5 and later in Carbon.framework [32-bit only]
2762  *    CarbonLib:        not available
2763  *    Non-Carbon CFM:   not available
2764  }
RemoveStandardEventHandlernull2765 function RemoveStandardEventHandler( inTarget: EventTargetRef ): OSStatus; external name '_RemoveStandardEventHandler';
2766 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
2767 
2768 
2769 {��������������������������������������������������������������������������������������}
2770 {  � Adjusting set of event types after a handler is created                           }
2771 { After installing a handler with the routine above, you can adjust the event type     }
2772 { list telling the toolbox what events to send to that handler by calling the two      }
2773 { routines below. If you add an event type twice for the same handler, your handler    }
2774 { will only be called once, but it will take two RemoveEventType calls to stop your    }
2775 { handler from being called with that event type. In other words, the install count    }
2776 { for each event type is maintained by the toolbox. This might allow you, for example  }
2777 { to have subclasses of a window object register for types without caring if the base  }
2778 { class has already registered for that type. When the subclass removes its types, it  }
2779 { can successfully do so without affecting the base class's reception of its event     }
2780 { types, yielding eternal bliss.                                                       }
2781 {��������������������������������������������������������������������������������������}
2782 
2783 {$endc} {not TARGET_CPU_64}
2784 
2785 {
2786  *  AddEventTypesToHandler()
2787  *
2788  *  Discussion:
2789  *    Adds additional events to an event handler that has already been
2790  *    installed.
2791  *
2792  *  Mac OS X threading:
2793  *    Not thread safe
2794  *
2795  *  Parameters:
2796  *
2797  *    inHandlerRef:
2798  *      The event handler to add the additional events to.
2799  *
2800  *    inNumTypes:
2801  *      The number of events to add.
2802  *
2803  *    inList:
2804  *      A pointer to an array of EventTypeSpec entries.
2805  *
2806  *  Result:
2807  *    An operating system result code.
2808  *
2809  *  Availability:
2810  *    Mac OS X:         in version 10.0 and later in Carbon.framework
2811  *    CarbonLib:        in CarbonLib 1.1 and later
2812  *    Non-Carbon CFM:   not available
2813  }
AddEventTypesToHandlernull2814 function AddEventTypesToHandler( inHandlerRef: EventHandlerRef; inNumTypes: ItemCount; {const} inList: {variable-size-array} EventTypeSpecPtr ): OSStatus; external name '_AddEventTypesToHandler';
2815 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2816 
2817 
2818 {
2819  *  RemoveEventTypesFromHandler()
2820  *
2821  *  Discussion:
2822  *    Removes events from an event handler that has already been
2823  *    installed.
2824  *
2825  *  Mac OS X threading:
2826  *    Not thread safe
2827  *
2828  *  Parameters:
2829  *
2830  *    inHandlerRef:
2831  *      The event handler to remove the events from.
2832  *
2833  *    inNumTypes:
2834  *      The number of events to remove.
2835  *
2836  *    inList:
2837  *      A pointer to an array of EventTypeSpec entries.
2838  *
2839  *  Result:
2840  *    An operating system status code.
2841  *
2842  *  Availability:
2843  *    Mac OS X:         in version 10.0 and later in Carbon.framework
2844  *    CarbonLib:        in CarbonLib 1.1 and later
2845  *    Non-Carbon CFM:   not available
2846  }
RemoveEventTypesFromHandlernull2847 function RemoveEventTypesFromHandler( inHandlerRef: EventHandlerRef; inNumTypes: ItemCount; {const} inList: {variable-size-array} EventTypeSpecPtr ): OSStatus; external name '_RemoveEventTypesFromHandler';
2848 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2849 
2850 
2851 {��������������������������������������������������������������������������������������}
2852 {  � Explicit Propagation                                                              }
2853 {  CallNextEventHandler can be used to call thru to all handlers below the current     }
2854 {  handler being called. You pass the EventHandlerCallRef passed to your EventHandler  }
2855 {  into this call so that we know how to properly forward the event. The result of     }
2856 {  this function should normally be the result of your own handler that you called     }
2857 {  this API from. The typical use of this routine would be to allow the toolbox to do  }
2858 {  its standard processing and then follow up with some type of embellishment.         }
2859 {��������������������������������������������������������������������������������������}
2860 
2861 {
2862  *  CallNextEventHandler()
2863  *
2864  *  Discussion:
2865  *    Calls thru to the event handlers below you in the event handler
2866  *    stack of the target to which your handler is bound. You might use
2867  *    this to call thru to the default toolbox handling in order to
2868  *    post-process the event. You can only call this routine from
2869  *    within an event handler.
2870  *
2871  *  Mac OS X threading:
2872  *    Not thread safe
2873  *
2874  *  Parameters:
2875  *
2876  *    inCallRef:
2877  *      The event handler call ref passed into your event handler.
2878  *
2879  *    inEvent:
2880  *      The event to pass thru.
2881  *
2882  *  Result:
2883  *    An operating system result code.
2884  *
2885  *  Availability:
2886  *    Mac OS X:         in version 10.0 and later in Carbon.framework
2887  *    CarbonLib:        in CarbonLib 1.1 and later
2888  *    Non-Carbon CFM:   not available
2889  }
CallNextEventHandlernull2890 function CallNextEventHandler( inCallRef: EventHandlerCallRef; inEvent: EventRef ): OSStatus; external name '_CallNextEventHandler';
2891 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2892 
2893 
2894 {��������������������������������������������������������������������������������������}
2895 {  � Sending Events                                                                    }
2896 {��������������������������������������������������������������������������������������}
2897 
2898 {
2899  *  Summary:
2900  *    Options for the SendEventToEventTargetWithOptions API.
2901  }
2902 const
2903 {
2904    * The event should be sent to the target given only, and should not
2905    * propagate to any other target. CallNextEventHandler, when passed
2906    * an event sent with this option, will only call other event
2907    * handlers installed on the current event target; it will not
2908    * propagate the event to other event targets.
2909    }
2910 	kEventTargetDontPropagate = 1 shl 0;
2911 
2912   {
2913    * The event is a notification-style event, and should be received by
2914    * all handlers. The result is usually meaningless when sent in this
2915    * manner, though we do maintain the strongest result code while the
2916    * event falls through each handler. This means that if the first
2917    * handler to receive the event returned noErr, and the next returned
2918    * eventNotHandledErr, the result returned would actually be noErr.
2919    * No handler can stop this event from propagating; i.e., the result
2920    * code does not alter event flow.
2921    }
2922 	kEventTargetSendToAllHandlers = 1 shl 1;
2923 
2924 {
2925  *  SendEventToEventTarget()
2926  *
2927  *  Discussion:
2928  *    Sends an event to the specified event target.
2929  *
2930  *  Mac OS X threading:
2931  *    Not thread safe
2932  *
2933  *  Parameters:
2934  *
2935  *    inEvent:
2936  *      The event to send.
2937  *
2938  *    inTarget:
2939  *      The target to send it to.
2940  *
2941  *  Result:
2942  *    An operating system result code. The result is determined by both
2943  *    the SendEventToEventTarget API and also the event handlers that
2944  *    receive the event. SendEventToEventTarget will return paramErr if
2945  *    the event or the target are invalid, or eventNotHandledErr if the
2946  *    event is not wanted by any handler. If the event is received by a
2947  *    handler, however, then the result code returned by the API is
2948  *    determined by the handler; a handler may return any error code,
2949  *    and your code should not make any assumptions about exactly which
2950  *    errors will be returned by SendEventToEventTarget.
2951  *
2952  *  Availability:
2953  *    Mac OS X:         in version 10.0 and later in Carbon.framework
2954  *    CarbonLib:        in CarbonLib 1.1 and later
2955  *    Non-Carbon CFM:   not available
2956  }
SendEventToEventTargetnull2957 function SendEventToEventTarget( inEvent: EventRef; inTarget: EventTargetRef ): OSStatus; external name '_SendEventToEventTarget';
2958 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
2959 
2960 
2961 {
2962  *  SendEventToEventTargetWithOptions()
2963  *
2964  *  Discussion:
2965  *    Sends an event to the specified event target, optionally
2966  *    controlling how the event propagates. See the discussion of the
2967  *    event send options above for more detail.
2968  *
2969  *  Mac OS X threading:
2970  *    Not thread safe
2971  *
2972  *  Parameters:
2973  *
2974  *    inEvent:
2975  *      The event to send.
2976  *
2977  *    inTarget:
2978  *      The target to send it to.
2979  *
2980  *    inOptions:
2981  *      The options to modify the send behavior. Passing zero for this
2982  *      makes it behave just like SendEventToEventTarget.
2983  *
2984  *  Result:
2985  *    An operating system result code. The result is determined by both
2986  *    the SendEventToEventTargetWithOptions API and also the event
2987  *    handlers that receive the event.
2988  *    SendEventToEventTargetWithOptions will return paramErr if the
2989  *    event or the target are invalid, or eventNotHandledErr if the
2990  *    event is not wanted by any handler. If the event is received by a
2991  *    handler, however, then the result code returned by the API is
2992  *    determined by the handler; a handler may return any error code,
2993  *    and your code should not make any assumptions about exactly which
2994  *    errors will be returned by SendEventToEventTargetWithOptions.
2995  *
2996  *  Availability:
2997  *    Mac OS X:         in version 10.2 and later in Carbon.framework
2998  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
2999  *    Non-Carbon CFM:   not available
3000  }
SendEventToEventTargetWithOptionsnull3001 function SendEventToEventTargetWithOptions( inEvent: EventRef; inTarget: EventTargetRef; inOptions: OptionBits ): OSStatus; external name '_SendEventToEventTargetWithOptions';
3002 (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
3003 
3004 
3005 {��������������������������������������������������������������������������������������}
3006 {  � Secure Event Input                                                                }
3007 {��������������������������������������������������������������������������������������}
3008 {
3009  *  EnableSecureEventInput()
3010  *
3011  *  Summary:
3012  *    Enables secure event input mode.
3013  *
3014  *  Discussion:
3015  *    When secure event input is enabled, keyboard input will only go
3016  *    to the application with keyboard focus, and will not be echoed to
3017  *    other applications that might be using the event monitor target
3018  *    to watch keyboard input. The EditText and EditUnicodeText
3019  *    controls automatically enter secure input mode when a password
3020  *    control has the focus; if your application implements its own
3021  *    password entry, you should enable secure event input while the
3022  *    user is entering text.
3023  *
3024  *    This API maintains a count of the number of times that it has
3025  *    been called. Secure event input is not disabled until
3026  *    DisableSecureEventInput has been called the same number of
3027  *    times.
3028  *
3029  *    Be sure to disable secure event input if your application becomes
3030  *    inactive. If your application crashes, secure event input will
3031  *    automatically be disabled if no other application has enabled it.
3032  *
3033  *  Mac OS X threading:
3034  *    Not thread safe
3035  *
3036  *  Availability:
3037  *    Mac OS X:         in version 10.3 and later in Carbon.framework
3038  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
3039  *    Non-Carbon CFM:   not available
3040  }
EnableSecureEventInputnull3041 function EnableSecureEventInput: OSStatus; external name '_EnableSecureEventInput';
3042 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
3043 
3044 
3045 {
3046  *  DisableSecureEventInput()
3047  *
3048  *  Summary:
3049  *    Disables secure event input mode.
3050  *
3051  *  Discussion:
3052  *    When secure event input is enabled, keyboard input will only go
3053  *    to the application with keyboard focus, and will not be echoed to
3054  *    other applications that might be using the event monitor target
3055  *    to watch keyboard input. The EditText and EditUnicodeText
3056  *    controls automatically enter secure input mode when a password
3057  *    control has the focus; if your application implements its own
3058  *    password entry, you should enable secure event input while the
3059  *    user is entering text.
3060  *
3061  *    The EnableSecureEventInput API maintains a count of the number of
3062  *    times that it has been called. Secure event input is not disabled
3063  *    until this API has been called the same number of times.
3064  *
3065  *    Be sure to disable secure event input if your application becomes
3066  *    inactive. If your application crashes, secure event input will
3067  *    automatically be disabled if no other application has enabled it.
3068  *
3069  *  Mac OS X threading:
3070  *    Not thread safe
3071  *
3072  *  Availability:
3073  *    Mac OS X:         in version 10.3 and later in Carbon.framework
3074  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
3075  *    Non-Carbon CFM:   not available
3076  }
DisableSecureEventInputnull3077 function DisableSecureEventInput: OSStatus; external name '_DisableSecureEventInput';
3078 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
3079 
3080 
3081 {
3082  *  IsSecureEventInputEnabled()
3083  *
3084  *  Summary:
3085  *    Indicates whether secure event input is currently enabled.
3086  *
3087  *  Discussion:
3088  *    This API returns whether secure event input is enabled by any
3089  *    process, not just the current process. Secure event input may be
3090  *    disabled in the current process but enabled in some other
3091  *    process; in that case, this API will return true.
3092  *
3093  *  Mac OS X threading:
3094  *    Not thread safe
3095  *
3096  *  Availability:
3097  *    Mac OS X:         in version 10.3 and later in Carbon.framework
3098  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
3099  *    Non-Carbon CFM:   not available
3100  }
IsSecureEventInputEnablednull3101 function IsSecureEventInputEnabled: Boolean; external name '_IsSecureEventInputEnabled';
3102 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
3103 
3104 {$endc} {TARGET_OS_MAC}
3105 
3106 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
3107 
3108 end.
3109 {$endc} {not MACOSALLINCLUDE}
3110