CarbonEventsCore.pas 107 KB

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