CarbonEventsCore.pas 93 KB

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