AppleEvents.pas 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. {
  2. File: AppleEvents.p
  3. Contains: AppleEvent Package Interfaces.
  4. Version: Technology: System 7.5
  5. Release: Universal Interfaces 3.4.2
  6. Copyright: © 1989-2002 by Apple Computer, Inc., all rights reserved
  7. Bugs?: For bug reports, consult the following page on
  8. the World Wide Web:
  9. http://www.freepascal.org/bugs.html
  10. }
  11. {
  12. Modified for use with Free Pascal
  13. Version 200
  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 AppleEvents;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  24. {$setc GAP_INTERFACES_VERSION := $0200}
  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,MixedMode,AEDataModel,AEInteraction;
  92. {
  93. Note: The functions and types for the building and parsing AppleEvent
  94. messages has moved to AEDataModel.h
  95. }
  96. {
  97. Note: The functions for interacting with events has moved to AEInteraction.h
  98. }
  99. {$ALIGN MAC68K}
  100. const
  101. { Keywords for Apple event parameters }
  102. keyDirectObject = $2D2D2D2D (* '----' *);
  103. keyErrorNumber = $6572726E (* 'errn' *);
  104. keyErrorString = $65727273 (* 'errs' *);
  105. keyProcessSerialNumber = $70736E20 (* 'psn ' *); { Keywords for special handlers }
  106. keyPreDispatch = $70686163 (* 'phac' *); { preHandler accessor call }
  107. keySelectProc = $73656C68 (* 'selh' *); { more selector call }
  108. { Keyword for recording }
  109. keyAERecorderCount = $72656372 (* 'recr' *); { available only in vers 1.0.1 and greater }
  110. { Keyword for version information }
  111. keyAEVersion = $76657273 (* 'vers' *); { available only in vers 1.0.1 and greater }
  112. { Event Class }
  113. kCoreEventClass = $61657674 (* 'aevt' *);
  114. { Event IDÕs }
  115. kAEOpenApplication = $6F617070 (* 'oapp' *);
  116. kAEOpenDocuments = $6F646F63 (* 'odoc' *);
  117. kAEPrintDocuments = $70646F63 (* 'pdoc' *);
  118. kAEQuitApplication = $71756974 (* 'quit' *);
  119. kAEAnswer = $616E7372 (* 'ansr' *);
  120. kAEApplicationDied = $6F626974 (* 'obit' *);
  121. kAEShowPreferences = $70726566 (* 'pref' *); { sent by Mac OS X when the user chooses the Preferences item }
  122. { Constants for recording }
  123. kAEStartRecording = $72656361 (* 'reca' *); { available only in vers 1.0.1 and greater }
  124. kAEStopRecording = $72656363 (* 'recc' *); { available only in vers 1.0.1 and greater }
  125. kAENotifyStartRecording = $72656331 (* 'rec1' *); { available only in vers 1.0.1 and greater }
  126. kAENotifyStopRecording = $72656330 (* 'rec0' *); { available only in vers 1.0.1 and greater }
  127. kAENotifyRecording = $72656372 (* 'recr' *); { available only in vers 1.0.1 and greater }
  128. {
  129. * AEEventSource is defined as an SInt8 for compatability with pascal.
  130. * Important note: keyEventSourceAttr is returned by AttributePtr as a typeShortInteger.
  131. * Be sure to pass at least two bytes of storage to AEGetAttributePtr - the result can be
  132. * compared directly against the following enums.
  133. }
  134. type
  135. AEEventSource = SInt8;
  136. const
  137. kAEUnknownSource = 0;
  138. kAEDirectCall = 1;
  139. kAESameProcess = 2;
  140. kAELocalProcess = 3;
  141. kAERemoteProcess = 4;
  142. { *************************************************************************
  143. These calls are used to set up and modify the event dispatch table.
  144. ************************************************************************* }
  145. {
  146. * AEInstallEventHandler()
  147. *
  148. * Availability:
  149. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  150. * CarbonLib: in CarbonLib 1.0 and later
  151. * Mac OS X: in version 10.0 and later
  152. }
  153. function AEInstallEventHandler(theAEEventClass: AEEventClass; theAEEventID: AEEventID; handler: AEEventHandlerUPP; handlerRefcon: SInt32; isSysHandler: boolean): OSErr; external name '_AEInstallEventHandler';
  154. {
  155. * AERemoveEventHandler()
  156. *
  157. * Availability:
  158. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  159. * CarbonLib: in CarbonLib 1.0 and later
  160. * Mac OS X: in version 10.0 and later
  161. }
  162. function AERemoveEventHandler(theAEEventClass: AEEventClass; theAEEventID: AEEventID; handler: AEEventHandlerUPP; isSysHandler: boolean): OSErr; external name '_AERemoveEventHandler';
  163. {
  164. * AEGetEventHandler()
  165. *
  166. * Availability:
  167. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  168. * CarbonLib: in CarbonLib 1.0 and later
  169. * Mac OS X: in version 10.0 and later
  170. }
  171. function AEGetEventHandler(theAEEventClass: AEEventClass; theAEEventID: AEEventID; var handler: AEEventHandlerUPP; var handlerRefcon: SInt32; isSysHandler: boolean): OSErr; external name '_AEGetEventHandler';
  172. {*************************************************************************
  173. These calls are used to set up and modify special hooks into the
  174. AppleEvent manager.
  175. *************************************************************************}
  176. {
  177. * AEInstallSpecialHandler()
  178. *
  179. * Availability:
  180. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  181. * CarbonLib: in CarbonLib 1.0 and later
  182. * Mac OS X: in version 10.0 and later
  183. }
  184. function AEInstallSpecialHandler(functionClass: AEKeyword; handler: AEEventHandlerUPP; isSysHandler: boolean): OSErr; external name '_AEInstallSpecialHandler';
  185. {
  186. * AERemoveSpecialHandler()
  187. *
  188. * Availability:
  189. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  190. * CarbonLib: in CarbonLib 1.0 and later
  191. * Mac OS X: in version 10.0 and later
  192. }
  193. function AERemoveSpecialHandler(functionClass: AEKeyword; handler: AEEventHandlerUPP; isSysHandler: boolean): OSErr; external name '_AERemoveSpecialHandler';
  194. {
  195. * AEGetSpecialHandler()
  196. *
  197. * Availability:
  198. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  199. * CarbonLib: in CarbonLib 1.0 and later
  200. * Mac OS X: in version 10.0 and later
  201. }
  202. function AEGetSpecialHandler(functionClass: AEKeyword; var handler: AEEventHandlerUPP; isSysHandler: boolean): OSErr; external name '_AEGetSpecialHandler';
  203. {*************************************************************************
  204. This call was added in version 1.0.1. If called with the keyword
  205. keyAERecorderCount ('recr'), the number of recorders that are
  206. currently active is returned in 'result'
  207. (available only in vers 1.0.1 and greater).
  208. *************************************************************************}
  209. {
  210. * AEManagerInfo()
  211. *
  212. * Availability:
  213. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  214. * CarbonLib: in CarbonLib 1.0 and later
  215. * Mac OS X: in version 10.0 and later
  216. }
  217. function AEManagerInfo(keyWord: AEKeyword; var result: SInt32): OSErr; external name '_AEManagerInfo';
  218. {$ALIGN MAC68K}
  219. end.