Events.pas 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888
  1. {
  2. File: HIToolbox/Events.h
  3. Contains: Event Manager Interfaces.
  4. Version: HIToolbox-219.4.81~2
  5. Copyright: © 1985-2005 by Apple Computer, Inc., all rights reserved
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://www.freepascal.org/bugs.html
  9. }
  10. { Pascal Translation Updated: Peter N Lewis, <[email protected]>, August 2005 }
  11. {
  12. Modified for use with Free Pascal
  13. Version 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 Events;
  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,OSUtils,Quickdraw,Endian;
  92. {$ALIGN MAC68K}
  93. type
  94. EventKind = UInt16;
  95. type
  96. EventMask = UInt16;
  97. const
  98. nullEvent = 0;
  99. mouseDown = 1;
  100. mouseUp = 2;
  101. keyDown = 3;
  102. keyUp = 4;
  103. autoKey = 5;
  104. updateEvt = 6;
  105. diskEvt = 7; { Not sent in Carbon. See kEventClassVolume in CarbonEvents.h}
  106. activateEvt = 8;
  107. osEvt = 15;
  108. kHighLevelEvent = 23;
  109. const
  110. mDownMask = 1 shl mouseDown; { mouse button pressed}
  111. mUpMask = 1 shl mouseUp; { mouse button released}
  112. keyDownMask = 1 shl keyDown; { key pressed}
  113. keyUpMask = 1 shl keyUp; { key released}
  114. autoKeyMask = 1 shl autoKey; { key repeatedly held down}
  115. updateMask = 1 shl updateEvt; { window needs updating}
  116. diskMask = 1 shl diskEvt; { disk inserted}
  117. activMask = 1 shl activateEvt; { activate/deactivate window}
  118. highLevelEventMask = $0400; { high-level events (includes AppleEvents)}
  119. osMask = 1 shl osEvt; { operating system events (suspend, resume)}
  120. everyEvent = $FFFF; { all of the above}
  121. const
  122. charCodeMask = $000000FF;
  123. keyCodeMask = $0000FF00;
  124. adbAddrMask = $00FF0000;
  125. osEvtMessageMask = $FF000000;
  126. const
  127. { OS event messages. Event (sub)code is in the high byte of the message field.}
  128. mouseMovedMessage = $00FA;
  129. suspendResumeMessage = $0001;
  130. const
  131. resumeFlag = 1; { Bit 0 of message indicates resume vs suspend}
  132. {
  133. CARBON ALERT! BATTLESTATIONS!
  134. The EventModifiers bits defined here are also used in the newer Carbon Event
  135. key modifiers parameters. There are two main differences:
  136. 1) The Carbon key modifiers parameter is a UInt32, not a UInt16. Never try to
  137. extract the key modifiers parameter from a Carbon Event into an EventModifiers
  138. type. You will probably get your stack trashed.
  139. 2) The Carbon key modifiers is just that: key modifiers. That parameter will
  140. never contain the button state bit.
  141. }
  142. type
  143. EventModifiers = UInt16;
  144. const
  145. { modifiers }
  146. activeFlagBit = 0; { activate? (activateEvt and mouseDown)}
  147. btnStateBit = 7; { state of button?}
  148. cmdKeyBit = 8; { command key down?}
  149. shiftKeyBit = 9; { shift key down?}
  150. alphaLockBit = 10; { alpha lock down?}
  151. optionKeyBit = 11; { option key down?}
  152. controlKeyBit = 12; { control key down?}
  153. rightShiftKeyBit = 13; { right shift key down? Not supported on Mac OS X.}
  154. rightOptionKeyBit = 14; { right Option key down? Not supported on Mac OS X.}
  155. rightControlKeyBit = 15; { right Control key down? Not supported on Mac OS X.}
  156. const
  157. activeFlag = 1 shl activeFlagBit;
  158. btnState = 1 shl btnStateBit;
  159. cmdKey = 1 shl cmdKeyBit;
  160. shiftKey = 1 shl shiftKeyBit;
  161. alphaLock = 1 shl alphaLockBit;
  162. optionKey = 1 shl optionKeyBit;
  163. controlKey = 1 shl controlKeyBit;
  164. rightShiftKey = 1 shl rightShiftKeyBit; { Not supported on Mac OS X.}
  165. rightOptionKey = 1 shl rightOptionKeyBit; { Not supported on Mac OS X.}
  166. rightControlKey = 1 shl rightControlKeyBit; { Not supported on Mac OS X.}
  167. { MacRoman character codes}
  168. const
  169. kNullCharCode = 0;
  170. kHomeCharCode = 1;
  171. kEnterCharCode = 3;
  172. kEndCharCode = 4;
  173. kHelpCharCode = 5;
  174. kBellCharCode = 7;
  175. kBackspaceCharCode = 8;
  176. kTabCharCode = 9;
  177. kLineFeedCharCode = 10;
  178. kVerticalTabCharCode = 11;
  179. kPageUpCharCode = 11;
  180. kFormFeedCharCode = 12;
  181. kPageDownCharCode = 12;
  182. kReturnCharCode = 13;
  183. kFunctionKeyCharCode = 16;
  184. kCommandCharCode = 17; { glyph available only in system fonts}
  185. kCheckCharCode = 18; { glyph available only in system fonts}
  186. kDiamondCharCode = 19; { glyph available only in system fonts}
  187. kAppleLogoCharCode = 20; { glyph available only in system fonts}
  188. kEscapeCharCode = 27;
  189. kClearCharCode = 27;
  190. kLeftArrowCharCode = 28;
  191. kRightArrowCharCode = 29;
  192. kUpArrowCharCode = 30;
  193. kDownArrowCharCode = 31;
  194. kSpaceCharCode = 32;
  195. kDeleteCharCode = 127;
  196. kBulletCharCode = 165;
  197. kNonBreakingSpaceCharCode = 202;
  198. { useful Unicode code points}
  199. const
  200. kShiftUnicode = $21E7; { Unicode UPWARDS WHITE ARROW}
  201. kControlUnicode = $2303; { Unicode UP ARROWHEAD}
  202. kOptionUnicode = $2325; { Unicode OPTION KEY}
  203. kCommandUnicode = $2318; { Unicode PLACE OF INTEREST SIGN}
  204. kPencilUnicode = $270E; { Unicode LOWER RIGHT PENCIL; actually pointed left until Mac OS X 10.3}
  205. kPencilLeftUnicode = $F802; { Unicode LOWER LEFT PENCIL; available in Mac OS X 10.3 and later}
  206. kCheckUnicode = $2713; { Unicode CHECK MARK}
  207. kDiamondUnicode = $25C6; { Unicode BLACK DIAMOND}
  208. kBulletUnicode = $2022; { Unicode BULLET}
  209. kAppleLogoUnicode = $F8FF; { Unicode APPLE LOGO}
  210. type
  211. EventRecord = record
  212. what: EventKind;
  213. message: UInt32;
  214. when: UInt32;
  215. where: Point;
  216. modifiers: EventModifiers;
  217. end;
  218. EventRecordPtr = ^EventRecord;
  219. type
  220. FKEYProcPtr = procedure;
  221. type
  222. FKEYUPP = FKEYProcPtr;
  223. {
  224. * NewFKEYUPP()
  225. *
  226. * Availability:
  227. * Mac OS X: not available
  228. * CarbonLib: not available
  229. * Non-Carbon CFM: available as macro/inline
  230. }
  231. {
  232. * DisposeFKEYUPP()
  233. *
  234. * Availability:
  235. * Mac OS X: not available
  236. * CarbonLib: not available
  237. * Non-Carbon CFM: available as macro/inline
  238. }
  239. {
  240. * InvokeFKEYUPP()
  241. *
  242. * Availability:
  243. * Mac OS X: not available
  244. * CarbonLib: not available
  245. * Non-Carbon CFM: available as macro/inline
  246. }
  247. {
  248. * GetMouse()
  249. *
  250. * Mac OS X threading:
  251. * Not thread safe
  252. *
  253. * Availability:
  254. * Mac OS X: in version 10.0 and later in Carbon.framework
  255. * CarbonLib: in CarbonLib 1.0 and later
  256. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  257. }
  258. procedure GetMouse( var mouseLoc: Point ); external name '_GetMouse';
  259. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  260. {
  261. * Button()
  262. *
  263. * Mac OS X threading:
  264. * Not thread safe
  265. *
  266. * Availability:
  267. * Mac OS X: in version 10.0 and later in Carbon.framework
  268. * CarbonLib: in CarbonLib 1.0 and later
  269. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  270. }
  271. function Button: Boolean; external name '_Button';
  272. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  273. {
  274. * StillDown()
  275. *
  276. * Mac OS X threading:
  277. * Not thread safe
  278. *
  279. * Availability:
  280. * Mac OS X: in version 10.0 and later in Carbon.framework
  281. * CarbonLib: in CarbonLib 1.0 and later
  282. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  283. }
  284. function StillDown: Boolean; external name '_StillDown';
  285. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  286. {
  287. * WaitMouseUp()
  288. *
  289. * Mac OS X threading:
  290. * Not thread safe
  291. *
  292. * Availability:
  293. * Mac OS X: in version 10.0 and later in Carbon.framework
  294. * CarbonLib: in CarbonLib 1.0 and later
  295. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  296. }
  297. function WaitMouseUp: Boolean; external name '_WaitMouseUp';
  298. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  299. {
  300. * KeyTranslate()
  301. *
  302. * Mac OS X threading:
  303. * Not thread safe
  304. *
  305. * Availability:
  306. * Mac OS X: in version 10.0 and later in Carbon.framework
  307. * CarbonLib: in CarbonLib 1.0 and later
  308. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  309. }
  310. function KeyTranslate( transData: {const} UnivPtr; keycode: UInt16; var state: UInt32 ): UInt32; external name '_KeyTranslate';
  311. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  312. {
  313. * GetCaretTime()
  314. *
  315. * Mac OS X threading:
  316. * Not thread safe
  317. *
  318. * Availability:
  319. * Mac OS X: in version 10.0 and later in Carbon.framework
  320. * CarbonLib: in CarbonLib 1.0 and later
  321. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  322. }
  323. function GetCaretTime: UInt32; external name '_GetCaretTime';
  324. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  325. {
  326. QuickTime 3.0 supports GetKeys() on unix and win32
  327. But, on little endian machines you will have to be
  328. careful about bit numberings and/or use a KeyMapByteArray
  329. instead
  330. }
  331. type
  332. KeyMap = array [0..3] of BigEndianLong;
  333. {
  334. * GetKeys()
  335. *
  336. * Mac OS X threading:
  337. * Not thread safe
  338. *
  339. * Availability:
  340. * Mac OS X: in version 10.0 and later in Carbon.framework
  341. * CarbonLib: in CarbonLib 1.0 and later
  342. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  343. }
  344. procedure GetKeys( var theKeys: KeyMap ); external name '_GetKeys';
  345. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  346. { Obsolete event types & masks }
  347. const
  348. networkEvt = 10;
  349. driverEvt = 11;
  350. app1Evt = 12;
  351. app2Evt = 13;
  352. app3Evt = 14;
  353. app4Evt = 15;
  354. networkMask = $0400;
  355. driverMask = $0800;
  356. app1Mask = $1000;
  357. app2Mask = $2000;
  358. app3Mask = $4000;
  359. app4Mask = $8000;
  360. type
  361. EvQEl = record
  362. qLink: QElemPtr;
  363. qType: SInt16;
  364. evtQWhat: EventKind; { this part is identical to the EventRecord as defined above }
  365. evtQMessage: UInt32;
  366. evtQWhen: UInt32;
  367. evtQWhere: Point;
  368. evtQModifiers: EventModifiers;
  369. end;
  370. EvQElPtr = ^EvQEl;
  371. type
  372. GetNextEventFilterProcPtr = procedure( var theEvent: EventRecord; var result: Boolean );
  373. type
  374. GetNextEventFilterUPP = GetNextEventFilterProcPtr;
  375. {
  376. * NewGetNextEventFilterUPP()
  377. *
  378. * Availability:
  379. * Mac OS X: not available
  380. * CarbonLib: not available
  381. * Non-Carbon CFM: available as macro/inline
  382. }
  383. {
  384. * DisposeGetNextEventFilterUPP()
  385. *
  386. * Availability:
  387. * Mac OS X: not available
  388. * CarbonLib: not available
  389. * Non-Carbon CFM: available as macro/inline
  390. }
  391. {
  392. * InvokeGetNextEventFilterUPP()
  393. *
  394. * Availability:
  395. * Mac OS X: not available
  396. * CarbonLib: not available
  397. * Non-Carbon CFM: available as macro/inline
  398. }
  399. type
  400. GNEFilterUPP = GetNextEventFilterUPP;
  401. {
  402. * GetDblTime()
  403. *
  404. * Mac OS X threading:
  405. * Not thread safe
  406. *
  407. * Availability:
  408. * Mac OS X: in version 10.0 and later in Carbon.framework
  409. * CarbonLib: in CarbonLib 1.0 and later
  410. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  411. }
  412. function GetDblTime: UInt32; external name '_GetDblTime';
  413. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  414. {
  415. * SetEventMask()
  416. *
  417. * Mac OS X threading:
  418. * Not thread safe
  419. *
  420. * Availability:
  421. * Mac OS X: in version 10.0 and later in Carbon.framework
  422. * CarbonLib: in CarbonLib 1.0 and later
  423. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  424. }
  425. procedure SetEventMask( value: EventMask ); external name '_SetEventMask';
  426. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  427. {
  428. * GetEvQHdr()
  429. *
  430. * Availability:
  431. * Mac OS X: not available
  432. * CarbonLib: not available
  433. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  434. }
  435. {
  436. * PPostEvent()
  437. *
  438. * Availability:
  439. * Mac OS X: not available
  440. * CarbonLib: not available
  441. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  442. }
  443. {
  444. * GetNextEvent()
  445. *
  446. * Mac OS X threading:
  447. * Not thread safe
  448. *
  449. * Availability:
  450. * Mac OS X: in version 10.0 and later in Carbon.framework
  451. * CarbonLib: in CarbonLib 1.0 and later
  452. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  453. }
  454. function GetNextEvent( eventMask_: EventMask; var theEvent: EventRecord ): Boolean; external name '_GetNextEvent';
  455. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  456. {
  457. * WaitNextEvent()
  458. *
  459. * Mac OS X threading:
  460. * Not thread safe
  461. *
  462. * Availability:
  463. * Mac OS X: in version 10.0 and later in Carbon.framework
  464. * CarbonLib: in CarbonLib 1.0 and later
  465. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  466. }
  467. function WaitNextEvent( eventMask_: EventMask; var theEvent: EventRecord; sleep: UInt32; mouseRgn: RgnHandle { can be NULL } ): Boolean; external name '_WaitNextEvent';
  468. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  469. {
  470. * EventAvail()
  471. *
  472. * Mac OS X threading:
  473. * Not thread safe
  474. *
  475. * Availability:
  476. * Mac OS X: in version 10.0 and later in Carbon.framework
  477. * CarbonLib: in CarbonLib 1.0 and later
  478. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  479. }
  480. function EventAvail( eventMask_: EventMask; var theEvent: EventRecord ): Boolean; external name '_EventAvail';
  481. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  482. {
  483. * PostEvent()
  484. *
  485. * Mac OS X threading:
  486. * Not thread safe
  487. *
  488. * Availability:
  489. * Mac OS X: in version 10.0 and later in Carbon.framework
  490. * CarbonLib: in CarbonLib 1.0 and later
  491. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  492. }
  493. function PostEvent( eventNum: EventKind; eventMsg: UInt32 ): OSErr; external name '_PostEvent';
  494. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  495. {
  496. For Carbon, use EventAvail, TickCount, GetGlobalMouse,
  497. GetKeys, or GetCurrentKeyModifiers instead of
  498. OSEventAvail, and use GetNextEvent or WaitNextEvent
  499. instead of GetOSEvent.
  500. }
  501. {
  502. * OSEventAvail()
  503. *
  504. * Availability:
  505. * Mac OS X: not available
  506. * CarbonLib: not available
  507. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  508. }
  509. {
  510. * GetOSEvent()
  511. *
  512. * Availability:
  513. * Mac OS X: not available
  514. * CarbonLib: not available
  515. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  516. }
  517. {
  518. * FlushEvents()
  519. *
  520. * Mac OS X threading:
  521. * Not thread safe
  522. *
  523. * Availability:
  524. * Mac OS X: in version 10.0 and later in Carbon.framework
  525. * CarbonLib: in CarbonLib 1.0 and later
  526. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  527. }
  528. procedure FlushEvents( whichMask: EventMask; stopMask: EventMask ); external name '_FlushEvents';
  529. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  530. {
  531. * SystemClick()
  532. *
  533. * Availability:
  534. * Mac OS X: not available
  535. * CarbonLib: not available
  536. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  537. }
  538. {
  539. * SystemTask()
  540. *
  541. * Availability:
  542. * Mac OS X: not available
  543. * CarbonLib: not available
  544. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  545. }
  546. {
  547. * SystemEvent()
  548. *
  549. * Availability:
  550. * Mac OS X: not available
  551. * CarbonLib: not available
  552. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  553. }
  554. (*
  555. #if OLDROUTINENAMES
  556. #define KeyTrans(transData, keycode, state) KeyTranslate(transData, keycode, state)
  557. #endif { OLDROUTINENAMES }
  558. *)
  559. {
  560. GetGlobalMouse, GetCurrentKeyModifiers, and CheckEventQueueForUserCancel
  561. are only available as part of the Carbon API.
  562. }
  563. {
  564. * GetGlobalMouse()
  565. *
  566. * Summary:
  567. * Returns the position of the mouse in global coordinates.
  568. *
  569. * Mac OS X threading:
  570. * Not thread safe
  571. *
  572. * Parameters:
  573. *
  574. * globalMouse:
  575. * On exit, contains the mouse position in global coordinates.
  576. *
  577. * Availability:
  578. * Mac OS X: in version 10.0 and later in Carbon.framework
  579. * CarbonLib: in CarbonLib 1.0 and later
  580. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  581. }
  582. procedure GetGlobalMouse( var globalMouse: Point ); external name '_GetGlobalMouse';
  583. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  584. {
  585. * GetCurrentKeyModifiers()
  586. *
  587. * Summary:
  588. * Returns the current hardware keyboard modifier state.
  589. *
  590. * Discussion:
  591. * In most cases, you should not use GetCurrentKeyModifiers, but
  592. * should use the GetCurrentEventKeyModifiers function instead.
  593. * GetCurrentEventKeyModifiers is much faster than
  594. * GetCurrentKeyModifiers because it returns the locally cached
  595. * modifier state; GetCurrentKeyModifiers must get the modifier
  596. * state from the window server, which is slower. Using
  597. * GetCurrentKeyModifiers also can prevent your application from
  598. * being operated by remote posting of events, since the hardware
  599. * input device is not actually changing state in that case. Most
  600. * commonly, you might need to use GetCurrentKeyModifiers when your
  601. * application is not the active application (as determined by the
  602. * Process Manager function GetFrontProcess). In that case, the
  603. * cached modifier state returned by GetCurrentEventKeyModifiers is
  604. * not valid because modifier-changed events are not flowing to your
  605. * application, and you must use GetCurrentKeyModifiers to determine
  606. * the current hardware state.
  607. *
  608. * Mac OS X threading:
  609. * Not thread safe
  610. *
  611. * Result:
  612. * The hardware state of the keyboard modifiers. The format of the
  613. * return value is the same as the modifiers field of an EventRecord
  614. * (but only includes keyboard modifiers and not the other modifier
  615. * flags included in an EventRecord).
  616. *
  617. * Availability:
  618. * Mac OS X: in version 10.0 and later in Carbon.framework
  619. * CarbonLib: in CarbonLib 1.0 and later
  620. * Non-Carbon CFM: not available
  621. }
  622. function GetCurrentKeyModifiers: UInt32; external name '_GetCurrentKeyModifiers';
  623. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  624. {
  625. * CheckEventQueueForUserCancel()
  626. *
  627. * Summary:
  628. * Determines if there is a cancel event in the main thread's event
  629. * queue.
  630. *
  631. * Discussion:
  632. * This API supports two cancel events: Escape and Cmd-Period. The
  633. * cancel event itself, as well as mouse or keyboard events in front
  634. * of the cancel event in the event queue, will be removed from the
  635. * queue.
  636. *
  637. * Mac OS X threading:
  638. * Not thread safe
  639. *
  640. * Availability:
  641. * Mac OS X: in version 10.0 and later in Carbon.framework
  642. * CarbonLib: in CarbonLib 1.0.2 and later
  643. * Non-Carbon CFM: not available
  644. }
  645. function CheckEventQueueForUserCancel: Boolean; external name '_CheckEventQueueForUserCancel';
  646. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  647. {
  648. * KeyScript()
  649. *
  650. * Mac OS X threading:
  651. * Not thread safe
  652. *
  653. * Availability:
  654. * Mac OS X: in version 10.0 and later in Carbon.framework
  655. * CarbonLib: in CarbonLib 1.0 and later
  656. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  657. }
  658. procedure KeyScript( code: SInt16 ); external name '_KeyScript';
  659. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  660. {
  661. * IsCmdChar()
  662. *
  663. * Mac OS X threading:
  664. * Not thread safe
  665. *
  666. * Availability:
  667. * Mac OS X: in version 10.0 and later in Carbon.framework
  668. * CarbonLib: in CarbonLib 1.0 and later
  669. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  670. }
  671. function IsCmdChar( const (*var*) event: EventRecord; test: SInt16 ): Boolean; external name '_IsCmdChar';
  672. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  673. {
  674. LowMem accessor functions previously in LowMem.h
  675. }
  676. {
  677. * LMGetKeyThresh()
  678. *
  679. * Mac OS X threading:
  680. * Not thread safe
  681. *
  682. * Availability:
  683. * Mac OS X: in version 10.0 and later in Carbon.framework
  684. * CarbonLib: in CarbonLib 1.0 and later
  685. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  686. }
  687. function LMGetKeyThresh: SInt16; external name '_LMGetKeyThresh';
  688. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  689. {
  690. * LMSetKeyThresh()
  691. *
  692. * Mac OS X threading:
  693. * Not thread safe
  694. *
  695. * Availability:
  696. * Mac OS X: in version 10.0 and later in Carbon.framework
  697. * CarbonLib: in CarbonLib 1.0 and later
  698. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  699. }
  700. procedure LMSetKeyThresh( value: SInt16 ); external name '_LMSetKeyThresh';
  701. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  702. {
  703. * LMGetKeyRepThresh()
  704. *
  705. * Mac OS X threading:
  706. * Not thread safe
  707. *
  708. * Availability:
  709. * Mac OS X: in version 10.0 and later in Carbon.framework
  710. * CarbonLib: in CarbonLib 1.0 and later
  711. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  712. }
  713. function LMGetKeyRepThresh: SInt16; external name '_LMGetKeyRepThresh';
  714. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  715. {
  716. * LMSetKeyRepThresh()
  717. *
  718. * Mac OS X threading:
  719. * Not thread safe
  720. *
  721. * Availability:
  722. * Mac OS X: in version 10.0 and later in Carbon.framework
  723. * CarbonLib: in CarbonLib 1.0 and later
  724. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  725. }
  726. procedure LMSetKeyRepThresh( value: SInt16 ); external name '_LMSetKeyRepThresh';
  727. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  728. {
  729. * LMGetKbdLast()
  730. *
  731. * Mac OS X threading:
  732. * Not thread safe
  733. *
  734. * Availability:
  735. * Mac OS X: in version 10.0 and later in Carbon.framework
  736. * CarbonLib: in CarbonLib 1.0 and later
  737. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  738. }
  739. function LMGetKbdLast: UInt8; external name '_LMGetKbdLast';
  740. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  741. {
  742. * LMSetKbdLast()
  743. *
  744. * Mac OS X threading:
  745. * Not thread safe
  746. *
  747. * Availability:
  748. * Mac OS X: in version 10.0 and later in Carbon.framework
  749. * CarbonLib: in CarbonLib 1.0 and later
  750. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  751. }
  752. procedure LMSetKbdLast( value: UInt8 ); external name '_LMSetKbdLast';
  753. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  754. {
  755. * LMGetKbdType()
  756. *
  757. * Mac OS X threading:
  758. * Not thread safe
  759. *
  760. * Availability:
  761. * Mac OS X: in version 10.0 and later in Carbon.framework
  762. * CarbonLib: in CarbonLib 1.0 and later
  763. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  764. }
  765. function LMGetKbdType: UInt8; external name '_LMGetKbdType';
  766. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  767. {
  768. * LMSetKbdType()
  769. *
  770. * Mac OS X threading:
  771. * Not thread safe
  772. *
  773. * Availability:
  774. * Mac OS X: in version 10.0 and later in Carbon.framework
  775. * CarbonLib: in CarbonLib 1.0 and later
  776. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  777. }
  778. procedure LMSetKbdType( value: UInt8 ); external name '_LMSetKbdType';
  779. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  780. end.