AEInteraction.pas 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. {
  2. File: HIToolbox/AEInteraction.h
  3. Contains: AppleEvent functions that deal with Events and interacting with user
  4. Version: HIToolbox-219.4.81~2
  5. Copyright: © 2000-2005 by Apple Computer, Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://www.freepascal.org/bugs.html
  9. }
  10. { Pascal Translation Updated: Peter N Lewis, <[email protected]>, August 2005 }
  11. {
  12. Modified for use with Free Pascal
  13. Version 210
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$mode macpas}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$calling mwpascal}
  21. unit AEInteraction;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  24. {$setc GAP_INTERFACES_VERSION := $0210}
  25. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  26. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  27. {$endc}
  28. {$ifc defined CPUPOWERPC and defined CPUI386}
  29. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  30. {$endc}
  31. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  32. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  33. {$endc}
  34. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __i386__ and defined CPUI386}
  40. {$setc __i386__ := 1}
  41. {$elsec}
  42. {$setc __i386__ := 0}
  43. {$endc}
  44. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  45. {$error Conflicting definitions for __ppc__ and __i386__}
  46. {$endc}
  47. {$ifc defined __ppc__ and __ppc__}
  48. {$setc TARGET_CPU_PPC := TRUE}
  49. {$setc TARGET_CPU_X86 := FALSE}
  50. {$elifc defined __i386__ and __i386__}
  51. {$setc TARGET_CPU_PPC := FALSE}
  52. {$setc TARGET_CPU_X86 := TRUE}
  53. {$elsec}
  54. {$error Neither __ppc__ nor __i386__ is defined.}
  55. {$endc}
  56. {$setc TARGET_CPU_PPC_64 := FALSE}
  57. {$ifc defined FPC_BIG_ENDIAN}
  58. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  59. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  60. {$elifc defined FPC_LITTLE_ENDIAN}
  61. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  62. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  63. {$elsec}
  64. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  65. {$endc}
  66. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  67. {$setc CALL_NOT_IN_CARBON := FALSE}
  68. {$setc OLDROUTINENAMES := FALSE}
  69. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  70. {$setc OPAQUE_UPP_TYPES := TRUE}
  71. {$setc OTCARBONAPPLICATION := TRUE}
  72. {$setc OTKERNEL := FALSE}
  73. {$setc PM_USE_SESSION_APIS := TRUE}
  74. {$setc TARGET_API_MAC_CARBON := TRUE}
  75. {$setc TARGET_API_MAC_OS8 := FALSE}
  76. {$setc TARGET_API_MAC_OSX := TRUE}
  77. {$setc TARGET_CARBON := TRUE}
  78. {$setc TARGET_CPU_68K := FALSE}
  79. {$setc TARGET_CPU_MIPS := FALSE}
  80. {$setc TARGET_CPU_SPARC := FALSE}
  81. {$setc TARGET_OS_MAC := TRUE}
  82. {$setc TARGET_OS_UNIX := FALSE}
  83. {$setc TARGET_OS_WIN32 := FALSE}
  84. {$setc TARGET_RT_MAC_68881 := FALSE}
  85. {$setc TARGET_RT_MAC_CFM := FALSE}
  86. {$setc TARGET_RT_MAC_MACHO := TRUE}
  87. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  88. {$setc TYPE_BOOL := FALSE}
  89. {$setc TYPE_EXTENDED := FALSE}
  90. {$setc TYPE_LONGLONG := TRUE}
  91. uses MacTypes,Quickdraw,AEDataModel,Notification,Events;
  92. {$ALIGN MAC68K}
  93. {*************************************************************************
  94. AppleEvent callbacks.
  95. *************************************************************************}
  96. type
  97. AEIdleProcPtr = function( var theEvent: EventRecord; var sleepTime: SInt32; var mouseRgn: RgnHandle ): Boolean;
  98. type
  99. AEFilterProcPtr = function( var theEvent: EventRecord; returnID: SInt32; transactionID: SInt32; const (*var*) sender: AEAddressDesc ): Boolean;
  100. type
  101. AEIdleUPP = AEIdleProcPtr;
  102. type
  103. AEFilterUPP = AEFilterProcPtr;
  104. {*************************************************************************
  105. The next couple of calls are basic routines used to create, send,
  106. and process AppleEvents.
  107. *************************************************************************}
  108. {
  109. * AESend()
  110. *
  111. * Mac OS X threading:
  112. * Not thread safe
  113. *
  114. * Availability:
  115. * Mac OS X: in version 10.0 and later in Carbon.framework
  116. * CarbonLib: in CarbonLib 1.0 and later
  117. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  118. }
  119. function AESend( const (*var*) theAppleEvent: AppleEvent; var reply: AppleEvent; sendMode: AESendMode; sendPriority: AESendPriority; timeOutInTicks: SInt32; idleProc: AEIdleUPP { can be NULL }; filterProc: AEFilterUPP { can be NULL } ): OSErr; external name '_AESend';
  120. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  121. {
  122. * AEProcessAppleEvent()
  123. *
  124. * Mac OS X threading:
  125. * Not thread safe
  126. *
  127. * Availability:
  128. * Mac OS X: in version 10.0 and later in Carbon.framework
  129. * CarbonLib: in CarbonLib 1.0 and later
  130. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  131. }
  132. function AEProcessAppleEvent( const (*var*) theEventRecord: EventRecord ): OSErr; external name '_AEProcessAppleEvent';
  133. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  134. {
  135. Note: during event processing, an event handler may realize that it is likely
  136. to exceed the client's timeout limit. Passing the reply to this
  137. routine causes a wait event to be generated that asks the client
  138. for more time.
  139. }
  140. {
  141. * AEResetTimer()
  142. *
  143. * Mac OS X threading:
  144. * Not thread safe
  145. *
  146. * Availability:
  147. * Mac OS X: in version 10.0 and later in Carbon.framework
  148. * CarbonLib: in CarbonLib 1.0 and later
  149. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  150. }
  151. function AEResetTimer( const (*var*) reply: AppleEvent ): OSErr; external name '_AEResetTimer';
  152. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  153. {*************************************************************************
  154. The following three calls are used to allow applications to behave
  155. courteously when a user interaction such as a dialog box is needed.
  156. *************************************************************************}
  157. type
  158. AEInteractAllowed = SInt8;
  159. const
  160. kAEInteractWithSelf = 0;
  161. kAEInteractWithLocal = 1;
  162. kAEInteractWithAll = 2;
  163. {
  164. * AEGetInteractionAllowed()
  165. *
  166. * Mac OS X threading:
  167. * Not thread safe
  168. *
  169. * Availability:
  170. * Mac OS X: in version 10.0 and later in Carbon.framework
  171. * CarbonLib: in CarbonLib 1.0 and later
  172. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  173. }
  174. function AEGetInteractionAllowed( var level: AEInteractAllowed ): OSErr; external name '_AEGetInteractionAllowed';
  175. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  176. {
  177. * AESetInteractionAllowed()
  178. *
  179. * Mac OS X threading:
  180. * Not thread safe
  181. *
  182. * Availability:
  183. * Mac OS X: in version 10.0 and later in Carbon.framework
  184. * CarbonLib: in CarbonLib 1.0 and later
  185. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  186. }
  187. function AESetInteractionAllowed( level: AEInteractAllowed ): OSErr; external name '_AESetInteractionAllowed';
  188. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  189. {
  190. * AEInteractWithUser()
  191. *
  192. * Mac OS X threading:
  193. * Not thread safe
  194. *
  195. * Availability:
  196. * Mac OS X: in version 10.0 and later in Carbon.framework
  197. * CarbonLib: in CarbonLib 1.0 and later
  198. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  199. }
  200. function AEInteractWithUser( timeOutInTicks: SInt32; nmReqPtr: NMRecPtr; idleProc: AEIdleUPP ): OSErr; external name '_AEInteractWithUser';
  201. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  202. {*************************************************************************
  203. The following four calls are available for applications which need more
  204. sophisticated control over when and how events are processed. Applications
  205. which implement multi-session servers or which implement their own
  206. internal event queueing will probably be the major clients of these
  207. routines. They can be called from within a handler to prevent the AEM from
  208. disposing of the AppleEvent when the handler returns. They can be used to
  209. asynchronously process the event (as MacApp does).
  210. *************************************************************************}
  211. {
  212. * AESuspendTheCurrentEvent()
  213. *
  214. * Mac OS X threading:
  215. * Not thread safe
  216. *
  217. * Availability:
  218. * Mac OS X: in version 10.0 and later in Carbon.framework
  219. * CarbonLib: in CarbonLib 1.0 and later
  220. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  221. }
  222. function AESuspendTheCurrentEvent( const (*var*) theAppleEvent: AppleEvent ): OSErr; external name '_AESuspendTheCurrentEvent';
  223. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  224. {
  225. Note: The following routine tells the AppleEvent manager that processing
  226. is either about to resume or has been completed on a previously suspended
  227. event. The procPtr passed in as the dispatcher parameter will be called to
  228. attempt to redispatch the event. Several constants for the dispatcher
  229. parameter allow special behavior. They are:
  230. - kAEUseStandardDispatch means redispatch as if the event was just
  231. received, using the standard AppleEvent dispatch mechanism.
  232. - kAENoDispatch means ignore the parameter.
  233. Use this in the case where the event has been handled and no
  234. redispatch is needed.
  235. - non nil means call the routine which the dispatcher points to.
  236. }
  237. { Constants for Refcon in AEResumeTheCurrentEvent with kAEUseStandardDispatch }
  238. const
  239. kAEDoNotIgnoreHandler = $00000000;
  240. kAEIgnoreAppPhacHandler = $00000001; { available only in vers 1.0.1 and greater }
  241. kAEIgnoreAppEventHandler = $00000002; { available only in vers 1.0.1 and greater }
  242. kAEIgnoreSysPhacHandler = $00000004; { available only in vers 1.0.1 and greater }
  243. kAEIgnoreSysEventHandler = $00000008; { available only in vers 1.0.1 and greater }
  244. kAEIngoreBuiltInEventHandler = $00000010; { available only in vers 1.0.1 and greater }
  245. kAEDontDisposeOnResume = $80000000; { available only in vers 1.0.1 and greater }
  246. { Constants for AEResumeTheCurrentEvent }
  247. const
  248. kAENoDispatch = 0; { dispatch parameter to AEResumeTheCurrentEvent takes a pointer to a dispatch }
  249. kAEUseStandardDispatch = $FFFFFFFF; { table, or one of these two constants }
  250. {
  251. * AEResumeTheCurrentEvent()
  252. *
  253. * Mac OS X threading:
  254. * Not thread safe
  255. *
  256. * Availability:
  257. * Mac OS X: in version 10.0 and later in Carbon.framework
  258. * CarbonLib: in CarbonLib 1.0 and later
  259. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  260. }
  261. function AEResumeTheCurrentEvent( const (*var*) theAppleEvent: AppleEvent; const (*var*) reply: AppleEvent; dispatcher: AEEventHandlerUPP { can be NULL }; handlerRefcon: SInt32 ): OSErr; external name '_AEResumeTheCurrentEvent';
  262. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  263. {
  264. * AEGetTheCurrentEvent()
  265. *
  266. * Mac OS X threading:
  267. * Not thread safe
  268. *
  269. * Availability:
  270. * Mac OS X: in version 10.0 and later in Carbon.framework
  271. * CarbonLib: in CarbonLib 1.0 and later
  272. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  273. }
  274. function AEGetTheCurrentEvent( var theAppleEvent: AppleEvent ): OSErr; external name '_AEGetTheCurrentEvent';
  275. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  276. {
  277. * AESetTheCurrentEvent()
  278. *
  279. * Mac OS X threading:
  280. * Not thread safe
  281. *
  282. * Availability:
  283. * Mac OS X: in version 10.0 and later in Carbon.framework
  284. * CarbonLib: in CarbonLib 1.0 and later
  285. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  286. }
  287. function AESetTheCurrentEvent( const (*var*) theAppleEvent: AppleEvent ): OSErr; external name '_AESetTheCurrentEvent';
  288. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  289. {*************************************************************************
  290. AppleEvent callbacks.
  291. *************************************************************************}
  292. {
  293. * NewAEIdleUPP()
  294. *
  295. * Availability:
  296. * Mac OS X: in version 10.0 and later in Carbon.framework
  297. * CarbonLib: in CarbonLib 1.0 and later
  298. * Non-Carbon CFM: available as macro/inline
  299. }
  300. function NewAEIdleUPP( userRoutine: AEIdleProcPtr ): AEIdleUPP; external name '_NewAEIdleUPP';
  301. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  302. {
  303. * NewAEFilterUPP()
  304. *
  305. * Availability:
  306. * Mac OS X: in version 10.0 and later in Carbon.framework
  307. * CarbonLib: in CarbonLib 1.0 and later
  308. * Non-Carbon CFM: available as macro/inline
  309. }
  310. function NewAEFilterUPP( userRoutine: AEFilterProcPtr ): AEFilterUPP; external name '_NewAEFilterUPP';
  311. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  312. {
  313. * DisposeAEIdleUPP()
  314. *
  315. * Availability:
  316. * Mac OS X: in version 10.0 and later in Carbon.framework
  317. * CarbonLib: in CarbonLib 1.0 and later
  318. * Non-Carbon CFM: available as macro/inline
  319. }
  320. procedure DisposeAEIdleUPP( userUPP: AEIdleUPP ); external name '_DisposeAEIdleUPP';
  321. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  322. {
  323. * DisposeAEFilterUPP()
  324. *
  325. * Availability:
  326. * Mac OS X: in version 10.0 and later in Carbon.framework
  327. * CarbonLib: in CarbonLib 1.0 and later
  328. * Non-Carbon CFM: available as macro/inline
  329. }
  330. procedure DisposeAEFilterUPP( userUPP: AEFilterUPP ); external name '_DisposeAEFilterUPP';
  331. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  332. {
  333. * InvokeAEIdleUPP()
  334. *
  335. * Availability:
  336. * Mac OS X: in version 10.0 and later in Carbon.framework
  337. * CarbonLib: in CarbonLib 1.0 and later
  338. * Non-Carbon CFM: available as macro/inline
  339. }
  340. function InvokeAEIdleUPP( var theEvent: EventRecord; var sleepTime: SInt32; var mouseRgn: RgnHandle; userUPP: AEIdleUPP ): Boolean; external name '_InvokeAEIdleUPP';
  341. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  342. {
  343. * InvokeAEFilterUPP()
  344. *
  345. * Availability:
  346. * Mac OS X: in version 10.0 and later in Carbon.framework
  347. * CarbonLib: in CarbonLib 1.0 and later
  348. * Non-Carbon CFM: available as macro/inline
  349. }
  350. function InvokeAEFilterUPP( var theEvent: EventRecord; returnID: SInt32; transactionID: SInt32; const (*var*) sender: AEAddressDesc; userUPP: AEFilterUPP ): Boolean; external name '_InvokeAEFilterUPP';
  351. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  352. end.