Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5636 lines
207 KiB

  1. /*
  2. File: CarbonEvents.h
  3. Contains: Carbon Event Manager
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1999-2002 by Apple Computer, Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __CARBONEVENTS__
  11. #define __CARBONEVENTS__
  12. #ifndef __CFSTRING__
  13. #include <CFString.h>
  14. #endif
  15. #ifndef __AEREGISTRY__
  16. #include <AERegistry.h>
  17. #endif
  18. #ifndef __AEDATAMODEL__
  19. #include <AEDataModel.h>
  20. #endif
  21. #ifndef __CARBONEVENTSCORE__
  22. #include <CarbonEventsCore.h>
  23. #endif
  24. #ifndef __EVENTS__
  25. #include <Events.h>
  26. #endif
  27. #ifndef __MENUS__
  28. #include <Menus.h>
  29. #endif
  30. #ifndef __CONTROLS__
  31. #include <Controls.h>
  32. #endif
  33. #ifndef __MACWINDOWS__
  34. #include <MacWindows.h>
  35. #endif
  36. #if PRAGMA_ONCE
  37. #pragma once
  38. #endif
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42. #if PRAGMA_IMPORT
  43. #pragma import on
  44. #endif
  45. #if PRAGMA_STRUCT_ALIGN
  46. #pragma options align=mac68k
  47. #elif PRAGMA_STRUCT_PACKPUSH
  48. #pragma pack(push, 2)
  49. #elif PRAGMA_STRUCT_PACK
  50. #pragma pack(2)
  51. #endif
  52. /*
  53. * Discussion:
  54. * These are returned from calls to TrackMouseLocation and
  55. * TrackMouseRegion. Those routines are designed as replacements to
  56. * calls such as StillDown and WaitMouseUp. The advantage over those
  57. * routines is that TrackMouseLocation and TrackMouseRegion will
  58. * block if the user is not moving the mouse, whereas mouse tracking
  59. * loops based on StillDown and WaitMouseUp will spin, chewing up
  60. * valuable CPU time that could be better spent elsewhere. It is
  61. * highly recommended that any tracking loops in your application
  62. * stop using StillDown and WaitMouseUp and start using
  63. * TrackMouseLocation/Region. See the notes on those routines for
  64. * more information.
  65. */
  66. enum {
  67. kTrackMouseLocationOptionDontConsumeMouseUp = (1 << 0)
  68. };
  69. typedef UInt16 MouseTrackingResult;
  70. enum {
  71. kMouseTrackingMouseDown = 1,
  72. kMouseTrackingMouseUp = 2,
  73. kMouseTrackingMouseExited = 3,
  74. kMouseTrackingMouseEntered = 4,
  75. kMouseTrackingMouseDragged = 5,
  76. kMouseTrackingKeyModifiersChanged = 6,
  77. kMouseTrackingUserCancelled = 7,
  78. kMouseTrackingTimedOut = 8,
  79. kMouseTrackingMouseMoved = 9
  80. };
  81. /*--------------------------------------------------------------------------------------*/
  82. /* o Helpful utilities */
  83. /*--------------------------------------------------------------------------------------*/
  84. /*
  85. * IsUserCancelEventRef()
  86. *
  87. * Discussion:
  88. * Tests the event given to see whether the event represents a 'user
  89. * cancel' event. Currently this is defined to be either the escape
  90. * key being pressed, or command-period being pressed.
  91. *
  92. * Result:
  93. * A boolean value indicating whether the event is a user cancel
  94. * event.
  95. *
  96. * Availability:
  97. * Non-Carbon CFM: not available
  98. * CarbonLib: in CarbonLib 1.1 and later
  99. * Mac OS X: in version 10.0 and later
  100. */
  101. EXTERN_API( Boolean )
  102. IsUserCancelEventRef(EventRef event);
  103. /*
  104. * TrackMouseLocation()
  105. *
  106. * Discussion:
  107. * Once entered, this routine waits for certain mouse events (move,
  108. * mouse down, mouse up). When one of these events occurs, the
  109. * function returns and tells the caller what happened and where the
  110. * mouse is currently located. While there is no activity, the
  111. * current event loop is run, effectively blocking the current
  112. * thread (save for any timers that fire). This helps to minimize
  113. * CPU usage when there is nothing going on.
  114. *
  115. * On Mac OS X 10.1 and earlier, and CarbonLib 1.5 and earlier,
  116. * TrackMouseLocation, TrackMouseLocationWithOptions, and
  117. * TrackMouseRegion only support mouse-tracking when a mouse button
  118. * is pressed. They cannot be used for mouse-tracking when no mouse
  119. * button is pressed; if called when no button is pressed, they will
  120. * simply block until a button is pressed and will not return when
  121. * the mouse is moved. On Mac OS X 10.2 and CarbonLib 1.6 and later,
  122. * TrackMouseLocation, TrackMouseLocationWithOptions, and
  123. * TrackMouseRegion support mouse-tracking without a pressed mouse
  124. * button; TrackMouseLocation and TrackMouseLocationWithOptions
  125. * return kMouseTrackingMouseMoved if the mouse is moved while no
  126. * button is pressed, and TrackMouseRegion returns
  127. * kMouseTrackingMouseEntered/Exited if the mouse moves into or out
  128. * of the specified region while no button is pressed.
  129. *
  130. * Parameters:
  131. *
  132. * inPort:
  133. * The grafport to consider for mouse coordinates. You can pass
  134. * NULL for this parameter to indicate the current port. The mouse
  135. * location is returned in terms of local coordinates of this
  136. * port. You can pass -1 for this parameter to indicate that the
  137. * mouse location should be returned in global coordinates instead
  138. * of local coordinates.
  139. *
  140. * outPt:
  141. * On exit, this parameter receives the mouse location from the
  142. * last mouse event that caused this function to exit.
  143. *
  144. * outResult:
  145. * On exit, this parameter receives a value representing what kind
  146. * of event was received that cause the function to exit, such as
  147. * kMouseTrackingMouseUp.
  148. *
  149. * Result:
  150. * An operating system result code.
  151. *
  152. * Availability:
  153. * Non-Carbon CFM: not available
  154. * CarbonLib: in CarbonLib 1.1 and later
  155. * Mac OS X: in version 10.0 and later
  156. */
  157. EXTERN_API( OSStatus )
  158. TrackMouseLocation(
  159. GrafPtr inPort, /* can be NULL */
  160. Point * outPt,
  161. MouseTrackingResult * outResult);
  162. /*
  163. * TrackMouseLocationWithOptions()
  164. *
  165. * Discussion:
  166. * This routine is largely identical to TrackMouseLocation. Please
  167. * read the notes on that function as well.
  168. * TrackMouseLocationWithOptions supports additional parameters for
  169. * leaving mouse-up events in the event queue, specifying a timeout,
  170. * and retrieving the current mouse position and keyboard modifiers.
  171. *
  172. * Parameters:
  173. *
  174. * inPort:
  175. * The grafport to consider for mouse coordinates. You can pass
  176. * NULL for this parameter to indicate the current port. The mouse
  177. * location is returned in terms of local coordinates of this
  178. * port. You can pass -1 for this parameter to indicate that the
  179. * mouse location should be returned in global coordinates instead
  180. * of local coordinates.
  181. *
  182. * inOptions:
  183. * The only option supported by this routine at present is
  184. * kTrackMouseLocationOptionDontConsumeMouseUp, which indicates
  185. * that the toolbox should leave mouse-up events in the queue. You
  186. * may also pass zero for this parameter to get the default
  187. * behavior, which is to remove mouse-up events from the queue
  188. * before returning.
  189. *
  190. * inTimeout:
  191. * The amount of time to wait for an event. If no events arrive
  192. * within this time, kMouseTrackingTimedOut is returned in
  193. * outResult.
  194. *
  195. * outPt:
  196. * On exit, this parameter receives the mouse location from the
  197. * last mouse event that caused this function to exit. If a
  198. * timeout or key modifiers changed event caused this function to
  199. * exit, the current mouse position at the time is returned.
  200. *
  201. * outModifiers:
  202. * On exit, this parameter receives the most recent state of the
  203. * keyboard modifiers. If a timeout caused this function to exit,
  204. * the current keyboard modifiers at the time are returned.
  205. *
  206. * outResult:
  207. * On exit, this parameter receives a value representing what kind
  208. * of event was received that cause the function to exit, such as
  209. * kMouseTrackingMouseUp.
  210. *
  211. * Result:
  212. * An operating system result code.
  213. *
  214. * Availability:
  215. * Non-Carbon CFM: not available
  216. * CarbonLib: in CarbonLib 1.3 and later
  217. * Mac OS X: in version 10.0 and later
  218. */
  219. EXTERN_API_C( OSStatus )
  220. TrackMouseLocationWithOptions(
  221. GrafPtr inPort, /* can be NULL */
  222. OptionBits inOptions,
  223. EventTimeout inTimeout,
  224. Point * outPt,
  225. UInt32 * outModifiers, /* can be NULL */
  226. MouseTrackingResult * outResult);
  227. /*
  228. * TrackMouseRegion()
  229. *
  230. * Discussion:
  231. * This routine is largely identical to TrackMouseLocation. Please
  232. * read the notes on that function as well. TrackMouseRegion differs
  233. * from TrackMouseLocation by only returning when the mouse enters
  234. * or exits a specified region that you pass in to the function, as
  235. * opposed to whenever the mouse moves (it also returns for mouse
  236. * up/down events). This is useful if you don't need to know
  237. * intermediate mouse events, but rather just if the mouse enters or
  238. * leaves an area.
  239. *
  240. * Parameters:
  241. *
  242. * inPort:
  243. * The grafport to consider for mouse coordinates. You can pass
  244. * NULL for this parameter to indicate the current port. You can
  245. * pass -1 for this parameter to indicate that the mouse region
  246. * should be interpreted in global coordinates instead of local
  247. * coordinates.
  248. *
  249. * inRegion:
  250. * The region to consider. This should be in the coordinates of
  251. * the port you passed to inPort, or global coordinates if you
  252. * passed -1 for the inPort parameter.
  253. *
  254. * ioWasInRgn:
  255. * On entry, this parameter should be set to true if the mouse is
  256. * currently inside the region passed in inRegion, or false if the
  257. * mouse is currently outside the region. On exit, this parameter
  258. * is updated to reflect the current reality; e.g. if the
  259. * outResult parameter returns kMouseTrackingMouseExited,
  260. * ioWasInRgn will be set to false when this function exits.
  261. * Because it is updated from within, you should only need to set
  262. * this yourself before the first call to this function in your
  263. * tracking loop.
  264. *
  265. * outResult:
  266. * On exit, this parameter receives a value representing what kind
  267. * of event was received that cause the function to exit, such as
  268. * kMouseTrackingMouseEntered.
  269. *
  270. * Result:
  271. * An operating system result code.
  272. *
  273. * Availability:
  274. * Non-Carbon CFM: not available
  275. * CarbonLib: in CarbonLib 1.1 and later
  276. * Mac OS X: in version 10.0 and later
  277. */
  278. EXTERN_API( OSStatus )
  279. TrackMouseRegion(
  280. GrafPtr inPort, /* can be NULL */
  281. RgnHandle inRegion,
  282. Boolean * ioWasInRgn,
  283. MouseTrackingResult * outResult);
  284. /*
  285. * ConvertEventRefToEventRecord()
  286. *
  287. * Discussion:
  288. * This is a convenience routine to help you if there are places in
  289. * your application where you need an EventRecord and all you have
  290. * is an EventRef. If the event can be converted, outEvent is filled
  291. * in and the function returns true. If not, false is returned and
  292. * outEvent will contain a nullEvent.
  293. *
  294. * Parameters:
  295. *
  296. * inEvent:
  297. * The EventRef to convert into an EventRecord.
  298. *
  299. * outEvent:
  300. * The EventRecord to fill out.
  301. *
  302. * Result:
  303. * A boolean indicating if the conversion was successful (true) or
  304. * not (false).
  305. *
  306. * Availability:
  307. * Non-Carbon CFM: not available
  308. * CarbonLib: in CarbonLib 1.1 and later
  309. * Mac OS X: in version 10.0 and later
  310. */
  311. EXTERN_API( Boolean )
  312. ConvertEventRefToEventRecord(
  313. EventRef inEvent,
  314. EventRecord * outEvent);
  315. /*
  316. * IsEventInMask()
  317. *
  318. * Discussion:
  319. * This is a companion function for ConvertEventRefToEventRecord,
  320. * and is provided as a convenience routine to help you if there are
  321. * places in your application where you want to check an EventRef to
  322. * see if it matches a classic EventMask bitfield. If the event
  323. * matches, the function returns true.
  324. *
  325. * Parameters:
  326. *
  327. * inEvent:
  328. * The EventRef to convert into an EventRecord.
  329. *
  330. * inMask:
  331. * The mask to consider.
  332. *
  333. * Result:
  334. * A boolean indicating if the event was considered to be in the
  335. * mask provided.
  336. *
  337. * Availability:
  338. * Non-Carbon CFM: not available
  339. * CarbonLib: in CarbonLib 1.1 and later
  340. * Mac OS X: in version 10.0 and later
  341. */
  342. EXTERN_API( Boolean )
  343. IsEventInMask(
  344. EventRef inEvent,
  345. EventMask inMask);
  346. /*
  347. * GetLastUserEventTime()
  348. *
  349. * Availability:
  350. * Non-Carbon CFM: not available
  351. * CarbonLib: in CarbonLib 1.1 and later
  352. * Mac OS X: in version 10.0 and later
  353. */
  354. EXTERN_API( EventTime )
  355. GetLastUserEventTime(void);
  356. /*--------------------------------------------------------------------------------------*/
  357. /* o Mouse Coalescing */
  358. /*--------------------------------------------------------------------------------------*/
  359. /*
  360. * IsMouseCoalescingEnabled()
  361. *
  362. * Discussion:
  363. * Returns true if mouse coalescing is current enabled. When
  364. * enabled, we coalesce mouse moved and mouse dragged events. By
  365. * default, coalescing is on, but you can use
  366. * SetMouseCoalescingEnabled to disable it if you want finer-grained
  367. * mouse movement events, which is useful for drawing with tablets.
  368. *
  369. * Result:
  370. * A boolean indicating if coalescing is enabled.
  371. *
  372. * Availability:
  373. * Non-Carbon CFM: not available
  374. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
  375. * Mac OS X: in version 10.1 and later
  376. */
  377. EXTERN_API_C( Boolean )
  378. IsMouseCoalescingEnabled(void);
  379. /*
  380. * SetMouseCoalescingEnabled()
  381. *
  382. * Discussion:
  383. * Allows you to set mouse move/drag event coalescing on or off. By
  384. * default, coalescing is on, but you can use this function to
  385. * disable it if you want finer-grained mouse movement events, which
  386. * is useful for drawing with tablets.
  387. *
  388. * Parameters:
  389. *
  390. * inNewState:
  391. * A boolean indicating if coalescing should be enabled (true) or
  392. * disabled (false).
  393. *
  394. * outOldState:
  395. * A boolean which receives the prior state of mouse coalescing
  396. * for restoration later. You can pass NULL for this parameter if
  397. * you don't care.
  398. *
  399. * Result:
  400. * An operating system status result.
  401. *
  402. * Availability:
  403. * Non-Carbon CFM: not available
  404. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
  405. * Mac OS X: in version 10.1 and later
  406. */
  407. EXTERN_API_C( OSStatus )
  408. SetMouseCoalescingEnabled(
  409. Boolean inNewState,
  410. Boolean * outOldState); /* can be NULL */
  411. /*======================================================================================*/
  412. /* EVENT CLASSES */
  413. /*======================================================================================*/
  414. /*
  415. * Discussion:
  416. * Event classes
  417. */
  418. enum {
  419. /*
  420. * Events related to the mouse (mouse down/up/moved).
  421. */
  422. kEventClassMouse = FOUR_CHAR_CODE('mous'),
  423. /*
  424. * Events related to the keyboard.
  425. */
  426. kEventClassKeyboard = FOUR_CHAR_CODE('keyb'),
  427. /*
  428. * Events related to text input (by keyboard, or by input method).
  429. */
  430. kEventClassTextInput = FOUR_CHAR_CODE('text'),
  431. /*
  432. * Application-level events (launch, quit, etc.).
  433. */
  434. kEventClassApplication = FOUR_CHAR_CODE('appl'),
  435. /*
  436. * Apple Events.
  437. */
  438. kEventClassAppleEvent = FOUR_CHAR_CODE('eppc'),
  439. /*
  440. * Menu-related events.
  441. */
  442. kEventClassMenu = FOUR_CHAR_CODE('menu'),
  443. /*
  444. * Window-related events.
  445. */
  446. kEventClassWindow = FOUR_CHAR_CODE('wind'),
  447. /*
  448. * Control-related events.
  449. */
  450. kEventClassControl = FOUR_CHAR_CODE('cntl'),
  451. /*
  452. * Command events (HICommands).
  453. */
  454. kEventClassCommand = FOUR_CHAR_CODE('cmds'),
  455. /*
  456. * Events related to tablets.
  457. */
  458. kEventClassTablet = FOUR_CHAR_CODE('tblt'),
  459. /*
  460. * Events related to File Manager volumes.
  461. */
  462. kEventClassVolume = FOUR_CHAR_CODE('vol '),
  463. /*
  464. * Events related to the Appearance Manager.
  465. */
  466. kEventClassAppearance = FOUR_CHAR_CODE('appm'),
  467. /*
  468. * Events related to the Services Manager.
  469. */
  470. kEventClassService = FOUR_CHAR_CODE('serv'),
  471. /*
  472. * Events related to toolbars.
  473. */
  474. kEventClassToolbar = FOUR_CHAR_CODE('tbar'),
  475. /*
  476. * Events related to toolbar items.
  477. */
  478. kEventClassToolbarItem = FOUR_CHAR_CODE('tbit'),
  479. /*
  480. * Events related application accessibility.
  481. */
  482. kEventClassAccessibility = FOUR_CHAR_CODE('acce')
  483. };
  484. /*--------------------------------------------------------------------------------------*/
  485. /* Mouse Events */
  486. /*--------------------------------------------------------------------------------------*/
  487. /* Mouse Events */
  488. /*
  489. * Discussion:
  490. * Mouse events (kEventClassMouse)
  491. */
  492. enum {
  493. /*
  494. * A mouse button was pressed.
  495. */
  496. kEventMouseDown = 1,
  497. /*
  498. * A mouse button was released.
  499. */
  500. kEventMouseUp = 2,
  501. /*
  502. * The mouse was moved.
  503. */
  504. kEventMouseMoved = 5,
  505. /*
  506. * The mouse was moved, and a button was down.
  507. */
  508. kEventMouseDragged = 6,
  509. /*
  510. * The mouse entered a tracking area.
  511. */
  512. kEventMouseEntered = 8,
  513. /*
  514. * The mouse exited a tracking area.
  515. */
  516. kEventMouseExited = 9,
  517. /*
  518. * The mouse wheel was moved. (Mac OS X only)
  519. */
  520. kEventMouseWheelMoved = 10
  521. };
  522. /*
  523. Parameters for mouse events:
  524. // NOTE: As of Mac OS X 10.1, mouse events carry more information which allow you
  525. // to do less work and gain accuracy of hit testing. First, there is the
  526. // kEventParamWindowRef parameter. This parameter tells you what window the
  527. // mouse click/move/etc occurred over. In mouse dragged events, this is the
  528. // window the mouse went down in, NOT the window the mouse is currently over.
  529. // Next, there is the kEventParamWindowMouseLocation parameter. This is the
  530. // window-relative position of the mouse in the window given in the
  531. // kEventParamWindowRef parameter. 0, 0 is at the top left of the structure
  532. // of the window.
  533. kEventMouseDown
  534. --> kEventParamMouseLocation typeHIPoint
  535. --> kEventParamWindowRef typeWindowRef (Mac OS X 10.1 or later)
  536. --> kEventParamWindowMouseLocation typeHIPoint (Mac OS X 10.1 or later)
  537. --> kEventParamKeyModifiers typeUInt32
  538. --> kEventParamMouseButton typeMouseButton
  539. --> kEventParamClickCount typeUInt32
  540. --> kEventParamMouseChord typeUInt32 (Mac OS X only)
  541. --> kEventParamTabletEventType typeUInt32 (Mac OS X 10.1, CarbonLib 1.5, and later)
  542. --> kEventParamTabletPointRec typeTabletPointRec (if kEventParamTabletEventType is kEventTabletPoint)
  543. --> kEventParamTabletProximityRec typeTabletProximityRec (if kEventParamTabletEventType is kEventTabletProximity)
  544. kEventMouseUp
  545. --> kEventParamMouseLocation typeHIPoint
  546. --> kEventParamWindowRef typeWindowRef (Mac OS X 10.1 or later)
  547. --> kEventParamWindowMouseLocation typeHIPoint (Mac OS X 10.1 or later)
  548. --> kEventParamKeyModifiers typeUInt32
  549. --> kEventParamMouseButton typeMouseButton
  550. --> kEventParamClickCount typeUInt32
  551. --> kEventParamMouseChord typeUInt32 (Mac OS X only)
  552. --> kEventParamTabletEventType typeUInt32 (Mac OS X 10.1, CarbonLib 1.5, and later)
  553. --> kEventParamTabletPointRec typeTabletPointRec (if kEventParamTabletEventType is kEventTabletPoint)
  554. --> kEventParamTabletProximityRec typeTabletProximityRec (if kEventParamTabletEventType is kEventTabletProximity)
  555. kEventMouseMoved
  556. --> kEventParamMouseLocation typeHIPoint
  557. --> kEventParamWindowRef typeWindowRef (Mac OS X 10.1 or later)
  558. --> kEventParamWindowMouseLocation typeHIPoint (Mac OS X 10.1 or later)
  559. --> kEventParamMouseDelta typeHIPoint (Mac OS X only)
  560. --> kEventParamKeyModifiers typeUInt32
  561. --> kEventParamTabletEventType typeUInt32 (Mac OS X 10.1, CarbonLib 1.5, and later)
  562. --> kEventParamTabletPointRec typeTabletPointRec (if kEventParamTabletEventType is kEventTabletPoint)
  563. --> kEventParamTabletProximityRec typeTabletProximityRec (if kEventParamTabletEventType is kEventTabletProximity)
  564. kEventMouseDragged
  565. --> kEventParamMouseLocation typeHIPoint
  566. --> kEventParamWindowRef typeWindowRef (Mac OS X 10.1 or later)
  567. --> kEventParamWindowMouseLocation typeHIPoint (Mac OS X 10.1 or later)
  568. --> kEventParamMouseDelta typeHIPoint (Mac OS X only)
  569. --> kEventParamKeyModifiers typeUInt32
  570. --> kEventParamMouseButton typeMouseButton
  571. --> kEventParamMouseChord typeUInt32 (Mac OS X only)
  572. --> kEventParamTabletEventType typeUInt32 (Mac OS X 10.1, CarbonLib 1.5, and later)
  573. --> kEventParamTabletPointRec typeTabletPointRec (if kEventParamTabletEventType is kEventTabletPoint)
  574. --> kEventParamTabletProximityRec typeTabletProximityRec (if kEventParamTabletEventType is kEventTabletProximity)
  575. kEventMouseEntered
  576. --> kEventParamMouseTrackingRef typeMouseTrackingRef
  577. --> kEventParamWindowRef typeWindowRef
  578. --> kEventParamMouseLocation typeHIPoint
  579. --> kEventParamWindowMouseLocation typeHIPoint
  580. --> kEventParamKeyModifiers typeUInt32
  581. kEventMouseExited
  582. --> kEventParamMouseTrackingRef typeMouseTrackingRef
  583. --> kEventParamWindowRef typeWindowRef
  584. --> kEventParamMouseLocation typeHIPoint
  585. --> kEventParamWindowMouseLocation typeHIPoint
  586. --> kEventParamKeyModifiers typeUInt32
  587. kEventMouseWheelMoved
  588. --> kEventParamMouseLocation typeHIPoint
  589. --> kEventParamWindowRef typeWindowRef (Mac OS X 10.1 or later)
  590. --> kEventParamWindowMouseLocation typeHIPoint (Mac OS X 10.1 or later)
  591. --> kEventParamKeyModifiers typeUInt32
  592. --> kEventParamMouseWheelAxis typeMouseWheelAxis
  593. --> kEventParamMouseWheelDelta typeLongInteger
  594. */
  595. /*
  596. * EventMouseButton
  597. *
  598. */
  599. typedef UInt16 EventMouseButton;
  600. enum {
  601. /*
  602. * Only button for a one-button mouse (usually left button for
  603. * multi-button mouse)
  604. */
  605. kEventMouseButtonPrimary = 1,
  606. /*
  607. * Usually right button for a multi-button mouse
  608. */
  609. kEventMouseButtonSecondary = 2,
  610. /*
  611. * Usually middle button for a three-button mouse
  612. */
  613. kEventMouseButtonTertiary = 3
  614. };
  615. /*
  616. * EventMouseWheelAxis
  617. *
  618. */
  619. typedef UInt16 EventMouseWheelAxis;
  620. enum {
  621. /*
  622. * The X axis (left or right)
  623. */
  624. kEventMouseWheelAxisX = 0,
  625. /*
  626. * The Y axis (up or down)
  627. */
  628. kEventMouseWheelAxisY = 1
  629. };
  630. /*--------------------------------------------------------------------------------------*/
  631. /* Text Input Events */
  632. /*--------------------------------------------------------------------------------------*/
  633. /*
  634. * Summary:
  635. * Text input events (kEventClassTextInput)
  636. *
  637. * Discussion:
  638. * The following TextInput events reimplement the AppleEvents
  639. * defined in Inside Mac Text - Text Services Manager, and provide
  640. * the benefits of Carbon Event targeting, dispatching and
  641. * propagation to applications that have formerly handled the TSM
  642. * suite of AppleEvents. TextInput handlers may be installed on
  643. * controls, windows, or the application event target (equivalent to
  644. * AppleEvent-based handling). In all cases, if a given TextInput
  645. * handler is not installed, TSM will convert that TextInput to an
  646. * AppleEvent and redispatch via AESend to the current process,
  647. * making adoption as gradual as is desired.
  648. */
  649. enum {
  650. /*
  651. * Tells the application/text engine to initiate/terminate or manage
  652. * the content of inline input session.
  653. */
  654. kEventTextInputUpdateActiveInputArea = 1,
  655. /*
  656. * Unicode text resulting from a key event originated by TSM (not by
  657. * an input method). A client need not be fully TSM-aware to process
  658. * or receive this event, which has become the standard way of
  659. * getting Unicode text from key events. You can also get Mac
  660. * encoding characters from the raw keyboard event contained in this
  661. * event. If no UnicodeForKeyEvent handler is installed, and no
  662. * kUnicodeNotFromInputMethod AppleEvent handler is installed (or the
  663. * application has not created a Unicode TSMDocument), the Mac
  664. * encoding charCodes (if these can be converted from the Unicodes)
  665. * are provided to WaitNextEvent.
  666. */
  667. kEventTextInputUnicodeForKeyEvent = 2,
  668. /*
  669. * Convert from inline session text offset to global QD Point. This
  670. * event is typically be produced by an Input Method so that it can
  671. * best position a palette "near" the text being operated on by the
  672. * user.
  673. */
  674. kEventTextInputOffsetToPos = 3,
  675. /*
  676. * Convert from global QD point to inline session text offset. This
  677. * event is typically produced by an input method to perform proper
  678. * cursor management as the cursor moves over various subranges, or
  679. * clauses of text (or the boundaries between these) in the inline
  680. * input session.
  681. */
  682. kEventTextInputPosToOffset = 4,
  683. /*
  684. * Show/Hide the bottom line input window. This event is produced by
  685. * Input Methods to control the Text Services Manager bottom-line
  686. * input window, and is not normally handled by an application.
  687. */
  688. kEventTextInputShowHideBottomWindow = 5,
  689. /*
  690. * Get the text selected (or character before/after insertion point
  691. * based on leadingEdge parameter) from the application's text engine.
  692. */
  693. kEventTextInputGetSelectedText = 6,
  694. kEventTextInputUnicodeText = 7
  695. };
  696. /*
  697. Parameters for TextInput events:
  698. kEventTextInputUpdateActiveInputArea
  699. Required parameters:
  700. --> kEventParamTextInputSendComponentInstance typeComponentInstance
  701. --> kEventParamTextInputSendRefCon typeLongInteger
  702. --> kEventParamTextInputSendSLRec typeIntlWritingCode
  703. --> kEventParamTextInputSendFixLen typeLongInteger
  704. --> kEventParamTextInputSendText typeUnicodeText, typeChar
  705. (data type depends on TSMDocument type created via NewTSMDocument...
  706. typeChar for kTextService document, typeUnicodeText for kUnicodeDocument)
  707. Optional parameters:
  708. --> kEventParamTextInputSendUpdateRng typeTextRangeArray
  709. --> kEventParamTextInputSendHiliteRng typeTextRangeArray
  710. --> kEventParamTextInputSendClauseRng typeOffsetArray
  711. --> kEventParamTextInputSendPinRng typeTextRange
  712. --> kEventParamTextInputSendPinRng typeTextRange
  713. --> kEventParamTextInputSendTextServiceEncoding typeUInt32
  714. --> kEventParamTextInputSendTextServiceMacEncoding typeUInt32
  715. --> kEventParamTextInputGlyphInfoArray typeGlyphInfoArray
  716. kEventTextInputUnicodeForKeyEvent
  717. Required parameters:
  718. --> kEventParamTextInputSendComponentInstance typeComponentInstance
  719. --> kEventParamTextInputSendRefCon typeLongInteger
  720. --> kEventParamTextInputSendSLRec typeIntlWritingCode
  721. --> kEventParamTextInputSendText typeUnicodeText
  722. --> kEventParamTextInputSendKeyboardEvent typeEventRef
  723. (This parameter is the original raw keyboard event that produced the
  724. text. It enables access to kEventParamKeyModifiers and
  725. kEventParamKeyCode parameters.
  726. You can also extract from this event either Unicodes or Mac encoding
  727. characters as follows:
  728. kEventParamKeyUnicodes typeUnicodeText
  729. kEventParamKeyMacCharCodes typeChar (if available)
  730. The kEventParamKeyUnicodes parameter of the raw keyboard event is
  731. identical to the TextInput event's kEventParamTextInputSendText
  732. parameter. Note that when contents of TSM's bottom-line input
  733. window (i.e. during typing Chinese, Korean, or Japanese) are confirmed,
  734. the raw keyboard event's keyCode and modifiers are set to default values.)
  735. --> kEventParamTextInputGlyphInfoArray typeGlyphInfoArray
  736. kEventTextInputOffsetToPos
  737. Required parameters:
  738. --> kEventParamTextInputSendComponentInstance typeComponentInstance
  739. --> kEventParamTextInputSendRefCon typeLongInteger
  740. --> kEventParamTextInputSendTextOffset typeLongInteger
  741. <-- kEventParamTextInputReplyPoint typeQDPoint
  742. Optional parameters:
  743. --> kEventParamTextInputSendSLRec typeIntlWritingCode
  744. --> kEventParamTextInputSendLeadingEdge typeBoolean
  745. <-- kEventParamTextInputReplySLRec typeIntlWritingCode
  746. <-- kEventParamTextInputReplyFont typeLongInteger
  747. <-- kEventParamTextInputReplyFMFont typeUInt32
  748. <-- kEventParamTextInputReplyPointSize typeFixed
  749. <-- kEventParamTextInputReplyLineHeight typeShortInteger
  750. <-- kEventParamTextInputReplyLineAscent typeShortInteger
  751. <-- kEventParamTextInputReplyTextAngle typeFixed
  752. kEventTextInputPosToOffset
  753. Required parameters:
  754. --> kEventParamTextInputSendComponentInstance typeComponentInstance
  755. --> kEventParamTextInputSendRefCon typeLongInteger
  756. --> kEventParamTextInputSendCurrentPoint typeQDPoint
  757. <-- kEventParamTextInputReplyRegionClass typeLongInteger
  758. <-- kEventParamTextInputReplyTextOffset typeLongInteger
  759. (required if the position is inside the document's body)
  760. Optional parameters:
  761. --> kEventParamTextInputSendDraggingMode typeBoolean
  762. <-- kEventParamTextInputReplyLeadingEdge typeBoolean
  763. <-- kEventParamTextInputReplySLRec typeIntlWritingCode
  764. kEventTextInputShowHideBottomWindow
  765. Required parameters:
  766. --> kEventParamTextInputSendComponentInstance typeComponentInstance
  767. --> kEventParamTextInputSendRefCon typeLongInteger
  768. Optional parameters:
  769. --> kEventParamTextInputSendShowHide typeBoolean
  770. <-- kEventParamTextInputReplyShowHide typeBoolean
  771. kEventTextInputGetSelectedText
  772. Required parameters:
  773. --> kEventParamTextInputSendComponentInstance typeComponentInstance
  774. --> kEventParamTextInputSendRefCon typeLongInteger
  775. Optional parameters:
  776. --> kEventParamTextInputSendLeadingEdge typeBoolean
  777. --> kEventParamTextInputSendTextServiceEncoding typeUInt32
  778. --> kEventParamTextInputSendTextServiceMacEncoding typeUInt32
  779. <-- kEventParamTextInputReplyText typeUnicodeText, typeChar
  780. (data type depends on TSMDocument. See kEventTextInputUpdateActiveInputArea Notes)
  781. <-- kEventParamTextInputReplySLRec typeIntlWritingCode
  782. <-- kEventParamTextInputGlyphInfoArray typeGlyphInfoArray
  783. kEventTextInputUnicodeText
  784. Required parameters:
  785. --> kEventParamTextInputSendComponentInstance typeComponentInstance
  786. --> kEventParamTextInputSendSLRec typeIntlWritingCode
  787. --> kEventParamTextInputSendText typeUnicodeText
  788. Optional parameters:
  789. --> kEventParamTextInputSendTextServiceEncoding typeUInt32
  790. --> kEventParamTextInputSendTextServiceMacEncoding typeUInt32
  791. --> kEventParamTextInputGlyphInfoArray typeGlyphInfoArray
  792. */
  793. /*--------------------------------------------------------------------------------------*/
  794. /* Raw Keyboard Events */
  795. /*--------------------------------------------------------------------------------------*/
  796. /*
  797. * Summary:
  798. * Keyboard events (kEventClassKeyboard)
  799. *
  800. * Discussion:
  801. * These events are the lowest-level keyboard events.
  802. */
  803. enum {
  804. /*
  805. * A key was pressed.
  806. */
  807. kEventRawKeyDown = 1, /* hardware-level events*/
  808. /*
  809. * Sent periodically as a key is held down by the user.
  810. */
  811. kEventRawKeyRepeat = 2,
  812. /*
  813. * A key was released.
  814. */
  815. kEventRawKeyUp = 3,
  816. /*
  817. * The keyboard modifiers (bucky bits) have changed.
  818. */
  819. kEventRawKeyModifiersChanged = 4,
  820. /*
  821. * A registered Hot Key was pressed.
  822. */
  823. kEventHotKeyPressed = 5,
  824. /*
  825. * A registered Hot Key was released (this is only sent on Mac OS X).
  826. */
  827. kEventHotKeyReleased = 6 /* Mac OS X only*/
  828. };
  829. /*
  830. * Summary:
  831. * Key modifier change event bits and masks
  832. *
  833. * Discussion:
  834. * From bit 8, cmdKeyBit, to bit 15, rightControlKeyBit, are
  835. * compatible with Event Manager modifiers.
  836. */
  837. enum {
  838. /*
  839. * The Num Lock state bit (Mac OS X only).
  840. */
  841. kEventKeyModifierNumLockBit = 16, /* Num Lock is on? (Mac OS X only)*/
  842. /*
  843. * The Fn key state bit (Mac OS X only).
  844. */
  845. kEventKeyModifierFnBit = 17 /* Fn key is down? (Mac OS X only)*/
  846. };
  847. enum {
  848. kEventKeyModifierNumLockMask = 1L << kEventKeyModifierNumLockBit,
  849. kEventKeyModifierFnMask = 1L << kEventKeyModifierFnBit
  850. };
  851. /*
  852. Parameters for keyboard events:
  853. kEventRawKeyDown
  854. --> kEventParamKeyMacCharCodes typeChar
  855. --> kEventParamKeyCode typeUInt32
  856. --> kEventParamKeyModifiers typeUInt32
  857. --> kEventParamKeyboardType typeUInt32
  858. kEventRawKeyRepeat
  859. --> kEventParamKeyMacCharCodes typeChar
  860. --> kEventParamKeyCode typeUInt32
  861. --> kEventParamKeyModifiers typeUInt32
  862. --> kEventParamKeyboardType typeUInt32
  863. kEventRawKeyUp
  864. --> kEventParamKeyMacCharCodes typeChar
  865. --> kEventParamKeyCode typeUInt32
  866. --> kEventParamKeyModifiers typeUInt32
  867. --> kEventParamKeyboardType typeUInt32
  868. kEventRawKeyModifiersChanged
  869. --> kEventParamKeyModifiers typeUInt32
  870. kEventHotKeyPressed
  871. --> kEventParamDirectObject typeEventHotKeyID
  872. kEventHotKeyReleased
  873. --> kEventParamDirectObject typeEventHotKeyID
  874. */
  875. /*--------------------------------------------------------------------------------------*/
  876. /* Application Events */
  877. /*--------------------------------------------------------------------------------------*/
  878. /*
  879. * Summary:
  880. * Application events (kEventClassApplication)
  881. */
  882. enum {
  883. /*
  884. * The current app has been activated (resume event). May optionally
  885. * contain a kEventParamWindowRef parameter if a click on an
  886. * application window was the cause of the app activation.
  887. */
  888. kEventAppActivated = 1,
  889. /*
  890. * The current app has just been deactivated (suspend event).
  891. */
  892. kEventAppDeactivated = 2,
  893. /*
  894. * Request to quit. Sent by QuitApplicationEventLoop to the
  895. * application target. In response, the event handler installed by
  896. * RunApplicationEventLoop will cause RunApplicationEventLoop to
  897. * exit. Most applications will not need to handle this event;
  898. * instead, an application should install an AppleEvent handler for
  899. * the kAEQuitApplication event handler if it needs to check for
  900. * unsaved documents or do other cleanup before quitting.
  901. */
  902. kEventAppQuit = 3,
  903. /*
  904. * An async launch request response. This event is received when you
  905. * use LaunchServices to launch a process asynchronously. It is only
  906. * received on Mac OS X.
  907. */
  908. kEventAppLaunchNotification = 4,
  909. /*
  910. * Another app was launched. Available on Mac OS X and CarbonLib
  911. * 1.3.1 and later.
  912. */
  913. kEventAppLaunched = 5,
  914. /*
  915. * Another app terminated. Available on Mac OS X and CarbonLib 1.3.1
  916. * and later.
  917. */
  918. kEventAppTerminated = 6,
  919. /*
  920. * The front (active) application has changed. Available on Mac OS X
  921. * and CarbonLib 1.3.1 and later.
  922. */
  923. kEventAppFrontSwitched = 7,
  924. /*
  925. * The user has requested keyboard focus on the menubar. This event
  926. * is handled automatically by the default application event handler
  927. * installed by the Carbon Event Manager. Sent on Mac OS X 10.2 and
  928. * later.
  929. */
  930. kEventAppFocusMenuBar = 8,
  931. /*
  932. * The user has requested keyboard focus on a document window. The
  933. * application should cycle to the next (or previous, if the shift
  934. * key is down) document window, or if there are no more windows to
  935. * activate in the application's window list, to the next or previous
  936. * document window in the next or previous process. User focus (see
  937. * SetUserFocusWindow) should be applied to the new front document
  938. * window. If something other than a document window has the focus at
  939. * the time you receive this event, the frontmost document window
  940. * should be given the user focus instead, and no z-order change
  941. * should be made. Additionally, the keyboard focus should be moved
  942. * to the main control in the newly focused window if no keyboard
  943. * focus exists within the window. This event is handled
  944. * automatically by the default application event handler installed
  945. * by the Carbon Event Manager. An application which chooses to
  946. * handle this event should never override it entirely; if necessary,
  947. * it should only check if the user focus is somewhere other than a
  948. * document window, and if so, set the focus on the active document
  949. * window. If the focus is already on a document window, a handler
  950. * for this event should always return eventNotHandledErr so that the
  951. * default handler can rotate to the next window across all
  952. * processes. Sent on Mac OS X 10.2 and later.
  953. */
  954. kEventAppFocusNextDocumentWindow = 9,
  955. /*
  956. * The application should cycle to the next (or previous, if the
  957. * shift key is down) floating window in the application. User focus
  958. * (see SetUserFocusWindow) should be applied to the new front
  959. * floating window. If something other than a floating window has the
  960. * focus at the time you receive this event, the frontmost floating
  961. * window should be given the user focus instead, and no z-order
  962. * change should be made. Additionally, the keyboard focus should be
  963. * moved to the main control in the newly focused window if no
  964. * keyboard focus exists within the window. This event is handled
  965. * automatically by the default application event handler installed
  966. * by the Carbon Event Manager. The default handler sends a
  967. * kEventCommandProcess event containing
  968. * kHICommandRotateFloatingWindowsForward/Backward when it detects
  969. * that floating windows should be cycled. Sent on Mac OS X 10.2 and
  970. * later.
  971. */
  972. kEventAppFocusNextFloatingWindow = 10,
  973. /*
  974. * The application should put focus on the first control in the
  975. * toolbar in the focused window, if a toolbar is present. For
  976. * windows that use the standard Toolbar control, this event is
  977. * handled automatically by the default application event handler
  978. * installed by the Carbon Event Manager. Sent on Mac OS X 10.2 and
  979. * later.
  980. */
  981. kEventAppFocusToolbar = 11,
  982. /*
  983. * A request for a menu to be displayed by the application's dock
  984. * tile. The default handler will return the menu, if any, that was
  985. * provided by the SetApplicationDockTileMenu API. The sender of this
  986. * event will release the menu after the Dock has displayed it, so if
  987. * you return a permanently allocated MenuRef, you should call
  988. * RetainMenu on it before returning from your event handler. For
  989. * most applications, it will be easier to use the
  990. * SetApplicationDockTileMenu API directly rather than installing a
  991. * handler for this event. Available in Mac OS X 10.1 and later.
  992. */
  993. kEventAppGetDockTileMenu = 20,
  994. /*
  995. * The application was just hidden. Sent on Mac OS X 10.2 and later.
  996. */
  997. kEventAppHidden = 107,
  998. /*
  999. * The application was just shown. It was previously hidden. Sent on
  1000. * Mac OS X 10.2 and later.
  1001. */
  1002. kEventAppShown = 108,
  1003. /*
  1004. * The system UI mode of the frontmost application has changed. Sent
  1005. * on Mac OS X 10.2 and later.
  1006. */
  1007. kEventAppSystemUIModeChanged = 109
  1008. };
  1009. /*
  1010. Parameters for application events:
  1011. kEventAppActivated
  1012. --> kEventParamWindowRef typeWindowRef
  1013. kEventAppDeactivated
  1014. (no parameters)
  1015. kEventAppQuit
  1016. (no parameters)
  1017. kEventAppLaunchNotification
  1018. --> kEventParamProcessID typeProcessSerialNumber
  1019. --> kEventParamLaunchRefCon typeUInt32
  1020. --> kEventParamLaunchErr typeOSStatus
  1021. kEventAppLaunched
  1022. --> kEventParamProcessID typeProcessSerialNumber
  1023. kEventAppTerminated
  1024. --> kEventParamProcessID typeProcessSerialNumber
  1025. kEventAppFrontSwitched
  1026. --> kEventParamProcessID typeProcessSerialNumber
  1027. kEventAppFocusMenuBar
  1028. --> kEventParamKeyModifiers typeUInt32
  1029. kEventAppFocusNextDocumentWindow
  1030. --> kEventParamKeyModifiers typeUInt32
  1031. kEventAppFocusNextFloatingWindow
  1032. --> kEventParamKeyModifiers typeUInt32
  1033. kEventAppFocusToolbar
  1034. --> kEventParamKeyModifiers typeUInt32
  1035. kEventAppGetDockTileMenu
  1036. <-- kEventParamMenuRef typeMenuRef
  1037. kEventAppHidden
  1038. (no parameters)
  1039. kEventAppShown
  1040. (no parameters)
  1041. kEventAppSystemUIModeChanged
  1042. --> kEventParamSystemUIMode typeUInt32
  1043. */
  1044. /*--------------------------------------------------------------------------------------*/
  1045. /* Apple Events */
  1046. /*--------------------------------------------------------------------------------------*/
  1047. /*
  1048. * Summary:
  1049. * Apple events (kEventClassAppleEvent)
  1050. */
  1051. enum {
  1052. /*
  1053. * Sent when a high-level event is received. The default handler will
  1054. * call AEProcessAppleEvent.
  1055. */
  1056. kEventAppleEvent = 1
  1057. };
  1058. /*
  1059. Parameters for Apple events:
  1060. kEventAppleEvent
  1061. --> kEventParamAEEventClass typeType // the eventClass of the Apple event
  1062. --> kEventParamAEEventID typeType // the eventID of the Apple event
  1063. */
  1064. /*--------------------------------------------------------------------------------------*/
  1065. /* Window Events */
  1066. /*--------------------------------------------------------------------------------------*/
  1067. /*
  1068. * Summary:
  1069. * Window refresh events (kEventClassWindow)
  1070. *
  1071. * Discussion:
  1072. * Events related to drawing a window's content.
  1073. */
  1074. enum {
  1075. /*
  1076. * Low-level update event. Sent to any window that needs updating
  1077. * regardless of whether the window has the standard handler
  1078. * installed. You must call BeginUpdate, call SetPort, draw your
  1079. * window content, and then call EndUpdate.
  1080. */
  1081. kEventWindowUpdate = 1,
  1082. /*
  1083. * Only sent to windows with the standard handler installed.
  1084. * BeginUpdate, SetPort, and EndUpdate are called for you; all you do
  1085. * is draw. No, really.
  1086. */
  1087. kEventWindowDrawContent = 2
  1088. };
  1089. /*
  1090. Parameters for window refresh events:
  1091. kEventWindowUpdate
  1092. --> kEventParamDirectObject typeWindowRef
  1093. kEventWindowDrawContent
  1094. --> kEventParamDirectObject typeWindowRef
  1095. */
  1096. /*
  1097. * Summary:
  1098. * Window activation events (kEventClassWindow)
  1099. *
  1100. * Discussion:
  1101. * Events related to activating and deactivating a window.
  1102. */
  1103. enum {
  1104. /*
  1105. * The window is active now. Sent to any window that is activated,
  1106. * regardless of whether the window has the standard handler
  1107. * installed.
  1108. */
  1109. kEventWindowActivated = 5,
  1110. /*
  1111. * The window is inactive now. Sent to any window that is
  1112. * deactivated, regardless of whether the window has the standard
  1113. * handler installed.
  1114. */
  1115. kEventWindowDeactivated = 6,
  1116. /*
  1117. * Sent when a click occurs in a background window. Only sent to
  1118. * windows with the standard handler installed. The default behavior
  1119. * is to bring the window forward and eat the click. You have the
  1120. * option of overriding the behavior to support click-thru or
  1121. * select-and-click.
  1122. */
  1123. kEventWindowGetClickActivation = 7
  1124. };
  1125. /*
  1126. Parameters for window activation events:
  1127. kEventWindowActivated
  1128. --> kEventParamDirectObject typeWindowRef
  1129. kEventWindowDeactivated
  1130. --> kEventParamDirectObject typeWindowRef
  1131. kEventWindowGetClickActivation
  1132. --> kEventParamDirectObject typeWindowRef
  1133. --> kEventParamMouseLocation typeQDPoint
  1134. --> kEventParamKeyModifiers typeUInt32
  1135. --> kEventParamWindowDefPart typeWindowDefPartCode
  1136. --> kEventParamControlRef typeControlRef (only present if the click was on a control)
  1137. <-- kEventParamClickActivation typeClickActivationResult
  1138. */
  1139. /*
  1140. * Summary:
  1141. * Window state change events (kEventClassWindow)
  1142. *
  1143. * Discussion:
  1144. * Events that notify of a change in the window's state. These
  1145. * events are sent to all windows, regardless of whether the window
  1146. * has the standard handler installed.
  1147. */
  1148. enum {
  1149. /*
  1150. * A window is being shown. This is sent inside ShowHide.
  1151. */
  1152. kEventWindowShowing = 22,
  1153. /*
  1154. * A window is being hidden. This is sent inside ShowHide.
  1155. */
  1156. kEventWindowHiding = 23,
  1157. /*
  1158. * Indicates that the window has been shown.
  1159. */
  1160. kEventWindowShown = 24,
  1161. /*
  1162. * Indicates that the window has been hidden.
  1163. */
  1164. kEventWindowHidden = 25,
  1165. /*
  1166. * Notification that the window is about to collapse. Available in
  1167. * Mac OS X 10.1 and later.
  1168. */
  1169. kEventWindowCollapsing = 86,
  1170. /*
  1171. * Notification that the window has successfully collapsed.
  1172. */
  1173. kEventWindowCollapsed = 67,
  1174. /*
  1175. * Notification that the window is about to expand. Available in Mac
  1176. * OS X 10.1 and later.
  1177. */
  1178. kEventWindowExpanding = 87,
  1179. /*
  1180. * Notification that the window has successfully expanded.
  1181. */
  1182. kEventWindowExpanded = 70,
  1183. /*
  1184. * Notification that the window has been successfully zoomed. In
  1185. * CarbonLib 1.1 through CarbonLib 1.4, and Mac OS X 10.0 through
  1186. * 10.1.x, this event is only sent by the standard window event
  1187. * handler after handling kEventWindowZoom; starting with CarbonLib
  1188. * 1.5 and Mac OS X 10.2, this event is sent by ZoomWindow and
  1189. * ZoomWindowIdeal.
  1190. */
  1191. kEventWindowZoomed = 76,
  1192. /*
  1193. * Sent during DragWindow or ResizeWindow, before the window is
  1194. * actually moved or resized. Alter the current bounds
  1195. * (kEventParamCurrentBounds) in the event to change the eventual
  1196. * location of the window. You may change the size, origin, or both
  1197. * of the window's bounds. Do not, however, call SizeWindow or
  1198. * SetWindowBounds yourself from inside a handler for this event.
  1199. *
  1200. * In Mac OS X 10.1 and later, kEventWindowBoundsChanging is sent
  1201. * before all changes to a window's bounds, regardless of whether the
  1202. * change is initiated by the user or by a direct call to a Window
  1203. * Manager API. Applications may intercept the event and modify the
  1204. * bounds. When the event is sent because of a direct call to the
  1205. * Window Manager, the kWindowBoundsChangeUserDrag/Resize attribute
  1206. * bits will not be set.
  1207. */
  1208. kEventWindowBoundsChanging = 26,
  1209. /*
  1210. * Indicates that the window has been moved or resized (or both). Do
  1211. * not call SizeWindow or SetWindowBounds from inside a handler for
  1212. * this event; if you need to enforce a certain window bounds,
  1213. * install a kEventWindowBoundsChanging handler instead.
  1214. */
  1215. kEventWindowBoundsChanged = 27,
  1216. /*
  1217. * Indicates that the user has just started to resize a window.
  1218. */
  1219. kEventWindowResizeStarted = 28,
  1220. /*
  1221. * Indicates that the user has just finished resizing a window.
  1222. */
  1223. kEventWindowResizeCompleted = 29,
  1224. /*
  1225. * Indicates that the user has just started to drag a window.
  1226. */
  1227. kEventWindowDragStarted = 30,
  1228. /*
  1229. * Indicates that the user has just finished dragging a window.
  1230. */
  1231. kEventWindowDragCompleted = 31,
  1232. /*
  1233. * Dispatched by DisposeWindow before the window is disposed.
  1234. */
  1235. kEventWindowClosed = 73
  1236. };
  1237. /*
  1238. * Summary:
  1239. * Window bounds change event attributes
  1240. *
  1241. * Discussion:
  1242. * When the toolbox sends out a kEventWindowBoundsChanging or
  1243. * kEventWindowBoundsChanged event, it also sends along a parameter
  1244. * containing attributes of the event. These attributes can be used
  1245. * to determine what aspect of the window changed (origin, size, or
  1246. * both), and whether or not some user action is driving the change
  1247. * (drag or resize).
  1248. */
  1249. enum {
  1250. /*
  1251. * The bounds is changing because the user is dragging the window
  1252. * around.
  1253. */
  1254. kWindowBoundsChangeUserDrag = (1 << 0),
  1255. /*
  1256. * The bounds is changing because the user is resizing the window.
  1257. */
  1258. kWindowBoundsChangeUserResize = (1 << 1),
  1259. /*
  1260. * The dimensions of the window (width and height) are changing.
  1261. */
  1262. kWindowBoundsChangeSizeChanged = (1 << 2),
  1263. /*
  1264. * The top left corner (origin) is changing.
  1265. */
  1266. kWindowBoundsChangeOriginChanged = (1 << 3),
  1267. /*
  1268. * The bounds is changing because ZoomWindow or ZoomWindowIdeal was
  1269. * called. Note that this flag does not imply any user interaction;
  1270. * if the application calls ZoomWindow itself without user request,
  1271. * this flag will still be set. Available in Mac OS X 10.2 and
  1272. * CarbonLib 1.6, and later.
  1273. */
  1274. kWindowBoundsChangeZoom = (1 << 4)
  1275. };
  1276. /*
  1277. Parameters for window state change events:
  1278. kEventWindowShowing
  1279. --> kEventParamDirectObject typeWindowRef
  1280. kEventWindowHiding
  1281. --> kEventParamDirectObject typeWindowRef
  1282. kEventWindowShown
  1283. --> kEventParamDirectObject typeWindowRef
  1284. kEventWindowHidden
  1285. --> kEventParamDirectObject typeWindowRef
  1286. kEventWindowBoundsChanging
  1287. --> kEventParamDirectObject typeWindowRef
  1288. --> kEventParamAttributes typeUInt32
  1289. --> kEventParamOriginalBounds typeQDRectangle
  1290. --> kEventParamPreviousBounds typeQDRectangle
  1291. <-> kEventParamCurrentBounds typeQDRectangle
  1292. kEventWindowBoundsChanged
  1293. --> kEventParamDirectObject typeWindowRef
  1294. --> kEventParamAttributes typeUInt32
  1295. --> kEventParamOriginalBounds typeQDRectangle
  1296. --> kEventParamPreviousBounds typeQDRectangle
  1297. --> kEventParamCurrentBounds typeQDRectangle
  1298. kEventWindowResizeStarted
  1299. --> kEventParamDirectObject typeWindowRef
  1300. kEventWindowResizeCompleted
  1301. --> kEventParamDirectObject typeWindowRef
  1302. kEventWindowDragStarted
  1303. --> kEventParamDirectObject typeWindowRef
  1304. kEventWindowDragCompleted
  1305. --> kEventParamDirectObject typeWindowRef
  1306. */
  1307. /*
  1308. * Summary:
  1309. * Window click events (kEventClassWindow)
  1310. *
  1311. * Discussion:
  1312. * Low-level events which generate higher-level "action" events.
  1313. * These events are only generated for windows with the standard
  1314. * window handler installed. Most clients should allow the standard
  1315. * handler to implement these events.
  1316. *
  1317. * Window click events are generated from lower-level
  1318. * kEventMouseDown events by copying the mouse event and changing
  1319. * the class and kind, so window click events will have all of the
  1320. * parameters of the mouse down event, in addition to those
  1321. * parameters documented here that are specific to the window events.
  1322. */
  1323. enum {
  1324. /*
  1325. * Sent when the mouse is down in the drag region. The standard
  1326. * handler calls DragWindow.
  1327. */
  1328. kEventWindowClickDragRgn = 32,
  1329. /*
  1330. * Sent when the mouse is down in the resize area. The standard
  1331. * handler calls ResizeWindow.
  1332. */
  1333. kEventWindowClickResizeRgn = 33,
  1334. /*
  1335. * Sent when the mouse is down in the collapse widget. The standard
  1336. * handler calls CollapseWindow, and then generates
  1337. * kEventWindowExpand or kEventWindowCollapse (whichever is the
  1338. * opposite of the window's original collapse state).
  1339. */
  1340. kEventWindowClickCollapseRgn = 34,
  1341. /*
  1342. * Sent when the mouse is down in the close widget. The standard
  1343. * handler calls TrackGoAway, and then generates kEventWindowClose.
  1344. */
  1345. kEventWindowClickCloseRgn = 35,
  1346. /*
  1347. * Sent when the mouse is down in the zoom widget. The standard
  1348. * handler calls TrackBox, and then generates kEventWindowZoom.
  1349. */
  1350. kEventWindowClickZoomRgn = 36,
  1351. /*
  1352. * Sent when the mouse is down in the content region. The standard
  1353. * handler checks for contextual menu clicks and clicks on controls,
  1354. * and sends kEventWindowContextualMenuSelect, kEventControlClick,
  1355. * and kEventWindowHandleContentClick events as appropriate.
  1356. */
  1357. kEventWindowClickContentRgn = 37,
  1358. /*
  1359. * Sent when the mouse is down in the proxy icon. The standard
  1360. * handler handles proxy icon dragging, and generates proxy icon
  1361. * events.
  1362. */
  1363. kEventWindowClickProxyIconRgn = 38,
  1364. /*
  1365. * Sent when the mouse is down in the toolbar button. The standard
  1366. * handler calls TrackBox, and then generates
  1367. * kEventWindowToolbarSwitchMode. (Mac OS X only)
  1368. */
  1369. kEventWindowClickToolbarButtonRgn = 41,
  1370. /*
  1371. * Sent when the mouse is down in some part of the window structure
  1372. * other than the window widgets, drag region, or resize region.
  1373. */
  1374. kEventWindowClickStructureRgn = 42
  1375. };
  1376. /*
  1377. * Summary:
  1378. * Window cursor change events (kEventClassWindow)
  1379. */
  1380. enum {
  1381. /*
  1382. * Sent when the mouse is moving over the content region. Available
  1383. * in Mac OS X and in CarbonLib 1.5 and later. This event is used to
  1384. * manage ownership of the cursor. You should only change the cursor
  1385. * if you receive this event; otherwise, someone else needed to
  1386. * adjust the cursor and handled the event (e.g., a TSM Input Method
  1387. * when the mouse is over an inline input region). This event is only
  1388. * sent to the window itself; it is not propagated to controls in the
  1389. * window.
  1390. */
  1391. kEventWindowCursorChange = 40
  1392. };
  1393. /*
  1394. Parameters for window cursor change events:
  1395. kEventWindowCursorChange
  1396. --> kEventParamDirectObject typeWindowRef
  1397. --> kEventParamMouseLocation typeQDPoint
  1398. --> kEventParamKeyModifiers typeUInt32
  1399. */
  1400. /*
  1401. * Summary:
  1402. * Window action events
  1403. *
  1404. * Discussion:
  1405. * Events which indicate that certain changes have been made to the
  1406. * window. These events have greater semantic meaning than the
  1407. * low-level window click events and are usually prefered for
  1408. * overriding.
  1409. */
  1410. enum {
  1411. /*
  1412. * If the window is not collapsed, this event is sent by the standard
  1413. * window handler after it has received kEventWindowClickCollapseRgn
  1414. * and received true from a call to TrackBox. The standard window
  1415. * handler calls CollapseWindow, which sends kEventWindowCollapsing
  1416. * and kEventWindowCollapsed.
  1417. */
  1418. kEventWindowCollapse = 66,
  1419. /*
  1420. * Sent by the standard window handler (when the option key is down)
  1421. * after it has received kEventWindowClickCollapseRgn and then
  1422. * received true from a call to TrackBox. The standard window
  1423. * handler's response is to send each window of the same class as the
  1424. * clicked window a kEventWindowCollapse event.
  1425. */
  1426. kEventWindowCollapseAll = 68,
  1427. /*
  1428. * If the window is collapsed, this event is sent by the standard
  1429. * window handler after it has received kEventWindowClickCollapseRgn
  1430. * and received true from a call to TrackBox. The standard window
  1431. * handler's response is to call CollapseWindow, which sends
  1432. * kEventWindowExpanding and kEventWindowExpanded. Note that you will
  1433. * not receive this event before a window is expanded from the dock,
  1434. * since minimized windows in the dock don't uses collapse boxes to
  1435. * unminimize. However, you will still receive kEventWindowExpanding
  1436. * and kEventWindowExpanded in that case.
  1437. */
  1438. kEventWindowExpand = 69,
  1439. /*
  1440. * Sent by the standard window handler (when the option key is down)
  1441. * after it has received kEventWindowClickCollapseRgn and then
  1442. * received true from a call to TrackBox. The standard window
  1443. * handler's response is to send each window of the same class as the
  1444. * clicked window a kEventWindowExpand event.
  1445. */
  1446. kEventWindowExpandAll = 71,
  1447. /*
  1448. * Sent by the standard window handler after it has received
  1449. * kEventWindowClickCloseRgn and successfully called TrackBox. Your
  1450. * application might intercept this event to check if the document is
  1451. * dirty, and display a Save/Don'tSave/Cancel alert.
  1452. */
  1453. kEventWindowClose = 72,
  1454. /*
  1455. * Sent by the standard window handler (when the option key is down)
  1456. * after it has received kEventWindowClickCloseRgn and received true
  1457. * from a call to TrackGoAway. The standard window handler's
  1458. * response is to send each window with the same class as the clicked
  1459. * window a kEventWindowClose event.
  1460. */
  1461. kEventWindowCloseAll = 74,
  1462. /*
  1463. * Sent by the standard window handler upon receiving
  1464. * kEventWindowClickZoomRgn and then receiving true from a call to
  1465. * TrackBox. The standard window handler's response is to zoom the
  1466. * window using ZoomWindowIdeal. Upon successful zoom,
  1467. * kEventWindowZoomed is sent.
  1468. */
  1469. kEventWindowZoom = 75,
  1470. /*
  1471. * Sent by the standard window handler (when the option key is down)
  1472. * after it has received kEventObjectClickZoomRgn and received true
  1473. * from a call to TrackBox. The standard window handler's response
  1474. * is to send each window with the same class as the clicked window a
  1475. * kEventObjectZoom event and then to reposition all zoomed windows
  1476. * using the kWindowCascadeOnParentWindowScreen positioning method.
  1477. */
  1478. kEventWindowZoomAll = 77,
  1479. /*
  1480. * Sent when either the right mouse button is pressed, or the control
  1481. * key is held down and the left mouse button is pressed. The
  1482. * standard window handler ignores this event.
  1483. */
  1484. kEventWindowContextualMenuSelect = 78,
  1485. /*
  1486. * Sent when IsWindowPathSelectClick would return true. Set the
  1487. * MenuRef in the event if you wish to customize the menu passed to
  1488. * WindowPathSelect.
  1489. */
  1490. kEventWindowPathSelect = 79,
  1491. /*
  1492. * Sent by the standard window handler to determine the ideal size of
  1493. * the window's content region (used during window zooming).
  1494. */
  1495. kEventWindowGetIdealSize = 80,
  1496. /*
  1497. * Sent by the standard window handler to determine the minimum size
  1498. * of the window's content region (used during window resizing). On
  1499. * Mac OS X 10.2 and CarbonLib 1.6 and later, this event is also sent
  1500. * by ResizeWindow and GrowWindow if the sizeConstraints parameter is
  1501. * NULL.
  1502. */
  1503. kEventWindowGetMinimumSize = 81,
  1504. /*
  1505. * Sent by the standard window handler to determine the maximum size
  1506. * of the window's content region (used during window resizing). On
  1507. * Mac OS X 10.2 and CarbonLib 1.6 and later, this event is also sent
  1508. * by ResizeWindow and GrowWindow if the sizeConstraints parameter is
  1509. * NULL.
  1510. */
  1511. kEventWindowGetMaximumSize = 82,
  1512. /*
  1513. * Sent by the Window Manager to warn of a change in the available
  1514. * window positioning bounds on the window (i.e., screen resolution
  1515. * or Dock size change). Available only in Mac OS X. In Mac OS
  1516. * 10.0.x, the standard window handler always constrains the window
  1517. * to the rect returned by GetAvailableWindowPositioningBounds for
  1518. * the window's device. In Mac OS 10.1 and later, event handlers may
  1519. * change the rect in the kEventParamAvailableBounds parameter, and
  1520. * the standard window handler will constrain the window to that
  1521. * rectangle. In Mac OS X 10.2, this event may optionally contain a
  1522. * kEventParamAttributes parameter; if present, this parameter should
  1523. * be formed from constants in the WindowConstrainOptions
  1524. * enumeration. The standard window handler will pass these
  1525. * attributes to ConstrainWindowToScreen. If this event parameter is
  1526. * not present, the standard window handler passes
  1527. * kWindowConstrainMoveRegardlessOfFit to ConstrainWindowToScreen in
  1528. * 10.0.x, and kWindowConstrainMoveRegardlessOfFit |
  1529. * kWindowConstrainAllowPartial in Mac OS 10.1 and later. In Mac OS X
  1530. * 10.2, this event may optionally contain a
  1531. * kEventParamWindowRegionCode parameter; if present, this parameter
  1532. * should be a WindowRegionCode. The standard window handler will
  1533. * pass this code to ConstrainWindowToScreen. If this event parameter
  1534. * is not present, the standard window handler passes kWindowDragRgn
  1535. * to ContrainWindowToScreen. In Mac OS X 10.2, this event may
  1536. * optionally contain a kEventParamRgnHandle parameter; if present,
  1537. * this parameter is a RgnHandle containing the GrayRgn before a
  1538. * GDevice configuration change. An event handler may compare this
  1539. * region with the current GrayRgn to more intelligently determine
  1540. * whether the window should be constrained to current GrayRgn. The
  1541. * standard window handler in Mac OS X 10.2 will not constrain
  1542. * windows that were not onscreen before the device configuration
  1543. * change. In Mac OS X 10.2, this event may optionally contain
  1544. * kEventParamPreviousDockRect and kEventParamCurrentDockRect
  1545. * parameters; if present, these parameters contain the previous and
  1546. * current bounds of the Dock.
  1547. */
  1548. kEventWindowConstrain = 83,
  1549. /*
  1550. * Sent by the standard window handler in response to
  1551. * kEventWindowClickContentRgn when a mouse click is in the content
  1552. * region but is not a contextual menu invocation or a click on a
  1553. * control. Available starting with Mac OS X and CarbonLib 1.3.1.
  1554. */
  1555. kEventWindowHandleContentClick = 85,
  1556. /*
  1557. * A request for a menu to be displayed by a window's dock tile. The
  1558. * basic window handler will return the menu, if any, that was
  1559. * provided by the SetWindowDockTileMenu API. The sender of this
  1560. * event will release the menu after the Dock has displayed it, so if
  1561. * you return a permanently allocated MenuRef, you should call
  1562. * RetainMenu on it before returning from your event handler. For
  1563. * most applications, it will be easier to use the
  1564. * SetWindowDockTileMenu API directly rather than installing a
  1565. * handler for this event. Available in Mac OS X 10.2 and later.
  1566. */
  1567. kEventWindowGetDockTileMenu = 90,
  1568. /*
  1569. * Sent before a proxy icon drag; you can attach data to the DragRef
  1570. * in the event.
  1571. */
  1572. kEventWindowProxyBeginDrag = 128,
  1573. /*
  1574. * Sent after the proxy icon drag is complete, whether successful or
  1575. * not.
  1576. */
  1577. kEventWindowProxyEndDrag = 129,
  1578. /*
  1579. * Sent by the standard window handler in response to
  1580. * kEventWindowClickToolbarButtonRgn and then receiving true from a
  1581. * call to TrackBox. You actually DO NOT need to use the standard
  1582. * window event handler to receive this event. Any window with the
  1583. * toolbar button will receive this event if the toolbar button is
  1584. * clicked. The Toolbox does not track the state of the toolbar. We
  1585. * only report that the button was clicked. The application should
  1586. * react accordingly. Available in Mac OS X only.
  1587. */
  1588. kEventWindowToolbarSwitchMode = 150
  1589. };
  1590. /*
  1591. Parameters for window action events:
  1592. kEventWindowCollapse
  1593. --> kEventParamDirectObject typeWindowRef
  1594. kEventWindowCollapsed
  1595. --> kEventParamDirectObject typeWindowRef
  1596. kEventWindowCollapseAll
  1597. --> kEventParamDirectObject typeWindowRef
  1598. kEventWindowExpand
  1599. --> kEventParamDirectObject typeWindowRef
  1600. kEventWindowExpanded
  1601. --> kEventParamDirectObject typeWindowRef
  1602. kEventWindowExpandAll
  1603. --> kEventParamDirectObject typeWindowRef
  1604. kEventWindowClose
  1605. --> kEventParamDirectObject typeWindowRef
  1606. kEventWindowClosed
  1607. --> kEventParamDirectObject typeWindowRef
  1608. kEventWindowCloseAll
  1609. --> kEventParamDirectObject typeWindowRef
  1610. kEventWindowZoom
  1611. --> kEventParamDirectObject typeWindowRef
  1612. kEventWindowZoomed
  1613. --> kEventParamDirectObject typeWindowRef
  1614. kEventWindowZoomAll
  1615. --> kEventParamDirectObject typeWindowRef
  1616. kEventWindowContextualMenuSelect
  1617. --> kEventParamDirectObject typeWindowRef
  1618. kEventWindowPathSelect
  1619. --> kEventParamDirectObject typeWindowRef
  1620. kEventWindowGetIdealSize
  1621. --> kEventParamDirectObject typeWindowRef
  1622. <-- kEventParamDimensions typeQDPoint
  1623. kEventWindowGetMinimumSize
  1624. --> kEventParamDirectObject typeWindowRef
  1625. <-- kEventParamDimensions typeQDPoint
  1626. kEventWindowGetMaximumSize
  1627. --> kEventParamDirectObject typeWindowRef
  1628. <-- kEventParamDimensions typeQDPoint
  1629. kEventWindowConstrain
  1630. --> kEventParamDirectObject typeWindowRef
  1631. --> kEventParamAvailableBounds typeQDRectangle
  1632. --> kEventParamAttributes typeUInt32 (optional; available in Jaguar)
  1633. --> kEventParamWindowRegionCode typeWindowRegionCode (optional; available in Jaguar)
  1634. --> kEventParamRgnHandle typeQDRgnHandle (optional; available in Jaguar)
  1635. --> kEventParamPreviousDockRect typeHIRect (available in Jaguar)
  1636. --> kEventParamCurrentDockRect typeHIRect (available in Jaguar)
  1637. kEventWindowHandleContentClick
  1638. --> kEventParamDirectObject typeWindowRef
  1639. --> [other parameters from kEventMouseDown]
  1640. kEventWindowGetDockTileMenu
  1641. --> kEventParamDirectObject typeWindowRef
  1642. <-- kEventParamMenuRef typeMenuRef
  1643. kEventWindowProxyBeginDrag
  1644. --> kEventParamDirectObject typeWindowRef
  1645. kEventWindowProxyEndDrag
  1646. --> kEventParamDirectObject typeWindowRef
  1647. */
  1648. /*
  1649. * Summary:
  1650. * Window focus events (kEventClassWindow)
  1651. *
  1652. * Discussion:
  1653. * Events related to focus changes between windows. These events are
  1654. * generated by SetUserFocusWindow; since that API is only called by
  1655. * default by the standard window handler, these events are normally
  1656. * only sent to windows with the standard handler installed.
  1657. */
  1658. enum {
  1659. /*
  1660. * The user (or some other action) has caused the focus to shift to
  1661. * your window. In response to this, you should focus any control
  1662. * that might need to be focused. The standard window handler calls
  1663. * SetKeyboardFocus to hilite the first control in the window.
  1664. */
  1665. kEventWindowFocusAcquired = 200,
  1666. /*
  1667. * The toolbox is notifying you of a focus change. You should make
  1668. * sure to unhilite the focus, etc. The standard window handler
  1669. * clears the current keyboard focus.
  1670. */
  1671. kEventWindowFocusRelinquish = 201,
  1672. /*
  1673. * If the content area of your window is not already focused, you
  1674. * should set the focus to the main part/control/view of the window.
  1675. * If the content area of your window is already focused, do nothing.
  1676. * Sent on Mac OS X 10.2 and later.
  1677. */
  1678. kEventWindowFocusContent = 202,
  1679. /*
  1680. * If your window's toolbar is not already focused, you should set
  1681. * the focus to the first item in the toolbar. If your window's
  1682. * toolbar is already focused, do nothing. Sent on Mac OS X 10.2 and
  1683. * later.
  1684. */
  1685. kEventWindowFocusToolbar = 203
  1686. };
  1687. /*
  1688. Parameters for window focus events:
  1689. kEventWindowFocusAcquire
  1690. --> kEventParamDirectObject typeWindowRef
  1691. kEventWindowFocusRelinquish
  1692. --> kEventParamDirectObject typeWindowRef
  1693. */
  1694. /*
  1695. * Summary:
  1696. * Carbon events related to drawers.
  1697. */
  1698. enum {
  1699. /*
  1700. * Sent to the drawer and its parent window when the drawer begins
  1701. * opening. An event handler for this event may return
  1702. * userCanceledErr if the drawer should not open.
  1703. */
  1704. kEventWindowDrawerOpening = 220,
  1705. /*
  1706. * Sent to the drawer and its parent window when the drawer is fully
  1707. * open.
  1708. */
  1709. kEventWindowDrawerOpened = 221,
  1710. /*
  1711. * Sent to the drawer and its parent window when the drawer begins
  1712. * closing. An event handler for this event may return
  1713. * userCanceledErr if the drawer should not close.
  1714. */
  1715. kEventWindowDrawerClosing = 222,
  1716. /*
  1717. * Sent to the drawer and its parent window when the drawer is fully
  1718. * closed.
  1719. */
  1720. kEventWindowDrawerClosed = 223
  1721. };
  1722. /*
  1723. Parameters for window drawer events:
  1724. kEventWindowDrawerOpening
  1725. --> kEventParamDirectObject typeWindowRef
  1726. kEventWindowDrawerOpened
  1727. --> kEventParamDirectObject typeWindowRef
  1728. kEventWindowDrawerClosing
  1729. --> kEventParamDirectObject typeWindowRef
  1730. kEventWindowDrawerClosed
  1731. --> kEventParamDirectObject typeWindowRef
  1732. */
  1733. /*
  1734. * Summary:
  1735. * Window definition events (kEventClassWindow)
  1736. *
  1737. * Discussion:
  1738. * Events that correspond to WDEF messages. Sent to all windows,
  1739. * regardless of whether they have the standard window handler
  1740. * installed.
  1741. */
  1742. enum {
  1743. /*
  1744. * Sent by the Window Manager when it's time to draw a window's
  1745. * structure. This is the replacement to the old wDraw defProc
  1746. * message (though it is a special case of the 0 part code indicating
  1747. * to draw the entire window frame).
  1748. */
  1749. kEventWindowDrawFrame = 1000,
  1750. /*
  1751. * Sent by the Window Manager when it's time to draw a specific part
  1752. * of a window's structure, such as the close box. This is typically
  1753. * sent during window tracking.
  1754. */
  1755. kEventWindowDrawPart = 1001,
  1756. /*
  1757. * Sent by the Window Manager when it needs to get a specific region
  1758. * from a window, or when the GetWindowRegion API is called. The
  1759. * region you should modify is sent in the kEventParamRgnHandle
  1760. * parameter.
  1761. */
  1762. kEventWindowGetRegion = 1002,
  1763. /*
  1764. * Sent when the Window Manager needs to determine what part of a
  1765. * window would be 'hit' with a given mouse location in global
  1766. * coordinates. If you handle this event, you should set the
  1767. * kEventParamWindowDefPart parameter to reflect the part code hit.
  1768. */
  1769. kEventWindowHitTest = 1003,
  1770. /*
  1771. * Sent by the Window Manager when the window is being created. This
  1772. * is a hook to allow your window definition to do any initialization
  1773. * you might need to do. However, see the note under
  1774. * kEventWindowDispose; this event can be sent more than once to a
  1775. * window if the window definition function for the window is changed.
  1776. */
  1777. kEventWindowInit = 1004,
  1778. /*
  1779. * Sent by the Window Manager to notify the window definition that it
  1780. * should dispose of any private data structures attached to the
  1781. * window. Note that this event does not directly correspond with
  1782. * destruction of the window; the Window Manager occasionally needs
  1783. * to change the window definition of a window (for example, when
  1784. * ChangeWindowAttributes is used to change the visual appearance of
  1785. * a window), and in that case, the window will receive a
  1786. * kEventWindowDispose followed by a kEventWindowInit so that the old
  1787. * and new window definitions can disconnect and connect to the
  1788. * window. If you need to know when a window is really being
  1789. * destroyed, install a handler for kEventWindowClosed.
  1790. */
  1791. kEventWindowDispose = 1005,
  1792. /*
  1793. * Sent by the Window Manager when it is time to draw/erase any drag
  1794. * hilite in the window structure. This is typically sent from within
  1795. * HiliteWindowFrameForDrag.
  1796. */
  1797. kEventWindowDragHilite = 1006,
  1798. /*
  1799. * Sent by the Window Manager when it is time to redraw window
  1800. * structure to account for a change in the document modified state.
  1801. * This is typically sent from within SetWindowModified.
  1802. */
  1803. kEventWindowModified = 1007,
  1804. /*
  1805. * Sent by the Window Manager when it is time to generate a drag
  1806. * image for the window proxy. This is typically sent from within
  1807. * BeginWindowProxyDrag.
  1808. */
  1809. kEventWindowSetupProxyDragImage = 1008,
  1810. /*
  1811. * Sent by the Window Manager when a particular window state changes.
  1812. * See the state-change flags in MacWindows.h.
  1813. */
  1814. kEventWindowStateChanged = 1009,
  1815. /*
  1816. * Sent when the Window Manager needs to know how much space the
  1817. * window's title area takes up.
  1818. */
  1819. kEventWindowMeasureTitle = 1010,
  1820. /*
  1821. * This is a compatibility event harkening back to the old days
  1822. * before Mac OS 8. Not very useful these days. When the DrawGrowIcon
  1823. * API is called, this event is sent to the window to tell it to draw
  1824. * the grow box. This is only really needed for windows that do not
  1825. * have the grow box integrated into the window frame. Scroll bar
  1826. * delimiter lines are also drawn.
  1827. */
  1828. kEventWindowDrawGrowBox = 1011,
  1829. /*
  1830. * This is a special way for a window to override the standard resize
  1831. * outline for windows that do not do live resizing. As the user
  1832. * resizes the window, this event is sent with the current size the
  1833. * user has chosen expressed as a rectangle. You should calculate
  1834. * your window outline and modify the kEventParamRgnHandle parameter
  1835. * to reflect your desired outline.
  1836. */
  1837. kEventWindowGetGrowImageRegion = 1012,
  1838. /*
  1839. * When the Window Manager needs to paint a window (e.g, when a
  1840. * window is first displayed), the kEventWindowPaint event is sent to
  1841. * allow the window to control all aspect of painting, including the
  1842. * window frame. If a window does not respond to this event, the
  1843. * Window Manager ends up sending kEventWindowDrawFrame and then
  1844. * erasing the window to the window content color as usual. This is
  1845. * mostly used for specialty windows, such as help tags or appliance
  1846. * apps might have. (Mac OS X only)
  1847. */
  1848. kEventWindowPaint = 1013
  1849. };
  1850. /*
  1851. Parameters for window definition events:
  1852. kEventWindowDrawFrame
  1853. --> kEventParamDirectObject typeWindowRef the window
  1854. kEventWindowDrawPart
  1855. --> kEventParamDirectObject typeWindowRef the window
  1856. --> kEventParamWindowDefPart typeWindowDefPartCode the part to draw
  1857. kEventWindowGetRegion
  1858. --> kEventParamDirectObject typeWindowRef the window
  1859. --> kEventParamWindowRegionCode typeWindowRegionCode the region to get
  1860. --> kEventParamRgnHandle typeQDRgnHandle the region to munge
  1861. kEventWindowHitTest
  1862. --> kEventParamDirectObject typeWindowRef the window
  1863. --> kEventParamMouseLocation typeQDPoint the mouse location
  1864. <-- kEventParamWindowDefPart typeWindowDefPartCode the part hit
  1865. kEventWindowInit
  1866. --> kEventParamDirectObject typeWindowRef the window
  1867. <-- kEventParamWindowFeatures typeUInt32 the window features
  1868. kEventWindowDispose
  1869. --> kEventParamDirectObject typeWindowRef the window
  1870. kEventWindowDragHilite
  1871. --> kEventParamDirectObject typeWindowRef the window
  1872. --> kEventParamWindowDragHiliteFlag typeBoolean whether to draw (true) or
  1873. erase (false) the hilite
  1874. kEventWindowModified
  1875. --> kEventParamDirectObject typeWindowRef the window
  1876. --> kEventParamWindowModifiedFlag typeBoolean the new modified state
  1877. kEventWindowSetupProxyDragImage
  1878. --> kEventParamDirectObject typeWindowRef the window
  1879. --> kEventParamWindowProxyImageRgn typeQDRgnHandle the region you modify
  1880. to contain the clip
  1881. region for the GWorld.
  1882. --> kEventParamWindowProxyOutlineRgn typeQDRgnHandle the region you modify
  1883. to contain the drag
  1884. outline used when the
  1885. GWorld cannot be used.
  1886. <-- kEventParamWindowProxyGWorldPtr typeGWorldPtr a GWorld you allocate
  1887. which contains the
  1888. drag image.
  1889. kEventWindowStateChanged
  1890. --> kEventParamDirectObject typeWindowRef the window
  1891. --> kEventParamWindowStateChangedFlags typeUInt32 the state change flags
  1892. kEventWindowMeasureTitle
  1893. --> kEventParamDirectObject typeWindowRef the window
  1894. <-- kEventParamWindowTitleFullWidth typeSInt16 the length of the whole title area
  1895. <-- kEventParamWindowTitleTextWidth typeSInt16 the length just the title text
  1896. kEventWindowDrawGrowBox
  1897. --> kEventParamDirectObject typeWindowRef the window
  1898. kEventWindowGetGrowImageRegion
  1899. --> kEventParamDirectObject typeWindowRef the window
  1900. --> kEventParamWindowGrowRect typeQDRectangle the global rect
  1901. --> kEventParamRgnHandle typeQDRgnHandle the region to modify
  1902. kEventWindowPaint
  1903. --> kEventParamDirectObject typeWindowRef the window
  1904. */
  1905. /*--------------------------------------------------------------------------------------*/
  1906. /* Menu Events */
  1907. /*--------------------------------------------------------------------------------------*/
  1908. /*
  1909. * Summary:
  1910. * Menu events (kEventClassMenu)
  1911. */
  1912. enum {
  1913. /*
  1914. * The user has begun tracking the menubar or a pop-up menu. If
  1915. * tracking a popup menu, the direct object parameter is the pop-up;
  1916. * if tracking the menubar, the direct object parameter is the root
  1917. * menu on Mac OS X, but will be NULL in CarbonLib. The
  1918. * kEventParamCurrentMenuTrackingMode parameter indicates whether the
  1919. * user is tracking the menus using the mouse or the keyboard.
  1920. * The handler may return userCanceledErr to stop menu tracking.
  1921. */
  1922. kEventMenuBeginTracking = 1,
  1923. /*
  1924. * The user has finished tracking the menubar or a pop-up menu.
  1925. */
  1926. kEventMenuEndTracking = 2,
  1927. /*
  1928. * The user has switched from selecting a menu with the mouse to
  1929. * selecting with the keyboard, or from selecting with the keyboard
  1930. * to selecting with the mouse. Only available on post-10.0.x
  1931. * versions of Mac OS X.
  1932. */
  1933. kEventMenuChangeTrackingMode = 3,
  1934. /*
  1935. * A menu is opening. This event is sent each time that the menu is
  1936. * opened (i.e., more than once during a given tracking session if
  1937. * the user opens the menu multiple times). It is sent before the
  1938. * menu is actually drawn, so you can update the menu contents
  1939. * (including making changes that will alter the menu size) and the
  1940. * new contents will be drawn correctly.
  1941. *
  1942. * The kEventParamMenuFirstOpen parameter indicates whether this is
  1943. * the first time this menu has been opened during this menu tracking
  1944. * session.
  1945. *
  1946. * The handler may return userCanceledErr to prevent this menu from
  1947. * opening (Mac OS X only).
  1948. */
  1949. kEventMenuOpening = 4,
  1950. /*
  1951. * A menu has been closed. Sent after the menu is hidden.
  1952. */
  1953. kEventMenuClosed = 5,
  1954. /*
  1955. * The mouse is moving over a particular menu item. This event is
  1956. * sent for both enabled and disabled items.
  1957. */
  1958. kEventMenuTargetItem = 6,
  1959. /*
  1960. * A menu is about to be examined for items that match a command key
  1961. * event. A handler for this event may perform its own command key
  1962. * matching and override the Menu Manager's default matching
  1963. * algorithms. Returning noErr from your handler indicates that you
  1964. * have found a match. The handler for this event should not examine
  1965. * submenus of this menu for a match; a separate event will be sent
  1966. * for each submenu.
  1967. *
  1968. * Handlers for this event must be installed directly on the menu
  1969. * containing the item to be matched. To improve performance of
  1970. * command key matching, the Menu Manager only sends this event if
  1971. * the menu itself has a handler; if a handler for this event is
  1972. * installed on any other event target, it will not be sent the
  1973. * event.
  1974. *
  1975. * When called from IsMenuKeyEvent, the kEventParamEventRef parameter
  1976. * contains the EventRef that was passed to IsMenuKeyEvent, for your
  1977. * handler to examine; when called from MenuKey or MenuEvent, the
  1978. * EventRef parameter contains an event created from the information
  1979. * passed to MenuKey or MenuEvent. Note that in the MenuKey case, no
  1980. * virtual keycode (kEventParamKeyCode) or key modifiers
  1981. * (kEventParamKeyModifiers) will be available.
  1982. *
  1983. * The kEventParamMenuEventOptions parameter contains a copy of the
  1984. * options that were passed to IsMenuKeyEvent, or 0 if called from
  1985. * MenuKey or MenuEvent. The only option that your handler will need
  1986. * to obey is kMenuEventIncludeDisabledItems.
  1987. *
  1988. * If your handler finds a match, it should set the
  1989. * kEventParamMenuItemIndex parameter to contain the item index of
  1990. * the matching item, and return noErr. If it does not find a match,
  1991. * it should return menuItemNotFoundErr. Any other return value will
  1992. * cause the Menu Manager to use its default command key matching
  1993. * algorithm for this menu.
  1994. * This event is sent after kEventMenuEnableItems.
  1995. */
  1996. kEventMenuMatchKey = 7,
  1997. /*
  1998. * A request that the items in the menu be properly enabled or
  1999. * disabled according to the current state of the application. This
  2000. * event is sent from inside MenuKey, MenuEvent, and IsMenuKeyEvent
  2001. * before those APIs examine the menu for an item that matches a
  2002. * keyboard event. It is also sent during menu tracking before a menu
  2003. * is first made visible; it is sent right after kEventMenuOpening,
  2004. * once per menu per menu tracking session. It is also sent to the
  2005. * top-level menus in the menubar when the application is idle after
  2006. * user input has occurred, to allow the menu titles to be enabled or
  2007. * disabled appropriately according to the current user focus. You
  2008. * can distinquish between all these cases by examining the contents
  2009. * of the kEventParamMenuContext parameter.
  2010. *
  2011. * If you install an event handler for kEventProcessCommand, you
  2012. * should also install a handler for either kEventMenuEnableItems or
  2013. * kEventCommandUpdateStatus. This is necessary because the Carbon
  2014. * event system will attempt to match command keys against the
  2015. * available menus before returning the keyboard event to your
  2016. * application via WaitNextEvent. If you have menu command event
  2017. * handlers installed for your menu items, your handlers will be
  2018. * called without your ever receiving the keyboard event or calling
  2019. * MenuKey/MenuEvent/IsMenuKeyEvent yourself. Therefore, you have no
  2020. * opportunity to enable your menu items properly other than from a
  2021. * kEventMenuEnableItems or kEventCommandUpdateStatus handler.
  2022. * It is not necessary to handle this event if you do not install
  2023. * kEventProcessCommand handlers for your menu items; in that case,
  2024. * the command key event will be returned from WaitNextEvent or
  2025. * ReceiveNextEvent as normal, and you can set up your menus before
  2026. * calling MenuKey/MenuEvent/ IsMenuKeyEvent.
  2027. *
  2028. * The kEventParamEnableMenuForKeyEvent parameter indicates whether
  2029. * this menu should be enabled for key event matching (true) or
  2030. * because the menu itself is about to become visible (false). If
  2031. * true, only the item enable state, command key, command key
  2032. * modifiers, and (optionally) the command key glyph need to be
  2033. * correct. If false, the entire menu item contents must be correct.
  2034. * This may be useful if you have custom menu content that is
  2035. * expensive to prepare.
  2036. */
  2037. kEventMenuEnableItems = 8,
  2038. /*
  2039. * kEventMenuPopulate is intended to be handled by applications that
  2040. * dynamically create their menu contents just-in-time before the
  2041. * menu is displayed. Previously, kEventMenuOpening was recommended
  2042. * for this purpose. kEventMenuPopulate is now recommended because it
  2043. * will be sent by the Menu Manager before it searches a menu for a
  2044. * matching command key, to allow a handler to dynamically add menu
  2045. * items that may have command key equivalents to the menu;
  2046. * kEventMenuOpening is only sent before the menu is displayed.
  2047. * kEventMenuPopulate is also sent just before kEventMenuOpening as a
  2048. * menu is being displayed. Finally, kEventMenuPopulate is only sent
  2049. * once per menu tracking session for a given menu, even if that menu
  2050. * is closed and opened multiple times by the user; kEventMenuOpening
  2051. * is sent each time that the menu is displayed.
  2052. *
  2053. * You can distinguish the command-key case from the
  2054. * menu-being-displayed case by examining the contents of the
  2055. * kEventParamMenuContext parameter; the kMenuContextKeyMatching flag
  2056. * will be set if the event is sent during command key matching, and
  2057. * either the kMenuContextMenuBarTracking or
  2058. * kMenuContextPopUpTracking flags will be sent if the event is sent
  2059. * before actual display of the menu.
  2060. *
  2061. * In Mac OS X 10.2 and CarbonLib 1.6, kEventMenuPopulate is also
  2062. * sent to menus before the menu is searched for a command ID by the
  2063. * CountMenuItemsWithCommandID and GetIndMenuItemWithCommandID APIs.
  2064. * You can distinguish this case by checking for the
  2065. * kMenuContextCommandIDSearch flag in the kEventParamMenuContext
  2066. * parameter. In this case, the event also includes a
  2067. * kEventParamMenuCommand parameter with the command ID being
  2068. * searched for as the event parameter data.
  2069. *
  2070. * kEventMenuPopulate is available on Mac OS X 10.1 and later, and in
  2071. * CarbonLib 1.5 and later.
  2072. */
  2073. kEventMenuPopulate = 9,
  2074. /*
  2075. * Sent by the standard menu definition when a menu item has the
  2076. * kMenuItemAttrCustomDraw attribute. Handlers for this event should
  2077. * be installed directly on the menu. A handler for this event may
  2078. * respond by providing a customized width for the menu item. If no
  2079. * handler is installed, the standard menu definition provides a
  2080. * default handler that will return the standard width for the item.
  2081. */
  2082. kEventMenuMeasureItemWidth = 100,
  2083. /*
  2084. * Sent by the standard menu definition when a menu item has the
  2085. * kMenuItemAttrCustomDraw attribute. Handlers for this event should
  2086. * be installed directly on the menu. A handler for this event may
  2087. * respond by providing a customized height for the menu item. If no
  2088. * handler is installed, the standard menu definition provides a
  2089. * default handler that will return the standard height for the item.
  2090. */
  2091. kEventMenuMeasureItemHeight = 101,
  2092. /*
  2093. * Sent by the standard menu definition when a menu item has the
  2094. * kMenuItemAttrCustomDraw attribute. Handlers for this event should
  2095. * be installed directly on the menu. A handler for this event may
  2096. * respond by completely overriding the drawing of the menu item. If
  2097. * no handler is installed, the standard menu definition provides a
  2098. * default handler that calls DrawThemeMenuItem to draw the menu item
  2099. * background and content.
  2100. */
  2101. kEventMenuDrawItem = 102,
  2102. /*
  2103. * Sent by the standard menu definition when a menu item has the
  2104. * kMenuItemAttrCustomDraw attribute. Handlers for this event should
  2105. * be installed directly on the menu. A handler for this event may
  2106. * respond by overriding the drawing of the menu item content: the
  2107. * mark character, icon, text, and command key information. At the
  2108. * time when this event is sent, the background of the menu item has
  2109. * already been drawn using the standard system appearance, and if
  2110. * the item is selected, the background is drawn with a hilite. If no
  2111. * handler is installed, the standard menu definition provides a
  2112. * default handler that draws the standard menu item content. The
  2113. * standard handler also adds event parameters to the event
  2114. * indicating the bounding boxes of the different portions of the
  2115. * menu item content (mark, icon, text, and command keys), and an
  2116. * event parameter with the baseline of the menu item text; this
  2117. * allows handlers to use CallNextEventHandler to call through to the
  2118. * standard system handler, and then modify the system appearance by
  2119. * drawing on top of the standard content.
  2120. */
  2121. kEventMenuDrawItemContent = 103,
  2122. /*
  2123. * Sent when the menu is being destroyed.
  2124. */
  2125. kEventMenuDispose = 1001
  2126. };
  2127. /*
  2128. * Discussion:
  2129. * Menu context flags indicate the context or usage of a
  2130. * menu-related Carbon event.
  2131. */
  2132. enum {
  2133. /* menu location*/
  2134. /*
  2135. * Indicates that this menu is inserted in the menubar, or is a
  2136. * (directly or indirectly) a submenu of a menu that is inserted in
  2137. * the menubar.
  2138. */
  2139. kMenuContextMenuBar = 1 << 0, /* menu type*/
  2140. /*
  2141. * Indicates that this menu is a pull-down menu inserted in the
  2142. * menubar.
  2143. */
  2144. kMenuContextPullDown = 1 << 8,
  2145. /*
  2146. * Indicates that this menu is a popup menu being displayed by
  2147. * PopUpMenuSelect.
  2148. */
  2149. kMenuContextPopUp = 1 << 9,
  2150. /*
  2151. * Indicates that this menu is a submenu of some other pull-down or
  2152. * popup menu.
  2153. */
  2154. kMenuContextSubmenu = 1 << 10, /* menu usage*/
  2155. /*
  2156. * Indicates that this Carbon event has been sent during a menubar
  2157. * tracking session.
  2158. */
  2159. kMenuContextMenuBarTracking = 1 << 16,
  2160. /*
  2161. * Indicates that this Carbon event has been sent during a popup menu
  2162. * tracking session.
  2163. */
  2164. kMenuContextPopUpTracking = 1 << 17,
  2165. /*
  2166. * Indicates that this Carbon event has been sent during command key
  2167. * matching.
  2168. */
  2169. kMenuContextKeyMatching = 1 << 18,
  2170. /*
  2171. * Indicates that this Carbon event has been sent at idle time to
  2172. * update the enabled state of the menus. Available on Mac OS X 10.1
  2173. * and later, and in CarbonLib 1.5 and later; on earlier releases,
  2174. * the kMenuContextKeyMatching flag is set when an event is sent
  2175. * during menu enabling.
  2176. */
  2177. kMenuContextMenuEnabling = 1 << 19,
  2178. /*
  2179. * Indicates that this Carbon event has been sent during during a
  2180. * search for a menu item command ID by the
  2181. * CountMenuItemsWithCommandID or GetIndMenuItemWithCommandID APIs.
  2182. * Available on Mac OS X 10.2 and CarbonLib 1.6.
  2183. */
  2184. kMenuContextCommandIDSearch = 1 << 20
  2185. };
  2186. /*
  2187. Parameters for menu events:
  2188. kEventMenuBeginTracking
  2189. --> kEventParamDirectObject typeMenuRef
  2190. --> kEventParamCurrentMenuTrackingMode typeMenuTrackingMode
  2191. --> kEventParamMenuContext typeUInt32 (on Mac OS X 10.1 and later, and CarbonLib 1.5 and later)
  2192. kEventMenuEndTracking
  2193. --> kEventParamDirectObject typeMenuRef
  2194. --> kEventParamMenuContext typeUInt32 (on Mac OS X 10.1 and later, and CarbonLib 1.5 and later)
  2195. kEventMenuChangeTrackingMode
  2196. --> kEventParamCurrentMenuTrackingMode typeMenuTrackingMode
  2197. --> kEventParamNewMenuTrackingMode typeMenuTrackingMode
  2198. --> kEventParamMenuContext typeUInt32
  2199. kEventMenuOpening
  2200. --> kEventParamDirectObject typeMenuRef
  2201. --> kEventParamMenuFirstOpen typeBoolean
  2202. --> kEventParamMenuContext typeUInt32 (in CarbonLib 1.5 and later)
  2203. kEventMenuClosed
  2204. --> kEventParamDirectObject typeMenuRef
  2205. --> kEventParamMenuContext typeUInt32 (on Mac OS X 10.1 and later, and CarbonLib 1.5 and later)
  2206. kEventMenuTargetItem
  2207. --> kEventParamDirectObject typeMenuRef
  2208. --> kEventParamMenuItemIndex typeMenuItemIndex
  2209. --> kEventParamMenuCommand typeMenuCommand
  2210. --> kEventParamMenuContext typeUInt32 (on Mac OS X 10.1 and later, and CarbonLib 1.5 and later)
  2211. kEventMenuMatchKey
  2212. --> kEventParamDirectObject typeMenuRef
  2213. --> kEventParamEventRef typeEventRef
  2214. --> kEventParamMenuEventOptions typeMenuEventOptions
  2215. --> kEventParamMenuContext typeUInt32 (on Mac OS X 10.1 and later, and CarbonLib 1.5 and later)
  2216. <-- kEventParamMenuItemIndex typeMenuItemIndex
  2217. kEventMenuEnableItems
  2218. --> kEventParamDirectObject typeMenuRef
  2219. --> kEventParamEnableMenuForKeyEvent typeBoolean
  2220. --> kEventParamMenuContext typeUInt32 (in CarbonLib 1.3.1 and later)
  2221. kEventMenuPopulate (on Mac OS X 10.1 and later, and CarbonLib 1.5 and later)
  2222. --> kEventParamDirectObject typeMenuRef
  2223. --> kEventParamMenuContext typeUInt32
  2224. --> kEventParamMenuCommand typeMenuCommand (Jaguar and CarbonLib 1.6, for kMenuContextCommandIDSearch)
  2225. kEventMenuMeasureItemWidth (on Mac OS X 10.1 and later, and CarbonLib 1.5 and later)
  2226. --> kEventParamDirectObject typeMenuRef
  2227. --> kEventParamMenuItemIndex typeMenuItemIndex
  2228. <-- kEventParamMenuItemWidth typeShortInteger
  2229. kEventMenuMeasureItemHeight (on Mac OS X 10.1 and later, and CarbonLib 1.5 and later)
  2230. --> kEventParamDirectObject typeMenuRef
  2231. --> kEventParamMenuItemIndex typeMenuItemIndex
  2232. <-- kEventParamMenuItemHeight typeShortInteger
  2233. kEventMenuDrawItem (on Mac OS X 10.1 and later, and CarbonLib 1.5 and later)
  2234. --> kEventParamDirectObject typeMenuRef
  2235. --> kEventParamCurrentBounds typeQDRectangle
  2236. --> kEventParamMenuItemIndex typeMenuItemIndex
  2237. --> kEventParamMenuItemBounds typeQDRectangle
  2238. --> kEventParamMenuVirtualTop typeLongInteger
  2239. --> kEventParamMenuVirtualBottom typeLongInteger
  2240. --> kEventParamMenuDrawState typeThemeMenuState
  2241. --> kEventParamMenuItemType typeThemeMenuItemType
  2242. --> kEventParamCGContextRef typeCGContextRef
  2243. <-- kEventParamMenuMarkBounds typeQDRectangle (added to event by the default event handler)
  2244. <-- kEventParamMenuIconBounds typeQDRectangle (added to event by the default event handler)
  2245. <-- kEventParamMenuTextBounds typeQDRectangle (added to event by the default event handler)
  2246. <-- kEventParamMenuTextBaseline typeShortInteger (added to event by the default event handler)
  2247. <-- kEventParamMenuCommandKeyBounds typeQDRectangle (added to event by the default event handler)
  2248. kEventMenuDrawItemContent (on Mac OS X 10.1 and later, and CarbonLib 1.5 and later)
  2249. --> kEventParamDirectObject typeMenuRef
  2250. --> kEventParamMenuItemIndex typeMenuItemIndex
  2251. --> kEventParamMenuItemBounds typeQDRectangle
  2252. --> kEventParamDeviceDepth typeShortInteger
  2253. --> kEventParamDeviceColor typeBoolean
  2254. --> kEventParamCGContextRef typeCGContextRef
  2255. <-- kEventParamMenuMarkBounds typeQDRectangle (added to event by the default event handler)
  2256. <-- kEventParamMenuIconBounds typeQDRectangle (added to event by the default event handler)
  2257. <-- kEventParamMenuTextBounds typeQDRectangle (added to event by the default event handler)
  2258. <-- kEventParamMenuTextBaseline typeShortInteger (added to event by the default event handler)
  2259. <-- kEventParamMenuCommandKeyBounds typeQDRectangle (added to event by the default event handler)
  2260. kEventMenuDispose
  2261. --> kEventParamDirectObject typeMenuRef
  2262. */
  2263. /*--------------------------------------------------------------------------------------*/
  2264. /* Command Events */
  2265. /*--------------------------------------------------------------------------------------*/
  2266. /*
  2267. * Summary:
  2268. * Command events (kEventClassCommand)
  2269. */
  2270. enum {
  2271. kEventProcessCommand = 1,
  2272. /*
  2273. * A command has been invoked and the application should handle it.
  2274. * This event is sent when the user chooses a menu item or clicks a
  2275. * control. Any menu item selection, from either the menubar, a popup
  2276. * or contextual menu, or a popup or bevel button control, will cause
  2277. * this event to be sent; if the menu item does not have a command
  2278. * ID, the commandID field of the HICommand parameter will be zero,
  2279. * but the event will still contain a valid MenuRef and
  2280. * MenuItemIndex. Controls will send this event only if the control
  2281. * has a non-zero command ID set with SetControlCommandID.
  2282. *
  2283. * Some senders of this event will also include the modifier keys
  2284. * that were pressed by the user when the command was invoked, but
  2285. * this parameter is optional.
  2286. *
  2287. * When a command event is sent from a menu, a MenuContext parameter
  2288. * will be included on Mac OS X 10.2 and CarbonLib 1.6, indicating
  2289. * whether the command was sent from a menu in the menubar
  2290. * (kMenuContextMenuBar will be set) or from a popup menu
  2291. * (kMenuContextMenuBar will not be set). The MenuContext parameter
  2292. * also indicates whether the event was sent by a selection of a menu
  2293. * item with the mouse (kMenuContextMenuBarTracking or
  2294. * kMenuContextPopUpTracking will be set), or by a command key press
  2295. * (kMenuContextKeyMatching will be set).
  2296. *
  2297. * It is essential that your event handler for this event return
  2298. * eventNotHandledErr for any command events that you do not handle,
  2299. * especially for commands that are sent from menus attached to popup
  2300. * or bevel button controls; if, for example, you return noErr for
  2301. * command events sent in response to a menu selection from a popup
  2302. * button, the Menu Manager will return zero from PopUpMenuSelect,
  2303. * and the popup button control will not know that an item was
  2304. * selected from the popup menu and will not redraw with the new
  2305. * selection.
  2306. */
  2307. kEventCommandProcess = 1,
  2308. /*
  2309. * The status of a command is in question. When you receive this
  2310. * event, you should update the necessary UI elements in your
  2311. * application to reflect the current status of the command. For
  2312. * example, if the command has the kHICommandFromMenu bit set, you
  2313. * should update the menu item state, text, etc. to reflect the
  2314. * current reality in your application.
  2315. */
  2316. kEventCommandUpdateStatus = 2
  2317. };
  2318. /*
  2319. Parameters for command events:
  2320. kEventCommandProcess
  2321. --> kEventParamDirectObject typeHICommand
  2322. --> kEventParamKeyModifiers typeUInt32 (optional)
  2323. --> kEventParamMenuContext typeUInt32 (optional, in Jaguar and CarbonLib 1.6)
  2324. kEventCommandUpdateStatus
  2325. --> kEventParamDirectObject typeHICommand
  2326. --> kEventParamMenuContext typeUInt32
  2327. */
  2328. /* HI Commands */
  2329. /*
  2330. * Summary:
  2331. * Common command IDs
  2332. */
  2333. enum {
  2334. /*
  2335. * The OK button in a dialog or alert.
  2336. */
  2337. kHICommandOK = FOUR_CHAR_CODE('ok '),
  2338. /*
  2339. * The Cancel button in a dialog or alert.
  2340. */
  2341. kHICommandCancel = FOUR_CHAR_CODE('not!'),
  2342. /*
  2343. * The application should quit.
  2344. */
  2345. kHICommandQuit = FOUR_CHAR_CODE('quit'),
  2346. /*
  2347. * The last editing operation should be undone.
  2348. */
  2349. kHICommandUndo = FOUR_CHAR_CODE('undo'),
  2350. /*
  2351. * The last editing operation should be redone.
  2352. */
  2353. kHICommandRedo = FOUR_CHAR_CODE('redo'),
  2354. /*
  2355. * The selected items should be cut.
  2356. */
  2357. kHICommandCut = FOUR_CHAR_CODE('cut '),
  2358. /*
  2359. * The selected items should be copied.
  2360. */
  2361. kHICommandCopy = FOUR_CHAR_CODE('copy'),
  2362. /*
  2363. * The contents of the clipboard should be pasted.
  2364. */
  2365. kHICommandPaste = FOUR_CHAR_CODE('past'),
  2366. /*
  2367. * The selected items should be deleted.
  2368. */
  2369. kHICommandClear = FOUR_CHAR_CODE('clea'),
  2370. /*
  2371. * All items in the active window should be selected.
  2372. */
  2373. kHICommandSelectAll = FOUR_CHAR_CODE('sall'),
  2374. /*
  2375. * The application should be hidden. The Menu Manager will respond to
  2376. * this command automatically; your application does not need to
  2377. * handle it.
  2378. */
  2379. kHICommandHide = FOUR_CHAR_CODE('hide'),
  2380. /*
  2381. * Other applications should be hidden. The Menu Manager will respond
  2382. * to this command automatically; your application does not need to
  2383. * handle it.
  2384. */
  2385. kHICommandHideOthers = FOUR_CHAR_CODE('hido'),
  2386. /*
  2387. * All applications should become visible. The Menu Manager will
  2388. * respond to this command automatically; your application does not
  2389. * need to handle it.
  2390. */
  2391. kHICommandShowAll = FOUR_CHAR_CODE('shal'),
  2392. /*
  2393. * The Preferences menu item has been selected.
  2394. */
  2395. kHICommandPreferences = FOUR_CHAR_CODE('pref'),
  2396. /*
  2397. * The active window should be zoomed in or out. The Window Manager
  2398. * will respond to this event automatically; your application does
  2399. * not need to handle it, but you may want to install a Carbon event
  2400. * handler for kEventWindowGetIdealSize to return the ideal size for
  2401. * your document windows.
  2402. */
  2403. kHICommandZoomWindow = FOUR_CHAR_CODE('zoom'),
  2404. /*
  2405. * The active window should be minimized. The Window Manager will
  2406. * respond to this event automatically; your application does not
  2407. * need to handle it.
  2408. */
  2409. kHICommandMinimizeWindow = FOUR_CHAR_CODE('mini'),
  2410. /*
  2411. * All windows of the same class as the active window that have
  2412. * collapse boxes should be minimized. The Window Manager will
  2413. * respond to this event automatically; your application does not
  2414. * need to handle it.
  2415. */
  2416. kHICommandMinimizeAll = FOUR_CHAR_CODE('mina'),
  2417. /*
  2418. * The active window should be maximized. Only sent on Mac OS 9. The
  2419. * Window Manager will respond to this event automatically; your
  2420. * application does not need to handle it.
  2421. */
  2422. kHICommandMaximizeWindow = FOUR_CHAR_CODE('maxi'),
  2423. /*
  2424. * All windows of the same class as the active window that have
  2425. * collapse boxes should be maximized. The Window Manager will
  2426. * respond to this event automatically; your application does not
  2427. * need to handle it.
  2428. */
  2429. kHICommandMaximizeAll = FOUR_CHAR_CODE('maxa'),
  2430. /*
  2431. * All document-class windows should be arranged in a stack. The
  2432. * Window Manager will respond to this event automatically; your
  2433. * application does not need to handle it.
  2434. */
  2435. kHICommandArrangeInFront = FOUR_CHAR_CODE('frnt'),
  2436. /*
  2437. * All windows of this application should be brought in front of
  2438. * windows from other applications. Only sent on Mac OS X. The Window
  2439. * Manager will respond to this event automatically; your application
  2440. * does not need to handle it.
  2441. */
  2442. kHICommandBringAllToFront = FOUR_CHAR_CODE('bfrt'),
  2443. /*
  2444. * This command ID is used as a placeholder to mark the separator
  2445. * item dividing the Zoom/Minimize/Maximize/Arrange menu items in the
  2446. * standard Window menu from the menu items listing the visible
  2447. * windows. If you need to add your own menu items to the standard
  2448. * Window menu before the window list section, you can look for the
  2449. * menu item with this command ID using GetIndMenuItemWithCommandID,
  2450. * and insert your menu items before the item with this ID.
  2451. */
  2452. kHICommandWindowListSeparator = FOUR_CHAR_CODE('wldv'),
  2453. /*
  2454. * This command ID is used as a placeholder to mark the end of the
  2455. * window list section of the standard Window menu. If you need to
  2456. * add your own menu items to the standard Window menu after the
  2457. * window list section, you can look for the menu item with this
  2458. * command ID using GetIndMenuItemWithCommandID, and insert your
  2459. * items after the item with this ID.
  2460. */
  2461. kHICommandWindowListTerminator = FOUR_CHAR_CODE('wlst'),
  2462. /*
  2463. * A window in the standard Window menu has been selected and should
  2464. * be activated. The Window Manager will respond to this event
  2465. * automatically; your application does not need to handle it.
  2466. */
  2467. kHICommandSelectWindow = FOUR_CHAR_CODE('swin'),
  2468. /*
  2469. * The Rotate Windows hotkey (cmd-~ by default) has been pressed, and
  2470. * non-floating windows should be rotated so that the window after
  2471. * the active window is activated. The Window Manager will respond to
  2472. * this event automatically; your application does not need to handle
  2473. * it.
  2474. */
  2475. kHICommandRotateWindowsForward = FOUR_CHAR_CODE('rotw'),
  2476. /*
  2477. * The Rotate Windows hotkey (cmd-~ by default) has been pressed, and
  2478. * non-floating windows should be rotated so that the window before
  2479. * the active window is activated. The Window Manager will respond to
  2480. * this event automatically; your application does not need to handle
  2481. * it.
  2482. */
  2483. kHICommandRotateWindowsBackward = FOUR_CHAR_CODE('rotb'),
  2484. /*
  2485. * The floating window focus hotkey (ctl-F6 by default) has been
  2486. * pressed, and floating windows should be rotated so that the window
  2487. * after the focused window is activated. The Window Manager will
  2488. * respond to this event automatically; your application does not
  2489. * need to handle it.
  2490. */
  2491. kHICommandRotateFloatingWindowsForward = FOUR_CHAR_CODE('rtfw'),
  2492. /*
  2493. * The floating window focus hotkey (ctl-F6 by default) has been
  2494. * pressed, and floating windows should be rotated so that the window
  2495. * before the focused window is activated. The Window Manager will
  2496. * respond to this event automatically; your application does not
  2497. * need to handle it.
  2498. */
  2499. kHICommandRotateFloatingWindowsBackward = FOUR_CHAR_CODE('rtfb'),
  2500. /*
  2501. * The About menu item has been selected.
  2502. */
  2503. kHICommandAbout = FOUR_CHAR_CODE('abou'),
  2504. /*
  2505. * A new document or item should be created.
  2506. */
  2507. kHICommandNew = FOUR_CHAR_CODE('new '),
  2508. /*
  2509. * The user wants to open an existing document.
  2510. */
  2511. kHICommandOpen = FOUR_CHAR_CODE('open'),
  2512. /*
  2513. * The active window should be closed.
  2514. */
  2515. kHICommandClose = FOUR_CHAR_CODE('clos'),
  2516. /*
  2517. * The active document should be saved.
  2518. */
  2519. kHICommandSave = FOUR_CHAR_CODE('save'),
  2520. /*
  2521. * The user wants to save the active document under a new name.
  2522. */
  2523. kHICommandSaveAs = FOUR_CHAR_CODE('svas'),
  2524. /*
  2525. * The contents of the active document should be reverted to the last
  2526. * saved version.
  2527. */
  2528. kHICommandRevert = FOUR_CHAR_CODE('rvrt'),
  2529. /*
  2530. * The active window should be printed.
  2531. */
  2532. kHICommandPrint = FOUR_CHAR_CODE('prnt'),
  2533. /*
  2534. * The user wants to configure the current page margins, formatting,
  2535. * and print options.
  2536. */
  2537. kHICommandPageSetup = FOUR_CHAR_CODE('page'),
  2538. /*
  2539. * The application's help book should be displayed. Used by the Help
  2540. * Manager when it adds the "<AppName> Help" menu item to the Help
  2541. * menu. The Help Manager will respond to this event automatically;
  2542. * your application does not need to handle it.
  2543. */
  2544. kHICommandAppHelp = FOUR_CHAR_CODE('ahlp')
  2545. };
  2546. /*
  2547. * Summary:
  2548. * Values for the attributes field of the HICommand and
  2549. * HICommandExtended structures.
  2550. *
  2551. * Discussion:
  2552. * These bit masks are mutually exclusive; only one should be set at
  2553. * any given time. Some HICommand and HICommandExtended structures
  2554. * will have an attributes value of zero; in this case, there is no
  2555. * information available about the source of the command.
  2556. */
  2557. enum {
  2558. /*
  2559. * Indicates that the command originates from a menu item. The
  2560. * HICommand.menu and HICommandExtended.source.menu fields are valid.
  2561. */
  2562. kHICommandFromMenu = (1L << 0),
  2563. /*
  2564. * Indicates that the command originates from a control. The
  2565. * HICommandExtended.source.control field is valid.
  2566. */
  2567. kHICommandFromControl = (1L << 1),
  2568. /*
  2569. * Indicates that the command originates from a window. The
  2570. * HICommandExtended.source.window field is valid.
  2571. */
  2572. kHICommandFromWindow = (1L << 2)
  2573. };
  2574. struct HICommand {
  2575. UInt32 attributes;
  2576. UInt32 commandID;
  2577. struct {
  2578. MenuRef menuRef;
  2579. MenuItemIndex menuItemIndex;
  2580. } menu;
  2581. };
  2582. typedef struct HICommand HICommand;
  2583. struct HICommandExtended {
  2584. UInt32 attributes;
  2585. UInt32 commandID;
  2586. union {
  2587. ControlRef control;
  2588. WindowRef window;
  2589. struct {
  2590. MenuRef menuRef;
  2591. MenuItemIndex menuItemIndex;
  2592. } menu;
  2593. } source;
  2594. };
  2595. typedef struct HICommandExtended HICommandExtended;
  2596. /*--------------------------------------------------------------------------------------*/
  2597. /* Control Events */
  2598. /*--------------------------------------------------------------------------------------*/
  2599. /*
  2600. * Summary:
  2601. * Control events (kEventClassControl)
  2602. */
  2603. enum {
  2604. /*
  2605. * Allows the control to initialize private data.
  2606. */
  2607. kEventControlInitialize = 1000,
  2608. /*
  2609. * Allows the control to dispose of private data.
  2610. */
  2611. kEventControlDispose = 1001,
  2612. /*
  2613. * Allows the control to report its best size and its text baseline
  2614. * based on its current settings. You should set the
  2615. * kEventParamControlOptimalBounds parameter to an appropriate
  2616. * rectangle. You should also set the
  2617. * kEventParamControlOptimalBaselineOffset parameter to be the offset
  2618. * from the top of your optimal bounds of a text baseline, if any.
  2619. * (Mac OS X only)
  2620. */
  2621. kEventControlGetOptimalBounds = 1003,
  2622. kEventControlDefInitialize = kEventControlInitialize,
  2623. kEventControlDefDispose = kEventControlDispose,
  2624. /*
  2625. * Sent by TrackControl and HandleControlClick after handling a click
  2626. * in a control.
  2627. */
  2628. kEventControlHit = 1,
  2629. /*
  2630. * Sent when your control should simulate a click in response to some
  2631. * other action, such as a return key for a default button. The event
  2632. * contains the part code the control should simulate a click for.
  2633. * The control may modify this on output to reflect the same sort of
  2634. * part code it would pass back while handling kEventControlTrack.
  2635. * (Mac OS X only)
  2636. */
  2637. kEventControlSimulateHit = 2,
  2638. /*
  2639. * Sent when someone wants to find out what part of your control is
  2640. * at a given point in local coordinates. You should set the
  2641. * kEventParamControlPart parameter to the appropriate part. (Mac OS
  2642. * X only)
  2643. */
  2644. kEventControlHitTest = 3,
  2645. /*
  2646. * Sent when your control should draw itself. The event can
  2647. * optionally contain a port in which to draw and a part to constrain
  2648. * drawing to. (Mac OS X only)
  2649. */
  2650. kEventControlDraw = 4,
  2651. /*
  2652. * Sent when your control should apply its background color/pattern
  2653. * to the port specified so the subcontrol can properly erase. The
  2654. * port is optional; if it does not exist you should apply the
  2655. * background to the current port. (Mac OS X only)
  2656. */
  2657. kEventControlApplyBackground = 5,
  2658. /*
  2659. * Sent when your control should apply a color/pattern to the
  2660. * specified port and context so a subcontrol can draw text which
  2661. * looks appropriate for your control's background. The port is
  2662. * optional; if it does not exist, you should apply the text color to
  2663. * the current port. The context context is also optional. (Mac OS X
  2664. * only)
  2665. */
  2666. kEventControlApplyTextColor = 6,
  2667. /*
  2668. * Sent when your control is gaining, losing, or changing the focus.
  2669. * Set the kEventParamControlPart param to the resulting focused
  2670. * part. If the kEventParamControlFocusEverything param is present,
  2671. * use its value as an indication of whether to advance the focus
  2672. * onto a part that isn't one that accepts general keyboard input;
  2673. * regardless of the param's value, the control must always allow the
  2674. * focus to be removed. (Mac OS X only)
  2675. */
  2676. kEventControlSetFocusPart = 7,
  2677. /*
  2678. * Sent when your the Control Manager wants to know what part of your
  2679. * control is currently focused. Set the kEventParamControlPart param
  2680. * to your currently focused part. (Mac OS X only)
  2681. */
  2682. kEventControlGetFocusPart = 8,
  2683. /*
  2684. * Sent when your control becomes active as a result of a call to
  2685. * ActivateControl. (Mac OS X only)
  2686. */
  2687. kEventControlActivate = 9,
  2688. /*
  2689. * Sent when your control becomes inactive as a result of a call to
  2690. * DeactivateControl. (Mac OS X only)
  2691. */
  2692. kEventControlDeactivate = 10,
  2693. /*
  2694. * Sent when your control is asked to change the cursor as a result
  2695. * of a call to HandleControlSetCursor. (Mac OS X only)
  2696. */
  2697. kEventControlSetCursor = 11,
  2698. /*
  2699. * Sent when your control is asked to display a contextual menu as a
  2700. * result of a call to HandleControlContextualMenuClick. (Mac OS X
  2701. * only)
  2702. */
  2703. kEventControlContextualMenuClick = 12,
  2704. /*
  2705. * A mouse down occurred in a control. The standard window handler
  2706. * sets the keyboard focus to the control if it takes focus on
  2707. * clicks, and calls HandleControlClick. Available on Mac OS X and
  2708. * CarbonLib 1.3.1 and later.
  2709. */
  2710. kEventControlClick = 13,
  2711. /*
  2712. * Sent so that a given control can customize the focus order of its
  2713. * subcontrols. The recipient will receive a start subcontrol in the
  2714. * kEventParamStartControl parameter and a focusing direction in the
  2715. * kEventParamControlPart parameter. The part code stored in the
  2716. * kEventParamControlPart parameter will be one of the focusing meta
  2717. * part codes, such as kControlFocusNextPart and
  2718. * kControlFocusPrevPart. The kEventParamStartControl parameter may
  2719. * be non-existent or NULL; this is a request to find the *first*
  2720. * subcontrol in the appropriate focusing direction. The recipient
  2721. * must store the next subcontrol in the kEventParamNextControl
  2722. * parameter of the event before returning; if there is no next
  2723. * subcontrol in the given focusing direction, the recipient must
  2724. * either exclude the kEventParamNextControl parameter or set it to
  2725. * NULL. This event is sent in Mac OS X 10.2 or later.
  2726. */
  2727. kEventControlGetNextFocusCandidate = 14, /* Available in Jaguar or later*/
  2728. /*
  2729. * This event is send when we are going to autotoggle a control. You
  2730. * can specify the value use based on the current value of your
  2731. * control. This event is available in Mac OS X 10.2 or later.
  2732. */
  2733. kEventControlGetAutoToggleValue = 15, /* Available in Jaguar or later */
  2734. /*
  2735. * This is sent when the HIViewGetViewForMouseEvent API is called.
  2736. * The control manager calls it before decending into any subviews.
  2737. * Controls can override this to intercept clicks which would
  2738. * normally be destined for their children. For example, the Toolbar
  2739. * control intercepts cmd-clicks to handle dragging its children. To
  2740. * accomplish this, it overrides this event, looking for the cmd key.
  2741. * When it's down, it just returns noErr as the result from its event
  2742. * handler. This tells the control manager to stop decending and
  2743. * return the view that it called as the event target. The standard
  2744. * window handler calls GetViewForMouseEvent and then HIViewClick
  2745. * with the resultant view. This event is available in Mac OS X 10.2
  2746. * or later.
  2747. */
  2748. kEventControlInterceptSubviewClick = 16, /* Available in Jaguar or later*/
  2749. /*
  2750. * This is very much like the window class version of this event. The
  2751. * difference is that the mouse location is view-relative, and there
  2752. * is no window part code passed to you. This event is actually a
  2753. * copy of the mouse down event, and so it has all the parameters
  2754. * that such an event would have (modifiers, button number, etc.)
  2755. */
  2756. kEventControlGetClickActivation = 17, /* Available in Jaguar or later*/
  2757. /*
  2758. * A drag has entered your control. If you at all wish to handle it,
  2759. * you must return noErr from your event handler in response to this
  2760. * event. If you return eventNotHandledErr, you will not receive
  2761. * 'within' or 'leave' messages, nor will you be eligible to receive
  2762. * the drag. This is done to try to be as efficient as possible wrt
  2763. * sending events during the drag operation.
  2764. */
  2765. kEventControlDragEnter = 18, /* Available in Jaguar or later*/
  2766. /*
  2767. * A drag has moved with your airspace (but not on any subcontrol).
  2768. * If the user moves into a subcontrol, it becomes the target of the
  2769. * drag and your control will not receive 'within' messages any
  2770. * longer.
  2771. */
  2772. kEventControlDragWithin = 19, /* Available in Jaguar or later*/
  2773. /*
  2774. * A drag is leaving your view. You might want to do things like
  2775. * unhighlight yourself, etc.
  2776. */
  2777. kEventControlDragLeave = 20, /* Available in Jaguar or later*/
  2778. /*
  2779. * Congratulations, you are the lucky recipient of a drag. Enjoy it.
  2780. */
  2781. kEventControlDragReceive = 21, /* Available in Jaguar or later*/
  2782. /*
  2783. * Sent to allow your control to completely replace the normal
  2784. * tracking that is part of a call to TrackControl or
  2785. * HandleControlClick. Set the kEventParamControlPart to the part hit
  2786. * during tracking. (Mac OS X only)
  2787. */
  2788. kEventControlTrack = 51,
  2789. /*
  2790. * Sent so your control can support Scroll To Here behavior during
  2791. * tracking. Set the kEventParamMouseLocation parameter to the mouse
  2792. * location in local coordinates which represents where a click would
  2793. * have needed to be to cause your indicator to be dragged to the
  2794. * incoming mouse location. (Mac OS X only)
  2795. */
  2796. kEventControlGetScrollToHereStartPoint = 52,
  2797. /*
  2798. * Sent so your control can constrain the movement of its indicator
  2799. * during tracking. Set the kEventParamControlIndicatorDragConstraint
  2800. * parameter to the appropriate constraint. (Mac OS X only)
  2801. */
  2802. kEventControlGetIndicatorDragConstraint = 53,
  2803. /*
  2804. * Sent during live-tracking of the indicator so your control can
  2805. * update its value based on the new indicator position. During
  2806. * non-live tracking, this event lets you redraw the indicator ghost
  2807. * at the appropriate place. (Mac OS X only)
  2808. */
  2809. kEventControlIndicatorMoved = 54,
  2810. /*
  2811. * Sent at the end of non-live indicator tracking so your control can
  2812. * update its value based on the final ghost location. (Mac OS X only)
  2813. */
  2814. kEventControlGhostingFinished = 55,
  2815. /*
  2816. * Sent during tracking so your control can alter the part that is
  2817. * passed to its action proc based on modifier keys, etc. Set the
  2818. * kEventParamControlPart to the part you want to have sent. (Mac OS
  2819. * X only)
  2820. */
  2821. kEventControlGetActionProcPart = 56,
  2822. /*
  2823. * Sent when a client wants to get a particular region of your
  2824. * control. See the GetControlRegion API. The
  2825. * kEventParamControlRegion contains a region for you to modify. (Mac
  2826. * OS X only)
  2827. */
  2828. kEventControlGetPartRegion = 101,
  2829. /*
  2830. * Sent when a client wants to get a particular rectangle of your
  2831. * control when it may be more efficient than asking for a region.
  2832. * Set the kEventParamControlPartBounds parameter to the appropriate
  2833. * rectangle. (Mac OS X only)
  2834. */
  2835. kEventControlGetPartBounds = 102,
  2836. /*
  2837. * Sent when a client wants to change an arbitrary setting of your
  2838. * control. See the SetControlData API. (Mac OS X only)
  2839. */
  2840. kEventControlSetData = 103,
  2841. /*
  2842. * Sent when a client wants to get an arbitrary setting of your
  2843. * control. See the GetControlData API. (Mac OS X only)
  2844. */
  2845. kEventControlGetData = 104,
  2846. /*
  2847. * This event is sent when the HIViewGetSizeConstraints API is
  2848. * called. It allows your custom control/view to specify its minimum
  2849. * and maximum size. This is different from the optimal size event
  2850. * above. The optimal size might be larger than a view's minimum
  2851. * size. A parent view can use this information to help it lay out
  2852. * subviews. The toolbar control uses this information to help lay
  2853. * out toolbar items, for example.
  2854. */
  2855. kEventControlGetSizeConstraints = 105, /* Available in Jaguar or later*/
  2856. /*
  2857. * Sent when your control's value, min, max, or view size has
  2858. * changed. Useful so other entities can watch for your control's
  2859. * value to change. (Mac OS X only)
  2860. */
  2861. kEventControlValueFieldChanged = 151,
  2862. /*
  2863. * Sent when a control was embedded within your control. (Mac OS X
  2864. * only)
  2865. */
  2866. kEventControlAddedSubControl = 152,
  2867. /*
  2868. * Sent when one of your child controls will be removed from your
  2869. * control. (Mac OS X only)
  2870. */
  2871. kEventControlRemovingSubControl = 153,
  2872. /*
  2873. * Sent when one your control's bounding rectangle has changed. (Mac
  2874. * OS X only)
  2875. */
  2876. kEventControlBoundsChanged = 154,
  2877. /*
  2878. * Sent when the title of your control changes. Available in Mac OS X
  2879. * 10.2 or later.
  2880. */
  2881. kEventControlTitleChanged = 158, /* Available in Jaguar or later*/
  2882. /*
  2883. * Sent when one your control's owning window has changed. Useful to
  2884. * udpate any dependencies that your control has on its owning
  2885. * window. (Mac OS X only)
  2886. */
  2887. kEventControlOwningWindowChanged = 159,
  2888. /*
  2889. * Sent when the hilite state changes in a control. This is here to
  2890. * support custom views/controls which need to update information
  2891. * when the hilite state changes. This event is available in Mac OS X
  2892. * 10.2 or later.
  2893. */
  2894. kEventControlHiliteChanged = 160, /* Available in Jaguar or later*/
  2895. /*
  2896. * Sent when the enabled state changes in a control. This is here to
  2897. * support custom views/controls which need to update information
  2898. * when the enabled state changes. This event is available in Mac OS
  2899. * X 10.2 or later.
  2900. */
  2901. kEventControlEnabledStateChanged = 161, /* Available in Jaguar or later*/
  2902. /*
  2903. * Sent when someone is trying to send an old-style CDEF message to
  2904. * your control. (Mac OS X only)
  2905. */
  2906. kEventControlArbitraryMessage = 201
  2907. };
  2908. /*
  2909. * Summary:
  2910. * Control bounds change event attributes
  2911. *
  2912. * Discussion:
  2913. * When the toolbox sends out a kEventControlBoundsChanged event, it
  2914. * also sends along a parameter containing attributes of the event.
  2915. * These attributes can be used to determine what aspect of the
  2916. * control changed (position, size, or both).
  2917. */
  2918. enum {
  2919. /*
  2920. * The dimensions of the control (width and height) changed.
  2921. */
  2922. kControlBoundsChangeSizeChanged = (1 << 2),
  2923. /*
  2924. * The top left corner (position) changed.
  2925. */
  2926. kControlBoundsChangePositionChanged = (1 << 3)
  2927. };
  2928. /*
  2929. Parameters for control events:
  2930. kEventControlInitialize
  2931. --> kEventParamDirectObject typeControlRef
  2932. --> kEventParamInitCollection typeCollection
  2933. <-- kEventParamControlFeatures typeUInt32
  2934. kEventControlDispose
  2935. --> kEventParamDirectObject typeControlRef
  2936. kEventControlGetOptimalBounds
  2937. Required parameters:
  2938. --> kEventParamDirectObject typeControlRef
  2939. <-- kEventParamControlOptimalBounds typeQDRectangle
  2940. Optional parameters:
  2941. <-- kEventParamControlOptimalBaselineOffset typeShortInteger (optional)
  2942. kEventControlHit
  2943. --> kEventParamDirectObject typeControlRef
  2944. --> kEventParamControlPart typeControlPartCode
  2945. --> kEventParamKeyModifiers typeUInt32
  2946. kEventControlSimulateHit
  2947. --> kEventParamDirectObject typeControlRef
  2948. <-> kEventParamKeyModifiers typeUInt32
  2949. <-> kEventParamControlPart typeControlPartCode
  2950. kEventControlHitTest
  2951. --> kEventParamDirectObject typeControlRef
  2952. --> kEventParamMouseLocation typeQDPoint
  2953. <-- kEventParamControlPart typeControlPartCode
  2954. kEventControlDraw
  2955. Required parameters:
  2956. --> kEventParamDirectObject typeControlRef
  2957. Optional parameters:
  2958. --> kEventParamControlPart typeControlPartCode
  2959. (draw the entire control if kEventParamControlPart is not present)
  2960. --> kEventParamGrafPort typeGrafPtr
  2961. (draw into the current port if kEventParamGrafPort is not present)
  2962. --> kEventParamRgnHandle typeQDRgnHandle
  2963. Sent only on Jaguar and in certain situations in compositing mode
  2964. (when view is visible, etc.) Allows you to constrain your drawing
  2965. to the region the Toolbox has clipped you to.
  2966. --> kEventParamCGContextRef typeCGContextRef
  2967. Sent to your control when in compositing mode. It is already
  2968. transformed and clipped appropriately. You should use this instead
  2969. of creating your own CGContext. This will be extremely important
  2970. for printing, etc.
  2971. kEventControlApplyBackground
  2972. Required parameters:
  2973. --> kEventParamDirectObject typeControlRef
  2974. --> kEventParamControlSubControl typeControlRef
  2975. --> kEventParamControlDrawDepth typeShortInteger
  2976. --> kEventParamControlDrawInColor typeBoolean
  2977. Optional parameters:
  2978. --> kEventParamGrafPort typeGrafPtr
  2979. (apply to the current port if kEventParamGrafPort is not present)
  2980. kEventControlApplyTextColor
  2981. Required parameters:
  2982. --> kEventParamDirectObject typeControlRef
  2983. --> kEventParamControlSubControl typeControlRef
  2984. --> kEventParamControlDrawDepth typeShortInteger
  2985. --> kEventParamControlDrawInColor typeBoolean
  2986. Optional parameters:
  2987. --> kEventParamCGContextRef typeCGContextRef
  2988. --> kEventParamGrafPort typeGrafPtr
  2989. (apply to the current port if kEventParamGrafPort is not present)
  2990. kEventControlGetNextFocusCandidate
  2991. Required parameters:
  2992. --> kEventParamControlPart typeControlPartCode
  2993. <-- kEventParamNextControl typeControlRef
  2994. Optional parameters:
  2995. --> kEventParamStartControl typeControlRef
  2996. (find the first/last subcontrol of yourself if kEventParamStartControl is not present)
  2997. kEventControlGetAutoToggleValue:
  2998. --> kEventParamDirectObject typeControlRef
  2999. --> kEventParamControlPart typeControlPartCode
  3000. <-- kEventParamControlValue typeLongInteger
  3001. kEventControlInterceptSubviewClick
  3002. --> kEventParamEventRef typeEventRef
  3003. kEventControlGetClickActivation
  3004. This event is a copy of the actual mouse down event. The only
  3005. difference is the mouse location parameter is in view coordinates,
  3006. and there is a direct object parameter which is the control ref.
  3007. For mouse down event parameters, see the kEventMouseDown comments.
  3008. <-- kEventParamClickActivation typeClickActivationResult
  3009. kEventControlDragEnter
  3010. --> kEventParamDirectObject typeControlRef
  3011. --> kEventParamDragRef typeDragRef
  3012. kEventControlDragWithin
  3013. --> kEventParamDirectObject typeControlRef
  3014. --> kEventParamDragRef typeDragRef
  3015. kEventControlDragLeave
  3016. --> kEventParamDirectObject typeControlRef
  3017. --> kEventParamDragRef typeDragRef
  3018. kEventControlDragReceive
  3019. --> kEventParamDirectObject typeControlRef
  3020. --> kEventParamDragRef typeDragRef
  3021. kEventControlSetFocusPart
  3022. Required parameters:
  3023. --> kEventParamDirectObject typeControlRef
  3024. <-> kEventParamControlPart typeControlPartCode
  3025. Optional parameters:
  3026. --> kEventParamControlFocusEverything typeBoolean
  3027. kEventControlGetFocusPart
  3028. --> kEventParamDirectObject typeControlRef
  3029. <-- kEventParamControlPart typeControlPartCode
  3030. kEventControlActivate
  3031. --> kEventParamDirectObject typeControlRef
  3032. kEventControlDeactivate
  3033. --> kEventParamDirectObject typeControlRef
  3034. kEventControlSetCursor
  3035. --> kEventParamDirectObject typeControlRef
  3036. --> kEventParamMouseLocation typeQDPoint
  3037. --> kEventParamKeyModifiers typeUInt32
  3038. kEventControlContextualMenuClick
  3039. --> kEventParamDirectObject typeControlRef
  3040. --> kEventParamMouseLocation typeQDPoint
  3041. kEventControlClick
  3042. --> kEventParamDirectObject typeControlRef
  3043. --> [other parameters from kEventMouseDown]
  3044. kEventControlTrack
  3045. --> kEventParamDirectObject typeControlRef
  3046. --> kEventParamMouseLocation typeQDPoint
  3047. <-> kEventParamKeyModifiers typeUInt32
  3048. --> kEventParamControlAction typeControlActionUPP
  3049. <-- kEventParamControlPart typeControlPartCode
  3050. kEventControlGetScrollToHereStartPoint
  3051. --> kEventParamDirectObject typeControlRef
  3052. <-> kEventParamMouseLocation typeQDPoint
  3053. --> kEventParamKeyModifiers typeUInt32
  3054. kEventControlGetIndicatorDragConstraint
  3055. --> kEventParamDirectObject typeControlRef
  3056. --> kEventParamMouseLocation typeQDPoint
  3057. --> kEventParamKeyModifiers typeUInt32
  3058. <-- kEventParamControlIndicatorDragConstraint typeIndicatorDragConstraint
  3059. kEventControlIndicatorMoved
  3060. --> kEventParamDirectObject typeControlRef
  3061. --> kEventParamControlIndicatorRegion typeQDRgnHandle
  3062. --> kEventParamControlIsGhosting typeBoolean
  3063. kEventControlGhostingFinished
  3064. --> kEventParamDirectObject typeControlRef
  3065. --> kEventParamControlIndicatorOffset typeQDPoint
  3066. kEventControlGetActionProcPart
  3067. --> kEventParamDirectObject typeControlRef
  3068. --> kEventParamKeyModifiers typeUInt32
  3069. <-> kEventParamControlPart typeControlPartCode
  3070. kEventControlGetPartRegion
  3071. --> kEventParamDirectObject typeControlRef
  3072. --> kEventParamControlPart typeControlPartCode
  3073. --> kEventParamControlRegion typeQDRgnHandle
  3074. kEventControlGetPartBounds
  3075. --> kEventParamDirectObject typeControlRef
  3076. --> kEventParamControlPart typeControlPartCode
  3077. <-- kEventParamControlPartBounds typeQDRectangle
  3078. kEventControlSetData
  3079. --> kEventParamDirectObject typeControlRef
  3080. --> kEventParamControlPart typeControlPartCode
  3081. --> kEventParamControlDataTag typeEnumeration
  3082. --> kEventParamControlDataBuffer typePtr
  3083. --> kEventParamControlDataBufferSize typeLongInteger
  3084. kEventControlGetData
  3085. --> kEventParamDirectObject typeControlRef
  3086. --> kEventParamControlPart typeControlPartCode
  3087. --> kEventParamControlDataTag typeEnumeration
  3088. --> kEventParamControlDataBuffer typePtr
  3089. <-> kEventParamControlDataBufferSize typeLongInteger
  3090. kEventControlGetSizeConstraints
  3091. --> kEventParamDirectObject typeControlRef
  3092. <-- kEventParamMinimumSize typeHISize
  3093. <-- kEventParamMaximumSize typeHISize
  3094. kEventControlValueFieldChanged
  3095. --> kEventParamDirectObject typeControlRef
  3096. kEventControlAddedSubControl
  3097. --> kEventParamDirectObject typeControlRef
  3098. --> kEventParamControlSubControl typeControlRef
  3099. kEventControlRemovingSubControl
  3100. --> kEventParamDirectObject typeControlRef
  3101. --> kEventParamControlSubControl typeControlRef
  3102. kEventControlBoundsChanged
  3103. --> kEventParamDirectObject typeControlRef
  3104. --> kEventParamAttributes typeUInt32
  3105. --> kEventParamOriginalBounds typeQDRectangle
  3106. --> kEventParamPreviousBounds typeQDRectangle
  3107. --> kEventParamCurrentBounds typeQDRectangle
  3108. kEventControlTitleChanged
  3109. --> kEventParamDirectObject typeControlRef
  3110. kEventControlOwningWindowChanged
  3111. --> kEventParamDirectObject typeControlRef
  3112. --> kEventParamAttributes typeUInt32
  3113. --> kEventParamControlOriginalOwningWindow typeWindowRef
  3114. --> kEventParamControlCurrentOwningWindow typeWindowRef
  3115. kEventControlHiliteStateChanged
  3116. --> kEventParamDirectObject typeControlRef
  3117. --> kEventParamControlPreviousPart typeControlPartCode
  3118. --> kEventParamControlCurrentPart typeControlPartCode
  3119. kEventControlEnabledStateChanged
  3120. --> kEventParamDirectObject typeControlRef
  3121. kEventControlArbitraryMessage
  3122. --> kEventParamDirectObject typeControlRef
  3123. --> kEventParamControlMessage typeShortInteger
  3124. --> kEventParamControlParam typeLongInteger
  3125. <-- kEventParamControlResult typeLongInteger
  3126. */
  3127. /*--------------------------------------------------------------------------------------*/
  3128. /* Tablet Events (and tablet data in mouse events) */
  3129. /*--------------------------------------------------------------------------------------*/
  3130. /*
  3131. * Summary:
  3132. * Tablet events (kEventClassTablet)
  3133. */
  3134. enum {
  3135. /*
  3136. * Indicates that the pen has moved on or near a tablet. Same as
  3137. * deprecated kEventTabletPointer. Available in Mac OS X only.
  3138. */
  3139. kEventTabletPoint = 1,
  3140. /*
  3141. * Indicates that the pen has entered or exited proximity of a
  3142. * tablet. Available in Mac OS X only.
  3143. */
  3144. kEventTabletProximity = 2,
  3145. kEventTabletPointer = 1 /* deprecated form for compatibility only, use kEventTabletPoint*/
  3146. };
  3147. struct TabletPointRec {
  3148. SInt32 absX; /* absolute x coordinate in tablet space at full tablet resolution */
  3149. SInt32 absY; /* absolute y coordinate in tablet space at full tablet resolution */
  3150. SInt32 absZ; /* absolute z coordinate in tablet space at full tablet resolution */
  3151. UInt16 buttons; /* one bit per button - bit 0 is first button - 1 = closed */
  3152. UInt16 pressure; /* scaled pressure value; MAXPRESSURE=(2^16)-1, MINPRESSURE=0 */
  3153. SInt16 tiltX; /* scaled tilt x value; range is -((2^15)-1) to (2^15)-1 (-32767 to 32767) */
  3154. SInt16 tiltY; /* scaled tilt y value; range is -((2^15)-1) to (2^15)-1 (-32767 to 32767) */
  3155. UInt16 rotation; /* Fixed-point representation of device rotation in a 10.6 format */
  3156. SInt16 tangentialPressure; /* tangential pressure on the device; range same as tilt */
  3157. UInt16 deviceID; /* system-assigned unique device ID - matches to deviceID field in proximity event */
  3158. SInt16 vendor1; /* vendor-defined signed 16-bit integer */
  3159. SInt16 vendor2; /* vendor-defined signed 16-bit integer */
  3160. SInt16 vendor3; /* vendor-defined signed 16-bit integer */
  3161. };
  3162. typedef struct TabletPointRec TabletPointRec;
  3163. typedef TabletPointRec TabletPointerRec;
  3164. struct TabletProximityRec {
  3165. UInt16 vendorID; /* vendor-defined ID - typically will be USB vendor ID */
  3166. UInt16 tabletID; /* vendor-defined tablet ID - typically will be USB product ID for the tablet */
  3167. UInt16 pointerID; /* vendor-defined ID of the specific pointing device */
  3168. UInt16 deviceID; /* system-assigned unique device ID - matches to deviceID field in tablet event */
  3169. UInt16 systemTabletID; /* system-assigned unique tablet ID */
  3170. UInt16 vendorPointerType; /* vendor-defined pointer type */
  3171. UInt32 pointerSerialNumber; /* vendor-defined serial number of the specific pointing device */
  3172. UInt64 uniqueID; /* vendor-defined unique ID for this pointer */
  3173. UInt32 capabilityMask; /* mask representing the capabilities of the device */
  3174. UInt8 pointerType; /* type of pointing device - enum to be defined */
  3175. UInt8 enterProximity; /* non-zero = entering; zero = leaving */
  3176. };
  3177. typedef struct TabletProximityRec TabletProximityRec;
  3178. /*--------------------------------------------------------------------------------------*/
  3179. /* Volume Events */
  3180. /*--------------------------------------------------------------------------------------*/
  3181. /*
  3182. * Summary:
  3183. * Volume events (kEventClassVolume)
  3184. */
  3185. enum {
  3186. /*
  3187. * A new volume has been mounted (or new media inserted). Available
  3188. * on Mac OS X and CarbonLib 1.3.1 and later.
  3189. */
  3190. kEventVolumeMounted = 1, /* new volume mounted*/
  3191. /*
  3192. * An existing volume has been unmounted (or media ejected).
  3193. * Available on Mac OS X and CarbonLib 1.3.1 and later.
  3194. */
  3195. kEventVolumeUnmounted = 2 /* volume has been ejected or unmounted*/
  3196. };
  3197. /*
  3198. Parameters for volume events:
  3199. kEventVolumeMounted
  3200. --> kEventParamDirectObject typeFSVolumeRefNum
  3201. kEventVolumeUnmounted
  3202. --> kEventParamDirectObject typeFSVolumeRefNum
  3203. */
  3204. /* types for volume events*/
  3205. enum {
  3206. typeFSVolumeRefNum = FOUR_CHAR_CODE('voln') /* FSVolumeRefNum*/
  3207. };
  3208. /*--------------------------------------------------------------------------------------*/
  3209. /* Appearance Events */
  3210. /*--------------------------------------------------------------------------------------*/
  3211. /* Appearance Events */
  3212. /*
  3213. * Discussion:
  3214. * Appearance events (kEventClassAppearance)
  3215. */
  3216. enum {
  3217. /*
  3218. * The scroll bar variant has changed. Available on Mac OS X 10.1 and
  3219. * later.
  3220. */
  3221. kEventAppearanceScrollBarVariantChanged = 1
  3222. };
  3223. /*
  3224. Parameters for appearance events:
  3225. kEventAppearanceScrollBarVariantChanged
  3226. --> kEventParamNewScrollBarVariant typeShortInteger
  3227. */
  3228. /*--------------------------------------------------------------------------------------*/
  3229. /* Services Events */
  3230. /*--------------------------------------------------------------------------------------*/
  3231. /*
  3232. * Summary:
  3233. * Services events (kEventClassService)
  3234. *
  3235. * Discussion:
  3236. * Services are a feature by which applications can communicate with
  3237. * one another to request and provide services. This communication
  3238. * happens through the Scrap Manager. When an event is sent that
  3239. * requires communication for processing or servicing a request, you
  3240. * will need to use the scrap that is given in the
  3241. * kEventParamScrapRef parameter of the event in order to
  3242. * communicate. When your app requests a service, it is usually
  3243. * acting on data that is currently selected or in focus. Therefore
  3244. * all of the Services events are sent to the UserFocus event
  3245. * target.
  3246. * Service events are available on Mac OS X 10.1 and later.
  3247. */
  3248. enum {
  3249. /*
  3250. * The user has invoked a service that requires the application to
  3251. * update the given scrap in the kEventParamScrapRef parameter with
  3252. * appropriate data from the focus.
  3253. */
  3254. kEventServiceCopy = 1,
  3255. /*
  3256. * The user has invoked a service that requires the application to
  3257. * update the current focus with data from the scrap that is given in
  3258. * the kEventParamScrapRef parameter.
  3259. */
  3260. kEventServicePaste = 2,
  3261. /*
  3262. * The Services Manager needs to know what types of data the
  3263. * application can copy and paste to and from the scrap in order to
  3264. * update the Services menu to enable items that the user can select.
  3265. * This event sends two CFMutableArrayRefs for the application to add
  3266. * the types to: the kEventParamServiceCopyTypes and the
  3267. * kEventParamServicePasteTypes parameters. The types that are added
  3268. * are CFStringRefs. There is a convenience function,
  3269. * CreateTypeStringWithOSType(), which takes an OSType and will
  3270. * create a CFStringRef that you can add to the array(s).
  3271. */
  3272. kEventServiceGetTypes = 3,
  3273. /*
  3274. * If the application is a service provider, this event will get sent
  3275. * when a Service is requested of the app. The scrap that should be
  3276. * used to send and receive data from the requester is provided in
  3277. * the kEventParamScrapRef parameter. The
  3278. * kEventParamServiceMessageName parameter contains a CFStringRef
  3279. * that indicates which advertised service was invoked.
  3280. */
  3281. kEventServicePerform = 4
  3282. };
  3283. /*
  3284. Parameters for service events:
  3285. kEventServiceCopy
  3286. --> kEventParamScrapRef typeScrapRef
  3287. kEventServicePaste
  3288. --> kEventParamScrapRef typeScrapRef
  3289. kEventServiceGetTypes
  3290. --> kEventParamServiceCopyTypes typeCFMutableArrayRef of CFStringRefs
  3291. --> kEventParamServicePasteTypes typeCFMutableArrayRef of CFStringRefs
  3292. kEventServicePerform
  3293. --> kEventParamScrapRef typeScrapRef
  3294. --> kEventParamServiceMessageName typeCFStringRef
  3295. --> kEventParamServiceUserData typeCFStringRef
  3296. */
  3297. /*
  3298. * CreateTypeStringWithOSType()
  3299. *
  3300. * Discussion:
  3301. * This routine is used to convert an OSType to a CFStringRef that
  3302. * Services will understand.
  3303. *
  3304. * Parameters:
  3305. *
  3306. * inType:
  3307. * The OSType that needs to be converted to a CFString.
  3308. *
  3309. * Result:
  3310. * A CFStringRef that contains the string that corresponds to the
  3311. * given OSType. This follows CoreFoundation semantics in that it
  3312. * will return NULL for failure, and because it is a "Create"
  3313. * function you will need to CFRelease() this string when it is no
  3314. * longer needed.
  3315. *
  3316. * Availability:
  3317. * Non-Carbon CFM: not available
  3318. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
  3319. * Mac OS X: in version 10.1 and later
  3320. */
  3321. EXTERN_API( CFStringRef )
  3322. CreateTypeStringWithOSType(OSType inType);
  3323. /*--------------------------------------------------------------------------------------*/
  3324. /* Accessibility Events */
  3325. /*--------------------------------------------------------------------------------------*/
  3326. /*
  3327. * Discussion:
  3328. * Accessibility events (kEventClassAccessibility)
  3329. */
  3330. enum {
  3331. /*
  3332. * The kEventParamMouseLocation parameter will contain a global
  3333. * point. Find the child of yourself which is underneath that point
  3334. * and return it in the kEventParamAccessibleChild parameter. If
  3335. * there is no child at the given point, you should still return
  3336. * noErr, but leave the parameter empty. Only return immediate
  3337. * children; do not return grandchildren of yourself.
  3338. */
  3339. kEventAccessibleGetChildAtPoint = 1,
  3340. /*
  3341. * Find the child of yourself which is part of the focus chain and
  3342. * return it in the kEventParamAccessibleChild parameter. If there is
  3343. * no child in the focus chain, you should still return noErr, but
  3344. * leave the parameter empty. Only return immediate children; do not
  3345. * return grandchildren of yourself.
  3346. */
  3347. kEventAccessibleGetFocusedChild = 2,
  3348. /*
  3349. * The kEventParamAccessibleAttributeNames parameter will contain a
  3350. * CFMutableArrayRef. Add each of the attribute names you support to
  3351. * this array in the form of a CFStringRef.
  3352. */
  3353. kEventAccessibleGetAllAttributeNames = 21,
  3354. /*
  3355. * The kEventParamAccessibleAttributeName parameter will contain an
  3356. * attribute name in the form of a CFStringRef. If you support the
  3357. * named attribute, return the attribute's value in the
  3358. * kEventParamAccessibleAttributeValue parameter.
  3359. */
  3360. kEventAccessibleGetNamedAttribute = 22,
  3361. /*
  3362. * The kEventParamAccessibleAttributeName parameter will contain an
  3363. * attribute name in the form of a CFStringRef. The
  3364. * kEventParamAccessibleAttributeValue parameter will contain data in
  3365. * an arbitrary format. If you support the named attribute, set the
  3366. * named attribute's value to the data provided in the event.
  3367. */
  3368. kEventAccessibleSetNamedAttribute = 23,
  3369. /*
  3370. * The kEventParamAccessibleAttributeName parameter will contain an
  3371. * attribute name in the form of a CFStringRef. If you support the
  3372. * named attribute, set the kEventParamAccessibleAttributeSettable
  3373. * attribute to a Boolean indicating whether the named attribute can
  3374. * have its value changed via the kEventAccessibleSetNamedAttribute
  3375. * event.
  3376. */
  3377. kEventAccessibleIsNamedAttributeSettable = 24,
  3378. /*
  3379. * The kEventParamAccessibleActionNames parameter will contain a
  3380. * CFMutableArrayRef. Add each of the action names you support to
  3381. * this array in the form of a CFStringRef.
  3382. */
  3383. kEventAccessibleGetAllActionNames = 41,
  3384. /*
  3385. * The kEventParamAccessibleActionName parameter will contain an
  3386. * attribute name in the form of a CFStringRef. If you support the
  3387. * named action, perform the action.
  3388. */
  3389. kEventAccessiblePerformNamedAction = 42,
  3390. /*
  3391. * The kEventParamAccessibleActionName parameter will contain an
  3392. * attribute name in the form of a CFStringRef. The
  3393. * kEventParamAccessibleActionDescription parameter will contain a
  3394. * CFMutableStringRef. If you support the named action, alter the
  3395. * mutable string to contain a textual description of the action's
  3396. * significance.
  3397. */
  3398. kEventAccessibleGetNamedActionDescription = 44
  3399. };
  3400. /*
  3401. Parameters for Accessibility events:
  3402. kEventAccessibleGetChildAtPoint
  3403. --> kEventParamAccessibleObject typeCFTypeRef with an AXUIElementRef
  3404. --> kEventParamMouseLocation typeHIPoint
  3405. <-- kEventParamAccessibleChild typeCFTypeRef with an AXUIElementRef
  3406. kEventAccessibleGetFocusedChild
  3407. --> kEventParamAccessibleObject typeCFTypeRef with an AXUIElementRef
  3408. <-- kEventParamAccessibleChild typeCFTypeRef with an AXUIElementRef
  3409. kEventAccessibleGetAllAttributeNames
  3410. --> kEventParamAccessibleObject typeCFTypeRef with an AXUIElementRef
  3411. <-> kEventParamAccessibleAttributeNames typeCFMutableArrayRef
  3412. kEventAccessibleGetNamedAttribute
  3413. --> kEventParamAccessibleObject typeCFTypeRef with an AXUIElementRef
  3414. --> kEventParamAccessibleAttributeName typeCFStringRef
  3415. <-- kEventParamAccessibleAttributeValue variable
  3416. kEventAccessibleSetNamedAttribute
  3417. --> kEventParamAccessibleObject typeCFTypeRef with an AXUIElementRef
  3418. --> kEventParamAccessibleAttributeName typeCFStringRef
  3419. --> kEventParamAccessibleAttributeValue variable
  3420. kEventAccessibleIsNamedAttributeSettable
  3421. --> kEventParamAccessibleObject typeCFTypeRef with an AXUIElementRef
  3422. --> kEventParamAccessibleAttributeName typeCFStringRef
  3423. <-- kEventParamAccessibleAttributeSettable typeBoolean
  3424. kEventAccessibleGetAllActionNames
  3425. --> kEventParamAccessibleObject typeCFTypeRef with an AXUIElementRef
  3426. <-> kEventParamAccessibleActionNames typeCFMutableArrayRef
  3427. kEventAccessiblePerformNamedAction
  3428. --> kEventParamAccessibleObject typeCFTypeRef with an AXUIElementRef
  3429. --> kEventParamAccessibleActionName typeCFStringRef
  3430. kEventAccessibleGetNamedActionDescription
  3431. --> kEventParamAccessibleObject typeCFTypeRef with an AXUIElementRef
  3432. --> kEventParamAccessibleActionName typeCFStringRef
  3433. <-> kEventParamAccessibleActionDescription typeCFMutableStringRef
  3434. */
  3435. typedef struct __AXUIElement* AXUIElementRef;
  3436. /*
  3437. * AXUIElementCreateWithHIObjectAndIdentifier()
  3438. *
  3439. * Discussion:
  3440. * This routine creates an AXUIElementRef to represent an accessible
  3441. * object for a Carbon application. A Carbon accessible object is
  3442. * comprised of an HIObjectRef and a 64-bit identifier. The
  3443. * resulting AXUIElementRef is a CFTypeRef, and must be managed as
  3444. * such.
  3445. *
  3446. * Parameters:
  3447. *
  3448. * inHIObject:
  3449. * The HIObjectRef of the accessible object.
  3450. *
  3451. * inIdentifier:
  3452. * The 64-bit identifier of the accessible object.
  3453. *
  3454. * Result:
  3455. * An AXUIElementRef that represents the Carbon accessible object
  3456. * identified by the given HIObjectRef and 64-bit identifier. This
  3457. * follows CoreFoundation semantics in that it will return NULL for
  3458. * failure, and because it is a "Create" function you will need to
  3459. * CFRelease() this AXUIElementRef when it is no longer needed.
  3460. *
  3461. * Availability:
  3462. * Non-Carbon CFM: not available
  3463. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  3464. * Mac OS X: in version 10.2 and later
  3465. */
  3466. EXTERN_API_C( AXUIElementRef )
  3467. AXUIElementCreateWithHIObjectAndIdentifier(
  3468. HIObjectRef inHIObject,
  3469. UInt64 inIdentifier);
  3470. /*
  3471. * AXUIElementGetHIObject()
  3472. *
  3473. * Discussion:
  3474. * If the incoming AXUIElementRef is a Carbon accessible object,
  3475. * this routine will return the HIObjectRef of the accessible object.
  3476. *
  3477. * Parameters:
  3478. *
  3479. * inUIElement:
  3480. * The AXUIElementRef of whom you'd like to get the HIObjectRef.
  3481. *
  3482. * Result:
  3483. * The HIObjectRef of the AXUIElementRef. If the incoming
  3484. * AXUIElementRef is not a Carbon accessible object, this routine
  3485. * will return NULL.
  3486. *
  3487. * Availability:
  3488. * Non-Carbon CFM: not available
  3489. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  3490. * Mac OS X: in version 10.2 and later
  3491. */
  3492. EXTERN_API_C( HIObjectRef )
  3493. AXUIElementGetHIObject(AXUIElementRef inUIElement);
  3494. /*
  3495. * AXUIElementGetIdentifier()
  3496. *
  3497. * Discussion:
  3498. * If the incoming AXUIElementRef is a Carbon accessible object,
  3499. * this routine will pass back the 64-bit identifier of the
  3500. * accessible object.
  3501. *
  3502. * Parameters:
  3503. *
  3504. * inUIElement:
  3505. * The AXUIElementRef of whom you'd like to get the 64-bit
  3506. * identifier.
  3507. *
  3508. * outIdentifier:
  3509. * The 64-bit identifier of the AXUIElementRef. If the incoming
  3510. * AXUIElementRef is not a Carbon accessible object, this routine
  3511. * will pass back zero. Note that zero is often a legal value for
  3512. * Carbon accessible object, so do not assume that the accessible
  3513. * object is not a Carbon accessible object just because you get a
  3514. * result of zero.
  3515. *
  3516. * Availability:
  3517. * Non-Carbon CFM: not available
  3518. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  3519. * Mac OS X: in version 10.2 and later
  3520. */
  3521. EXTERN_API_C( void )
  3522. AXUIElementGetIdentifier(
  3523. AXUIElementRef inUIElement,
  3524. UInt64 * outIdentifier);
  3525. /*
  3526. * AXNotificationHIObjectNotify()
  3527. *
  3528. * Discussion:
  3529. * Posts a notification for the given pseudo-AXUIElementRef. Though
  3530. * an actual AXUIElementRef is not actually passed in to this
  3531. * function, its component parts are. This saves the implementation
  3532. * the hassle of dismantling the AXUIElementRef into its component
  3533. * parts.
  3534. *
  3535. * Parameters:
  3536. *
  3537. * inNotification:
  3538. * The notification name string.
  3539. *
  3540. * inHIObject:
  3541. * The HIObjectRef component of the AXUIElementRef to whom the
  3542. * notification applies.
  3543. *
  3544. * inIdentifier:
  3545. * The 64-bit identifier component of the AXUIElementRef to whom
  3546. * the notification applies.
  3547. *
  3548. * Availability:
  3549. * Non-Carbon CFM: not available
  3550. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  3551. * Mac OS X: in version 10.2 and later
  3552. */
  3553. EXTERN_API_C( void )
  3554. AXNotificationHIObjectNotify(
  3555. CFStringRef inNotification,
  3556. HIObjectRef inHIObject,
  3557. UInt64 inIdentifier);
  3558. /*--------------------------------------------------------------------------------------*/
  3559. /* Parameter names and types */
  3560. /*--------------------------------------------------------------------------------------*/
  3561. enum {
  3562. kEventParamDirectObject = FOUR_CHAR_CODE('----') /* type varies depending on event*/
  3563. };
  3564. /*
  3565. */
  3566. enum {
  3567. /*
  3568. * This event parameter may be added to any event that is posted to
  3569. * the main event queue. When the event is removed from the queue and
  3570. * sent to the event dispatcher, the dispatcher will retrieve the
  3571. * EventTargetRef contained in this parameter and send the event
  3572. * directly to that event target. If this parameter is not available
  3573. * in the event, the dispatcher will send the event to a suitable
  3574. * target, or to the application target if no more specific target is
  3575. * appropriate. Available in CarbonLib 1.3.1 and later, and Mac OS X.
  3576. */
  3577. kEventParamPostTarget = FOUR_CHAR_CODE('ptrg'), /* typeEventTargetRef*/
  3578. /*
  3579. * Indicates an event parameter of type EventTargetRef.
  3580. */
  3581. typeEventTargetRef = FOUR_CHAR_CODE('etrg') /* EventTargetRef*/
  3582. };
  3583. /* Generic toolbox parameters and types*/
  3584. enum {
  3585. kEventParamWindowRef = FOUR_CHAR_CODE('wind'), /* typeWindowRef*/
  3586. kEventParamGrafPort = FOUR_CHAR_CODE('graf'), /* typeGrafPtr*/
  3587. kEventParamDragRef = FOUR_CHAR_CODE('drag'), /* typeDragRef*/
  3588. kEventParamMenuRef = FOUR_CHAR_CODE('menu'), /* typeMenuRef*/
  3589. kEventParamEventRef = FOUR_CHAR_CODE('evnt'), /* typeEventRef*/
  3590. kEventParamControlRef = FOUR_CHAR_CODE('ctrl'), /* typeControlRef*/
  3591. kEventParamRgnHandle = FOUR_CHAR_CODE('rgnh'), /* typeQDRgnHandle*/
  3592. kEventParamEnabled = FOUR_CHAR_CODE('enab'), /* typeBoolean*/
  3593. kEventParamDimensions = FOUR_CHAR_CODE('dims'), /* typeQDPoint*/
  3594. kEventParamAvailableBounds = FOUR_CHAR_CODE('avlb'), /* typeQDRectangle*/
  3595. kEventParamAEEventID = keyAEEventID, /* typeType*/
  3596. kEventParamAEEventClass = keyAEEventClass, /* typeType*/
  3597. kEventParamCGContextRef = FOUR_CHAR_CODE('cntx'), /* typeCGContextRef*/
  3598. kEventParamDeviceDepth = FOUR_CHAR_CODE('devd'), /* typeShortInteger*/
  3599. kEventParamDeviceColor = FOUR_CHAR_CODE('devc'), /* typeBoolean*/
  3600. kEventParamMutableArray = FOUR_CHAR_CODE('marr'), /* typeCFMutableArrayRef*/
  3601. kEventParamResult = FOUR_CHAR_CODE('ansr'), /* any type - depends on event like direct object*/
  3602. kEventParamMinimumSize = FOUR_CHAR_CODE('mnsz'), /* typeHISize*/
  3603. kEventParamMaximumSize = FOUR_CHAR_CODE('mxsz'), /* typeHISize*/
  3604. typeWindowRef = FOUR_CHAR_CODE('wind'), /* WindowRef*/
  3605. typeGrafPtr = FOUR_CHAR_CODE('graf'), /* CGrafPtr*/
  3606. typeGWorldPtr = FOUR_CHAR_CODE('gwld'), /* GWorldPtr*/
  3607. typeDragRef = FOUR_CHAR_CODE('drag'), /* DragRef*/
  3608. typeMenuRef = FOUR_CHAR_CODE('menu'), /* MenuRef*/
  3609. typeControlRef = FOUR_CHAR_CODE('ctrl'), /* ControlRef*/
  3610. typeCollection = FOUR_CHAR_CODE('cltn'), /* Collection*/
  3611. typeQDRgnHandle = FOUR_CHAR_CODE('rgnh'), /* RgnHandle*/
  3612. typeOSStatus = FOUR_CHAR_CODE('osst'), /* OSStatus*/
  3613. typeCFStringRef = FOUR_CHAR_CODE('cfst'), /* CFStringRef*/
  3614. typeCFMutableStringRef = FOUR_CHAR_CODE('cfms'), /* CFMutableStringRef*/
  3615. typeCFIndex = FOUR_CHAR_CODE('cfix'), /* CFIndex*/
  3616. typeCFTypeRef = FOUR_CHAR_CODE('cfty'), /* CFTypeRef*/
  3617. typeCGContextRef = FOUR_CHAR_CODE('cntx'), /* CGContextRef*/
  3618. typeHIPoint = FOUR_CHAR_CODE('hipt'), /* HIPoint*/
  3619. typeHISize = FOUR_CHAR_CODE('hisz'), /* HISize*/
  3620. typeHIRect = FOUR_CHAR_CODE('hirc'), /* HIRect*/
  3621. typeVoidPtr = FOUR_CHAR_CODE('void') /* void * (used for hiobject fun)*/
  3622. };
  3623. /* Mouse event parameters and types*/
  3624. enum {
  3625. kEventParamMouseLocation = FOUR_CHAR_CODE('mloc'), /* typeHIPoint*/
  3626. kEventParamWindowMouseLocation = FOUR_CHAR_CODE('wmou'), /* typeHIPoint (Mac OS X 10.1 or later)*/
  3627. kEventParamMouseButton = FOUR_CHAR_CODE('mbtn'), /* typeMouseButton*/
  3628. kEventParamClickCount = FOUR_CHAR_CODE('ccnt'), /* typeUInt32*/
  3629. kEventParamMouseWheelAxis = FOUR_CHAR_CODE('mwax'), /* typeMouseWheelAxis*/
  3630. kEventParamMouseWheelDelta = FOUR_CHAR_CODE('mwdl'), /* typeSInt32*/
  3631. kEventParamMouseDelta = FOUR_CHAR_CODE('mdta'), /* typeQDPoint*/
  3632. kEventParamMouseChord = FOUR_CHAR_CODE('chor'), /* typeUInt32*/
  3633. kEventParamTabletEventType = FOUR_CHAR_CODE('tblt'), /* typeUInt32*/
  3634. kEventParamMouseTrackingRef = FOUR_CHAR_CODE('mtrf'), /* typeMouseTrackingRef*/
  3635. typeMouseButton = FOUR_CHAR_CODE('mbtn'), /* EventMouseButton*/
  3636. typeMouseWheelAxis = FOUR_CHAR_CODE('mwax'), /* EventMouseWheelAxis*/
  3637. typeMouseTrackingRef = FOUR_CHAR_CODE('mtrf') /* MouseTrackingRef*/
  3638. };
  3639. /* Keyboard event parameter and types*/
  3640. enum {
  3641. kEventParamKeyCode = FOUR_CHAR_CODE('kcod'), /* typeUInt32*/
  3642. kEventParamKeyMacCharCodes = FOUR_CHAR_CODE('kchr'), /* typeChar*/
  3643. kEventParamKeyModifiers = FOUR_CHAR_CODE('kmod'), /* typeUInt32*/
  3644. kEventParamKeyUnicodes = FOUR_CHAR_CODE('kuni'), /* typeUnicodeText*/
  3645. kEventParamKeyboardType = FOUR_CHAR_CODE('kbdt'), /* typeUInt32*/
  3646. typeEventHotKeyID = FOUR_CHAR_CODE('hkid') /* EventHotKeyID*/
  3647. };
  3648. /* TextInput event parameters*/
  3649. enum {
  3650. kEventParamTextInputSendRefCon = FOUR_CHAR_CODE('tsrc'), /* typeLongInteger*/
  3651. kEventParamTextInputSendComponentInstance = FOUR_CHAR_CODE('tsci'), /* typeComponentInstance*/
  3652. kEventParamTextInputSendSLRec = FOUR_CHAR_CODE('tssl'), /* typeIntlWritingCode*/
  3653. kEventParamTextInputReplySLRec = FOUR_CHAR_CODE('trsl'), /* typeIntlWritingCode*/
  3654. kEventParamTextInputSendText = FOUR_CHAR_CODE('tstx'), /* typeUnicodeText (if TSMDocument is Unicode), otherwise typeChar*/
  3655. kEventParamTextInputReplyText = FOUR_CHAR_CODE('trtx'), /* typeUnicodeText (if TSMDocument is Unicode), otherwise typeChar*/
  3656. kEventParamTextInputSendUpdateRng = FOUR_CHAR_CODE('tsup'), /* typeTextRangeArray*/
  3657. kEventParamTextInputSendHiliteRng = FOUR_CHAR_CODE('tshi'), /* typeTextRangeArray*/
  3658. kEventParamTextInputSendClauseRng = FOUR_CHAR_CODE('tscl'), /* typeOffsetArray*/
  3659. kEventParamTextInputSendPinRng = FOUR_CHAR_CODE('tspn'), /* typeTextRange*/
  3660. kEventParamTextInputSendFixLen = FOUR_CHAR_CODE('tsfx'), /* typeLongInteger*/
  3661. kEventParamTextInputSendLeadingEdge = FOUR_CHAR_CODE('tsle'), /* typeBoolean*/
  3662. kEventParamTextInputReplyLeadingEdge = FOUR_CHAR_CODE('trle'), /* typeBoolean*/
  3663. kEventParamTextInputSendTextOffset = FOUR_CHAR_CODE('tsto'), /* typeLongInteger*/
  3664. kEventParamTextInputReplyTextOffset = FOUR_CHAR_CODE('trto'), /* typeLongInteger*/
  3665. kEventParamTextInputReplyRegionClass = FOUR_CHAR_CODE('trrg'), /* typeLongInteger*/
  3666. kEventParamTextInputSendCurrentPoint = FOUR_CHAR_CODE('tscp'), /* typeQDPoint*/
  3667. kEventParamTextInputSendDraggingMode = FOUR_CHAR_CODE('tsdm'), /* typeBoolean*/
  3668. kEventParamTextInputReplyPoint = FOUR_CHAR_CODE('trpt'), /* typeQDPoint*/
  3669. kEventParamTextInputReplyFont = FOUR_CHAR_CODE('trft'), /* typeLongInteger*/
  3670. kEventParamTextInputReplyFMFont = FOUR_CHAR_CODE('trfm'), /* typeUInt32*/
  3671. kEventParamTextInputReplyPointSize = FOUR_CHAR_CODE('trpz'), /* typeFixed*/
  3672. kEventParamTextInputReplyLineHeight = FOUR_CHAR_CODE('trlh'), /* typeShortInteger*/
  3673. kEventParamTextInputReplyLineAscent = FOUR_CHAR_CODE('trla'), /* typeShortInteger*/
  3674. kEventParamTextInputReplyTextAngle = FOUR_CHAR_CODE('trta'), /* typeFixed*/
  3675. kEventParamTextInputSendShowHide = FOUR_CHAR_CODE('tssh'), /* typeBoolean*/
  3676. kEventParamTextInputReplyShowHide = FOUR_CHAR_CODE('trsh'), /* typeBoolean*/
  3677. kEventParamTextInputSendKeyboardEvent = FOUR_CHAR_CODE('tske'), /* typeEventRef*/
  3678. kEventParamTextInputSendTextServiceEncoding = FOUR_CHAR_CODE('tsse'), /* typeUInt32*/
  3679. kEventParamTextInputSendTextServiceMacEncoding = FOUR_CHAR_CODE('tssm'), /* typeUInt32*/
  3680. kEventParamTextInputGlyphInfoArray = FOUR_CHAR_CODE('glph') /* typeGlyphInfoArray*/
  3681. };
  3682. /* Command event parameters and types*/
  3683. enum {
  3684. kEventParamHICommand = FOUR_CHAR_CODE('hcmd'), /* typeHICommand*/
  3685. typeHICommand = FOUR_CHAR_CODE('hcmd') /* HICommand*/
  3686. };
  3687. /* Window event parameters and types*/
  3688. enum {
  3689. kEventParamWindowFeatures = FOUR_CHAR_CODE('wftr'), /* typeUInt32*/
  3690. kEventParamWindowDefPart = FOUR_CHAR_CODE('wdpc'), /* typeWindowDefPartCode*/
  3691. kEventParamCurrentBounds = FOUR_CHAR_CODE('crct'), /* typeQDRectangle*/
  3692. kEventParamOriginalBounds = FOUR_CHAR_CODE('orct'), /* typeQDRectangle*/
  3693. kEventParamPreviousBounds = FOUR_CHAR_CODE('prct'), /* typeQDRectangle*/
  3694. kEventParamClickActivation = FOUR_CHAR_CODE('clac'), /* typeClickActivationResult*/
  3695. kEventParamWindowRegionCode = FOUR_CHAR_CODE('wshp'), /* typeWindowRegionCode*/
  3696. kEventParamWindowDragHiliteFlag = FOUR_CHAR_CODE('wdhf'), /* typeBoolean*/
  3697. kEventParamWindowModifiedFlag = FOUR_CHAR_CODE('wmff'), /* typeBoolean*/
  3698. kEventParamWindowProxyGWorldPtr = FOUR_CHAR_CODE('wpgw'), /* typeGWorldPtr*/
  3699. kEventParamWindowProxyImageRgn = FOUR_CHAR_CODE('wpir'), /* typeQDRgnHandle*/
  3700. kEventParamWindowProxyOutlineRgn = FOUR_CHAR_CODE('wpor'), /* typeQDRgnHandle*/
  3701. kEventParamWindowStateChangedFlags = FOUR_CHAR_CODE('wscf'), /* typeUInt32 */
  3702. kEventParamWindowTitleFullWidth = FOUR_CHAR_CODE('wtfw'), /* typeSInt16*/
  3703. kEventParamWindowTitleTextWidth = FOUR_CHAR_CODE('wttw'), /* typeSInt16*/
  3704. kEventParamWindowGrowRect = FOUR_CHAR_CODE('grct'), /* typeQDRectangle*/
  3705. kEventParamAttributes = FOUR_CHAR_CODE('attr'), /* typeUInt32*/
  3706. kEventParamPreviousDockRect = FOUR_CHAR_CODE('pdrc'), /* typeHIRect*/
  3707. kEventParamCurrentDockRect = FOUR_CHAR_CODE('cdrc'), /* typeHIRect*/
  3708. typeWindowRegionCode = FOUR_CHAR_CODE('wshp'), /* WindowRegionCode*/
  3709. typeWindowDefPartCode = FOUR_CHAR_CODE('wdpt'), /* WindowDefPartCode*/
  3710. typeClickActivationResult = FOUR_CHAR_CODE('clac') /* ClickActivationResult*/
  3711. };
  3712. /* Control event parameters and types*/
  3713. enum {
  3714. kEventParamControlPart = FOUR_CHAR_CODE('cprt'), /* typeControlPartCode*/
  3715. kEventParamInitCollection = FOUR_CHAR_CODE('icol'), /* typeCollection*/
  3716. kEventParamControlMessage = FOUR_CHAR_CODE('cmsg'), /* typeShortInteger*/
  3717. kEventParamControlParam = FOUR_CHAR_CODE('cprm'), /* typeLongInteger*/
  3718. kEventParamControlResult = FOUR_CHAR_CODE('crsl'), /* typeLongInteger*/
  3719. kEventParamControlRegion = FOUR_CHAR_CODE('crgn'), /* typeQDRgnHandle*/
  3720. kEventParamControlAction = FOUR_CHAR_CODE('caup'), /* typeControlActionUPP*/
  3721. kEventParamControlIndicatorDragConstraint = FOUR_CHAR_CODE('cidc'), /* typeIndicatorDragConstraint*/
  3722. kEventParamControlIndicatorRegion = FOUR_CHAR_CODE('cirn'), /* typeQDRgnHandle*/
  3723. kEventParamControlIsGhosting = FOUR_CHAR_CODE('cgst'), /* typeBoolean*/
  3724. kEventParamControlIndicatorOffset = FOUR_CHAR_CODE('ciof'), /* typeQDPoint*/
  3725. kEventParamControlClickActivationResult = FOUR_CHAR_CODE('ccar'), /* typeClickActivationResult*/
  3726. kEventParamControlSubControl = FOUR_CHAR_CODE('csub'), /* typeControlRef*/
  3727. kEventParamControlOptimalBounds = FOUR_CHAR_CODE('cobn'), /* typeQDRectangle*/
  3728. kEventParamControlOptimalBaselineOffset = FOUR_CHAR_CODE('cobo'), /* typeShortInteger*/
  3729. kEventParamControlDataTag = FOUR_CHAR_CODE('cdtg'), /* typeEnumeration*/
  3730. kEventParamControlDataBuffer = FOUR_CHAR_CODE('cdbf'), /* typePtr*/
  3731. kEventParamControlDataBufferSize = FOUR_CHAR_CODE('cdbs'), /* typeLongInteger*/
  3732. kEventParamControlDrawDepth = FOUR_CHAR_CODE('cddp'), /* typeShortInteger*/
  3733. kEventParamControlDrawInColor = FOUR_CHAR_CODE('cdic'), /* typeBoolean*/
  3734. kEventParamControlFeatures = FOUR_CHAR_CODE('cftr'), /* typeUInt32*/
  3735. kEventParamControlPartBounds = FOUR_CHAR_CODE('cpbd'), /* typeQDRectangle*/
  3736. kEventParamControlOriginalOwningWindow = FOUR_CHAR_CODE('coow'), /* typeWindowRef*/
  3737. kEventParamControlCurrentOwningWindow = FOUR_CHAR_CODE('ccow'), /* typeWindowRef*/
  3738. kEventParamControlFocusEverything = FOUR_CHAR_CODE('cfev'), /* typeBoolean*/
  3739. kEventParamNextControl = FOUR_CHAR_CODE('cnxc'), /* typeControlRef*/
  3740. kEventParamStartControl = FOUR_CHAR_CODE('cstc'), /* typeControlRef*/
  3741. kEventParamControlSubview = FOUR_CHAR_CODE('csvw'), /* typeControlRef*/
  3742. kEventParamControlPreviousPart = FOUR_CHAR_CODE('copc'), /* typeControlPartCode*/
  3743. kEventParamControlCurrentPart = FOUR_CHAR_CODE('cnpc'), /* typeControlPartCode*/
  3744. kEventParamControlInvalRgn = FOUR_CHAR_CODE('civr'), /* typeQDRgnHandle*/
  3745. kEventParamControlValue = FOUR_CHAR_CODE('cval'), /* typeLongInteger*/
  3746. typeControlActionUPP = FOUR_CHAR_CODE('caup'), /* ControlActionUPP*/
  3747. typeIndicatorDragConstraint = FOUR_CHAR_CODE('cidc'), /* IndicatorDragConstraint*/
  3748. typeControlPartCode = FOUR_CHAR_CODE('cprt') /* ControlPartCode*/
  3749. };
  3750. /* Menu event parameters and types*/
  3751. enum {
  3752. kEventParamCurrentMenuTrackingMode = FOUR_CHAR_CODE('cmtm'), /* typeMenuTrackingMode*/
  3753. kEventParamNewMenuTrackingMode = FOUR_CHAR_CODE('nmtm'), /* typeMenuTrackingMode*/
  3754. kEventParamMenuFirstOpen = FOUR_CHAR_CODE('1sto'), /* typeBoolean*/
  3755. kEventParamMenuItemIndex = FOUR_CHAR_CODE('item'), /* typeMenuItemIndex*/
  3756. kEventParamMenuCommand = FOUR_CHAR_CODE('mcmd'), /* typeMenuCommand*/
  3757. kEventParamEnableMenuForKeyEvent = FOUR_CHAR_CODE('fork'), /* typeBoolean*/
  3758. kEventParamMenuEventOptions = FOUR_CHAR_CODE('meop'), /* typeMenuEventOptions*/
  3759. kEventParamMenuContext = FOUR_CHAR_CODE('mctx'), /* typeUInt32*/
  3760. kEventParamMenuItemBounds = FOUR_CHAR_CODE('mitb'), /* typeQDRectangle*/
  3761. kEventParamMenuMarkBounds = FOUR_CHAR_CODE('mmkb'), /* typeQDRectangle*/
  3762. kEventParamMenuIconBounds = FOUR_CHAR_CODE('micb'), /* typeQDRectangle*/
  3763. kEventParamMenuTextBounds = FOUR_CHAR_CODE('mtxb'), /* typeQDRectangle*/
  3764. kEventParamMenuTextBaseline = FOUR_CHAR_CODE('mtbl'), /* typeShortInteger*/
  3765. kEventParamMenuCommandKeyBounds = FOUR_CHAR_CODE('mcmb'), /* typeQDRectangle*/
  3766. kEventParamMenuVirtualTop = FOUR_CHAR_CODE('mvrt'), /* typeLongInteger*/
  3767. kEventParamMenuVirtualBottom = FOUR_CHAR_CODE('mvrb'), /* typeLongInteger*/
  3768. kEventParamMenuDrawState = FOUR_CHAR_CODE('mdrs'), /* typeThemeDrawState*/
  3769. kEventParamMenuItemType = FOUR_CHAR_CODE('mitp'), /* typeThemeMenuItemType*/
  3770. kEventParamMenuItemWidth = FOUR_CHAR_CODE('mitw'), /* typeShortInteger*/
  3771. kEventParamMenuItemHeight = FOUR_CHAR_CODE('mith'), /* typeShortInteger*/
  3772. typeMenuItemIndex = FOUR_CHAR_CODE('midx'), /* MenuItemIndex*/
  3773. typeMenuCommand = FOUR_CHAR_CODE('mcmd'), /* MenuCommand*/
  3774. typeMenuTrackingMode = FOUR_CHAR_CODE('mtmd'), /* MenuTrackingMode*/
  3775. typeMenuEventOptions = FOUR_CHAR_CODE('meop'), /* MenuEventOptions*/
  3776. typeThemeMenuState = FOUR_CHAR_CODE('tmns'), /* ThemeMenuState*/
  3777. typeThemeMenuItemType = FOUR_CHAR_CODE('tmit') /* ThemeMenuItemType*/
  3778. };
  3779. /* Application event parameters*/
  3780. enum {
  3781. kEventParamProcessID = FOUR_CHAR_CODE('psn '), /* typeProcessSerialNumber*/
  3782. kEventParamLaunchRefCon = FOUR_CHAR_CODE('lref'), /* typeUInt32*/
  3783. kEventParamLaunchErr = FOUR_CHAR_CODE('err '), /* typeOSStatus*/
  3784. kEventParamSystemUIMode = FOUR_CHAR_CODE('uimd') /* typeUInt32*/
  3785. };
  3786. /* Tablet event parameters and types*/
  3787. enum {
  3788. kEventParamTabletPointRec = FOUR_CHAR_CODE('tbrc'), /* typeTabletPointRec*/
  3789. kEventParamTabletProximityRec = FOUR_CHAR_CODE('tbpx'), /* typeTabletProximityRec*/
  3790. typeTabletPointRec = FOUR_CHAR_CODE('tbrc'), /* kEventParamTabletPointRec*/
  3791. typeTabletProximityRec = FOUR_CHAR_CODE('tbpx'), /* kEventParamTabletProximityRec*/
  3792. kEventParamTabletPointerRec = FOUR_CHAR_CODE('tbrc'), /* typeTabletPointerRec -- deprecated, for compatibility only*/
  3793. typeTabletPointerRec = FOUR_CHAR_CODE('tbrc') /* kEventParamTabletPointerRec -- deprecated, for compatibility only*/
  3794. };
  3795. /* Appearance event parameters*/
  3796. enum {
  3797. kEventParamNewScrollBarVariant = FOUR_CHAR_CODE('nsbv') /* typeShortInteger*/
  3798. };
  3799. /* Service event parameters*/
  3800. enum {
  3801. kEventParamScrapRef = FOUR_CHAR_CODE('scrp'), /* typeScrapRef*/
  3802. kEventParamServiceCopyTypes = FOUR_CHAR_CODE('svsd'), /* typeCFMutableArrayRef*/
  3803. kEventParamServicePasteTypes = FOUR_CHAR_CODE('svpt'), /* typeCFMutableArrayRef*/
  3804. kEventParamServiceMessageName = FOUR_CHAR_CODE('svmg'), /* typeCFStringRef*/
  3805. kEventParamServiceUserData = FOUR_CHAR_CODE('svud'), /* typeCFStringRef*/
  3806. typeScrapRef = FOUR_CHAR_CODE('scrp'), /* ScrapRef*/
  3807. typeCFMutableArrayRef = FOUR_CHAR_CODE('cfma') /* CFMutableArrayRef*/
  3808. };
  3809. /* Toolbar event parameters and types*/
  3810. enum {
  3811. kEventParamToolbar = FOUR_CHAR_CODE('tbar'), /* typeHIToolbarRef*/
  3812. kEventParamToolbarItem = FOUR_CHAR_CODE('tbit'), /* typeHIToolbarItemRef*/
  3813. kEventParamToolbarItemIdentifier = FOUR_CHAR_CODE('tbii'), /* typeCFStringRef*/
  3814. kEventParamToolbarItemConfigData = FOUR_CHAR_CODE('tbid'), /* typeCFTypeRef*/
  3815. typeHIToolbarRef = FOUR_CHAR_CODE('tbar'), /* HIToolbarRef*/
  3816. typeHIToolbarItemRef = FOUR_CHAR_CODE('tbit') /* HIToolbarItemRef*/
  3817. };
  3818. /* Accessibility event parameters*/
  3819. enum {
  3820. kEventParamAccessibleObject = FOUR_CHAR_CODE('aobj'), /* typeCFTypeRef with an AXUIElementRef*/
  3821. kEventParamAccessibleChild = FOUR_CHAR_CODE('achl'), /* typeCFTypeRef with an AXUIElementRef*/
  3822. kEventParamAccessibleAttributeName = FOUR_CHAR_CODE('atnm'), /* typeCFStringRef*/
  3823. kEventParamAccessibleAttributeNames = FOUR_CHAR_CODE('atns'), /* typeCFMutableArrayRef of CFStringRefs*/
  3824. kEventParamAccessibleAttributeValue = FOUR_CHAR_CODE('atvl'), /* variable*/
  3825. kEventParamAccessibleAttributeSettable = FOUR_CHAR_CODE('atst'), /* typeBoolean*/
  3826. kEventParamAccessibleActionName = FOUR_CHAR_CODE('acnm'), /* typeCFStringRef*/
  3827. kEventParamAccessibleActionNames = FOUR_CHAR_CODE('acns'), /* typeCFMutableArrayRef of CFStringRefs*/
  3828. kEventParamAccessibleActionDescription = FOUR_CHAR_CODE('acds') /* typeCFMutableStringRef*/
  3829. };
  3830. /*
  3831. * GetWindowEventTarget()
  3832. *
  3833. * Discussion:
  3834. * Returns the EventTargetRef for the specified window. Once you
  3835. * obtain this reference, you can send events to the target and
  3836. * install an event handler on it.
  3837. *
  3838. * Parameters:
  3839. *
  3840. * inWindow:
  3841. * The window to return the target for.
  3842. *
  3843. * Result:
  3844. * An EventTargetRef.
  3845. *
  3846. * Availability:
  3847. * Non-Carbon CFM: not available
  3848. * CarbonLib: in CarbonLib 1.1 and later
  3849. * Mac OS X: in version 10.0 and later
  3850. */
  3851. EXTERN_API( EventTargetRef )
  3852. GetWindowEventTarget(WindowRef inWindow);
  3853. /*
  3854. * GetControlEventTarget()
  3855. *
  3856. * Discussion:
  3857. * Returns the EventTargetRef for the specified control. Once you
  3858. * obtain this reference, you can send events to the target and
  3859. * install event handler on it.
  3860. *
  3861. * Parameters:
  3862. *
  3863. * inControl:
  3864. * The control to return the target for.
  3865. *
  3866. * Result:
  3867. * An EventTargetRef.
  3868. *
  3869. * Availability:
  3870. * Non-Carbon CFM: not available
  3871. * CarbonLib: in CarbonLib 1.1 and later
  3872. * Mac OS X: in version 10.0 and later
  3873. */
  3874. EXTERN_API( EventTargetRef )
  3875. GetControlEventTarget(ControlRef inControl);
  3876. /*
  3877. * GetMenuEventTarget()
  3878. *
  3879. * Discussion:
  3880. * Returns the EventTargetRef for the specified menu. Once you
  3881. * obtain this reference, you can send events to the target and
  3882. * install event handler on it.
  3883. *
  3884. * Parameters:
  3885. *
  3886. * inMenu:
  3887. * The menu to return the target for.
  3888. *
  3889. * Result:
  3890. * An EventTargetRef.
  3891. *
  3892. * Availability:
  3893. * Non-Carbon CFM: not available
  3894. * CarbonLib: in CarbonLib 1.1 and later
  3895. * Mac OS X: in version 10.0 and later
  3896. */
  3897. EXTERN_API( EventTargetRef )
  3898. GetMenuEventTarget(MenuRef inMenu);
  3899. /*
  3900. * GetApplicationEventTarget()
  3901. *
  3902. * Discussion:
  3903. * Returns the EventTargetRef for the application. Once you obtain
  3904. * this reference, you can send events to the target and install
  3905. * event handler on it.
  3906. *
  3907. * Result:
  3908. * An EventTargetRef.
  3909. *
  3910. * Availability:
  3911. * Non-Carbon CFM: not available
  3912. * CarbonLib: in CarbonLib 1.1 and later
  3913. * Mac OS X: in version 10.0 and later
  3914. */
  3915. EXTERN_API( EventTargetRef )
  3916. GetApplicationEventTarget(void);
  3917. /*
  3918. * GetUserFocusEventTarget()
  3919. *
  3920. * Discussion:
  3921. * Returns the EventTargetRef for the current user focus at the time
  3922. * of the call. Keyboard events are always sent to this target.
  3923. *
  3924. * Result:
  3925. * An EventTargetRef.
  3926. *
  3927. * Availability:
  3928. * Non-Carbon CFM: not available
  3929. * CarbonLib: in CarbonLib 1.1 and later
  3930. * Mac OS X: in version 10.0 and later
  3931. */
  3932. EXTERN_API( EventTargetRef )
  3933. GetUserFocusEventTarget(void);
  3934. /*
  3935. * GetEventDispatcherTarget()
  3936. *
  3937. * Discussion:
  3938. * Returns the EventTargetRef for the standard toolbox dispatcher.
  3939. * You typically would never need to use this, but there are some
  3940. * exotic apps that need to pick events off the event queue and call
  3941. * the dispatcher themselves. This allows you to do just that
  3942. * instead of calling RunApplicationEventLoop to handle it all.
  3943. *
  3944. * Result:
  3945. * An EventTargetRef.
  3946. *
  3947. * Availability:
  3948. * Non-Carbon CFM: not available
  3949. * CarbonLib: in CarbonLib 1.3 and later
  3950. * Mac OS X: in version 10.0 and later
  3951. */
  3952. EXTERN_API_C( EventTargetRef )
  3953. GetEventDispatcherTarget(void);
  3954. #define InstallApplicationEventHandler( h, n, l, u, r ) \
  3955. InstallEventHandler( GetApplicationEventTarget(), (h), (n), (l), (u), (r) )
  3956. #define InstallHIObjectEventHandler( t, h, n, l, u, r ) \
  3957. InstallEventHandler( HIObjectGetEventTarget( t ), (h), (n), (l), (u), (r) )
  3958. #define InstallWindowEventHandler( t, h, n, l, u, r ) \
  3959. InstallEventHandler( GetWindowEventTarget( t ), (h), (n), (l), (u), (r) )
  3960. #define InstallControlEventHandler( t, h, n, l, u, r ) \
  3961. InstallEventHandler( GetControlEventTarget( t ), (h), (n), (l), (u), (r) )
  3962. #define InstallMenuEventHandler( t, h, n, l, u, r ) \
  3963. InstallEventHandler( GetMenuEventTarget( t ), (h), (n), (l), (u), (r) )
  3964. /*
  3965. You can use the following macro in your code to allow you to set up an
  3966. event handler lazily. You pass the name of your event handler in. You should
  3967. use this with caution on Mac OS 9 systems since it could cause heap fragmentation.
  3968. */
  3969. #define DEFINE_ONE_SHOT_HANDLER_GETTER( x ) \
  3970. EventHandlerUPP Get ## x ## UPP() \
  3971. { \
  3972. static EventHandlerUPP sHandler = NULL; \
  3973. \
  3974. if ( sHandler == NULL ) \
  3975. sHandler = NewEventHandlerUPP( x ); \
  3976. \
  3977. return sHandler; \
  3978. }
  3979. #define SendEventToApplication( e ) \
  3980. SendEventToEventTarget( (e), GetApplicationEventTarget() )
  3981. #define SendEventToHIObject( e, t ) \
  3982. SendEventToEventTarget( (e), HIObjectGetEventTarget( t ) )
  3983. #define SendEventToWindow( e, t ) \
  3984. SendEventToEventTarget( (e), GetWindowEventTarget( t ) )
  3985. #define SendEventToControl( e, t ) \
  3986. SendEventToEventTarget( (e), GetControlEventTarget( t ) )
  3987. #define SendEventToMenu( e, t ) \
  3988. SendEventToEventTarget( (e), GetMenuEventTarget( t ) )
  3989. #define SendEventToUserFocus( e ) \
  3990. SendEventToEventTarget( (e), GetUserFocusEventTarget() )
  3991. /*======================================================================================*/
  3992. /* EVENT-BASED OBJECT CLASSES */
  3993. /* */
  3994. /* Here it is - the replacement for classic defprocs. This is also a convenient way */
  3995. /* to create toolbox objects (windows, etc.) that have a specific behavior without */
  3996. /* installing handlers on each instance of the object. With a toolbox object class, */
  3997. /* you register your class, then use special creation routines to create objects of */
  3998. /* that class. The event handlers are automatically installed and ready to go. */
  3999. /*======================================================================================*/
  4000. typedef struct OpaqueToolboxObjectClassRef* ToolboxObjectClassRef;
  4001. /*
  4002. * RegisterToolboxObjectClass()
  4003. *
  4004. * Availability:
  4005. * Non-Carbon CFM: not available
  4006. * CarbonLib: in CarbonLib 1.1 and later
  4007. * Mac OS X: in version 10.0 and later
  4008. */
  4009. EXTERN_API( OSStatus )
  4010. RegisterToolboxObjectClass(
  4011. CFStringRef inClassID,
  4012. ToolboxObjectClassRef inBaseClass, /* can be NULL */
  4013. UInt32 inNumEvents,
  4014. const EventTypeSpec * inEventList,
  4015. EventHandlerUPP inEventHandler,
  4016. void * inEventHandlerData,
  4017. ToolboxObjectClassRef * outClassRef);
  4018. /*
  4019. * UnregisterToolboxObjectClass()
  4020. *
  4021. * Availability:
  4022. * Non-Carbon CFM: not available
  4023. * CarbonLib: in CarbonLib 1.1 and later
  4024. * Mac OS X: in version 10.0 and later
  4025. */
  4026. EXTERN_API( OSStatus )
  4027. UnregisterToolboxObjectClass(ToolboxObjectClassRef inClassRef);
  4028. /*======================================================================================*/
  4029. /* o Command Routines */
  4030. /*======================================================================================*/
  4031. /*
  4032. * ProcessHICommand()
  4033. *
  4034. * Availability:
  4035. * Non-Carbon CFM: not available
  4036. * CarbonLib: in CarbonLib 1.1 and later
  4037. * Mac OS X: in version 10.0 and later
  4038. */
  4039. EXTERN_API( OSStatus )
  4040. ProcessHICommand(const HICommand * inCommand);
  4041. /*--------------------------------------------------------------------------------------*/
  4042. /* o Event Loop Routines */
  4043. /*--------------------------------------------------------------------------------------*/
  4044. /*
  4045. * RunApplicationEventLoop()
  4046. *
  4047. * Discussion:
  4048. * This routine is used as the main event loop for a Carbon
  4049. * Event-based application. Once entered, this function waits for
  4050. * events to arrive and dispatches them to your event handlers
  4051. * automatically.
  4052. *
  4053. * Availability:
  4054. * Non-Carbon CFM: not available
  4055. * CarbonLib: in CarbonLib 1.1 and later
  4056. * Mac OS X: in version 10.0 and later
  4057. */
  4058. EXTERN_API( void )
  4059. RunApplicationEventLoop(void);
  4060. /*
  4061. * QuitApplicationEventLoop()
  4062. *
  4063. * Discussion:
  4064. * This routine is used to quit the RunApplicationEventLoop
  4065. * function. Typically, your application doesn't need to call this.
  4066. * If your application has the Quit menu item tagged with the
  4067. * kHICommandQuit Menu Command ID, the toolbox will automatically
  4068. * call this for your application, automatically terminating your
  4069. * event loop. If your application wants to do pre-processing before
  4070. * the event loop exits, it should intercept either the
  4071. * kHICommandQuit menu command, or the kEventApplicationQuit event.
  4072. *
  4073. * Availability:
  4074. * Non-Carbon CFM: not available
  4075. * CarbonLib: in CarbonLib 1.1 and later
  4076. * Mac OS X: in version 10.0 and later
  4077. */
  4078. EXTERN_API( void )
  4079. QuitApplicationEventLoop(void);
  4080. /*--------------------------------------------------------------------------------------*/
  4081. /* o Event Modality routines */
  4082. /*--------------------------------------------------------------------------------------*/
  4083. /*
  4084. * RunAppModalLoopForWindow()
  4085. *
  4086. * Discussion:
  4087. * This routine is used as a replacement to ModalDialog to drive a
  4088. * Carbon Event-based modal dialog. Once called, this routine will
  4089. * not exit until QuitAppModalLoopForWindow is called. Calls to
  4090. * RunAppModalLoopForWindow can be nested, as long as each call is
  4091. * made on a different window. In Mac OS X 10.0.x,
  4092. * RunAppModalLoopForWindow will fail to re-enable the menubar
  4093. * before exiting if you dispose of the window during the modal loop
  4094. * (for example, from a Carbon event handler). You can work around
  4095. * this bug by retaining the window before calling
  4096. * RunAppModalLoopForWindow, and releasing it afterwards.
  4097. *
  4098. * Parameters:
  4099. *
  4100. * inWindow:
  4101. * The window you wish to behave modally.
  4102. *
  4103. * Result:
  4104. * An operating system status code.
  4105. *
  4106. * Availability:
  4107. * Non-Carbon CFM: not available
  4108. * CarbonLib: in CarbonLib 1.3 and later
  4109. * Mac OS X: in version 10.0 and later
  4110. */
  4111. EXTERN_API_C( OSStatus )
  4112. RunAppModalLoopForWindow(WindowRef inWindow);
  4113. /*
  4114. * QuitAppModalLoopForWindow()
  4115. *
  4116. * Discussion:
  4117. * This routine is used to quit a currently running call to
  4118. * RunAppModalLoopForWindow, i.e. it terminates a modal loop.
  4119. * Typically this would be called from a handler you have installed
  4120. * on the modal window in question when the user clicks the
  4121. * appropriate button, etc.
  4122. *
  4123. * Parameters:
  4124. *
  4125. * inWindow:
  4126. * The window for which to quit the modal state.
  4127. *
  4128. * Result:
  4129. * An operating system status code.
  4130. *
  4131. * Availability:
  4132. * Non-Carbon CFM: not available
  4133. * CarbonLib: in CarbonLib 1.3 and later
  4134. * Mac OS X: in version 10.0 and later
  4135. */
  4136. EXTERN_API_C( OSStatus )
  4137. QuitAppModalLoopForWindow(WindowRef inWindow);
  4138. /*
  4139. * BeginAppModalStateForWindow()
  4140. *
  4141. * Discussion:
  4142. * This routine is a lower level routine than
  4143. * RunAppModalLoopForWindow. It can be used if you wish to enter an
  4144. * app modal state for a window, but need to control the event loop
  4145. * yourself for whatever reason. In most cases, you would use
  4146. * RunAppModalLoopForWindow. Once you begin your app modal state,
  4147. * the menu bar will disable and prepare for the modal situation.
  4148. * The window must be visible when calling
  4149. * BeginAppModalStateForWindow; otherwise, windowWrongStateErr is
  4150. * returned. Calls to BeginAppModalStateForWindow can be nested, as
  4151. * long as each call is made on a different window. In Mac OS 10.0.x
  4152. * and CarbonLib 1.3.1, BeginAppModalStateForWindow can only be
  4153. * called on a window once; future calls will return an error. This
  4154. * bug is fixed in Mac OS 10.1 and CarbonLib 1.4.
  4155. *
  4156. * Parameters:
  4157. *
  4158. * inWindow:
  4159. * The window you wish to behave modally.
  4160. *
  4161. * Result:
  4162. * An operating system status code.
  4163. *
  4164. * Availability:
  4165. * Non-Carbon CFM: not available
  4166. * CarbonLib: in CarbonLib 1.3 and later
  4167. * Mac OS X: in version 10.0 and later
  4168. */
  4169. EXTERN_API_C( OSStatus )
  4170. BeginAppModalStateForWindow(WindowRef inWindow);
  4171. /*
  4172. * EndAppModalStateForWindow()
  4173. *
  4174. * Discussion:
  4175. * This routine ends an app modal state started with
  4176. * BeginAppModalStateForWindow.
  4177. *
  4178. * Parameters:
  4179. *
  4180. * inWindow:
  4181. * The window you wish to stop acting as app modal.
  4182. *
  4183. * Result:
  4184. * An operating system status code.
  4185. *
  4186. * Availability:
  4187. * Non-Carbon CFM: not available
  4188. * CarbonLib: in CarbonLib 1.3 and later
  4189. * Mac OS X: in version 10.0 and later
  4190. */
  4191. EXTERN_API_C( OSStatus )
  4192. EndAppModalStateForWindow(WindowRef inWindow);
  4193. /*--------------------------------------------------------------------------------------*/
  4194. /* o User Focus */
  4195. /* */
  4196. /* The 'user focus' is where keyboard input goes. We also use the term 'key' applied */
  4197. /* to windows to mean this. The user focus window is normally the active non-floating */
  4198. /* window or dialog. It is possible to make a floater get the focus, however, by calling*/
  4199. /* SetUserFocusWindow. After that call, the event model will automatically route key */
  4200. /* input to the active keyboard focus of that window, if any. Passing kUserFocusAuto */
  4201. /* into the window parameter tells the toolbox to pick what it considers to be the best */
  4202. /* candidate for focus. You should call this to restore focus, rather than getting the */
  4203. /* focus, setting it to a special window, and then restoring to the saved focus. There */
  4204. /* are cases, however, when you might want to restore to an explicit window, but the */
  4205. /* typical usage should just be to restore to the kUserFocusAuto focus. */
  4206. /* */
  4207. /* Keep in mind that setting the focus will only last until you restore focus, or the */
  4208. /* user starts clicking in other windows. When that happens, the toolbox will auto- */
  4209. /* redirect the user focus to a newly selected window. */
  4210. /*--------------------------------------------------------------------------------------*/
  4211. /* pick the most appropriate window for focus*/
  4212. #define kUserFocusAuto ((WindowRef)(-1))
  4213. /*
  4214. * SetUserFocusWindow()
  4215. *
  4216. * Availability:
  4217. * Non-Carbon CFM: not available
  4218. * CarbonLib: in CarbonLib 1.1 and later
  4219. * Mac OS X: in version 10.0 and later
  4220. */
  4221. EXTERN_API( OSStatus )
  4222. SetUserFocusWindow(WindowRef inWindow);
  4223. /*
  4224. * GetUserFocusWindow()
  4225. *
  4226. * Availability:
  4227. * Non-Carbon CFM: not available
  4228. * CarbonLib: in CarbonLib 1.1 and later
  4229. * Mac OS X: in version 10.0 and later
  4230. */
  4231. EXTERN_API( WindowRef )
  4232. GetUserFocusWindow(void);
  4233. /*--------------------------------------------------------------------------------------*/
  4234. /* o Default/Cancel buttons */
  4235. /* */
  4236. /* In our quest to eliminate the need for dialogs when using the new event model, we */
  4237. /* have added the following routines which add dialog-like button control to normal */
  4238. /* windows. With these routines, you can set the default and cancel buttons for a */
  4239. /* window; these work just like the corresponding concepts in dialogs, and when */
  4240. /* present, the standard toolbox handlers will handle keyboard input mapping to these */
  4241. /* buttons. This means that pressing return or enter will 'press' the default button */
  4242. /* and escape or command-period will 'press' the cancel button. */
  4243. /*--------------------------------------------------------------------------------------*/
  4244. /*
  4245. * SetWindowDefaultButton()
  4246. *
  4247. * Availability:
  4248. * Non-Carbon CFM: not available
  4249. * CarbonLib: in CarbonLib 1.1 and later
  4250. * Mac OS X: in version 10.0 and later
  4251. */
  4252. EXTERN_API( OSStatus )
  4253. SetWindowDefaultButton(
  4254. WindowRef inWindow,
  4255. ControlRef inControl); /* can be NULL */
  4256. /*
  4257. * SetWindowCancelButton()
  4258. *
  4259. * Availability:
  4260. * Non-Carbon CFM: not available
  4261. * CarbonLib: in CarbonLib 1.1 and later
  4262. * Mac OS X: in version 10.0 and later
  4263. */
  4264. EXTERN_API( OSStatus )
  4265. SetWindowCancelButton(
  4266. WindowRef inWindow,
  4267. ControlRef inControl); /* can be NULL */
  4268. /*
  4269. * GetWindowDefaultButton()
  4270. *
  4271. * Availability:
  4272. * Non-Carbon CFM: not available
  4273. * CarbonLib: in CarbonLib 1.1 and later
  4274. * Mac OS X: in version 10.0 and later
  4275. */
  4276. EXTERN_API( OSStatus )
  4277. GetWindowDefaultButton(
  4278. WindowRef inWindow,
  4279. ControlRef * outControl);
  4280. /*
  4281. * GetWindowCancelButton()
  4282. *
  4283. * Availability:
  4284. * Non-Carbon CFM: not available
  4285. * CarbonLib: in CarbonLib 1.1 and later
  4286. * Mac OS X: in version 10.0 and later
  4287. */
  4288. EXTERN_API( OSStatus )
  4289. GetWindowCancelButton(
  4290. WindowRef inWindow,
  4291. ControlRef * outControl);
  4292. /*--------------------------------------------------------------------------------------*/
  4293. /* o Global HotKey API */
  4294. /*--------------------------------------------------------------------------------------*/
  4295. struct EventHotKeyID {
  4296. OSType signature;
  4297. UInt32 id;
  4298. };
  4299. typedef struct EventHotKeyID EventHotKeyID;
  4300. typedef struct OpaqueEventHotKeyRef* EventHotKeyRef;
  4301. /*
  4302. * RegisterEventHotKey()
  4303. *
  4304. * Discussion:
  4305. * Registers a global hot key based on the virtual key code and
  4306. * modifiers you pass in. Only one such combination can exist for
  4307. * the current application, i.e. multiple entities in the same
  4308. * application cannot register for the same hot key combination. The
  4309. * same hot key can, however, be registered by multiple
  4310. * applications. This means that multiple applications can
  4311. * potentially be notified when a particular hot key is requested.
  4312. * This might not necessarily be desirable, but it is how it works
  4313. * at present.
  4314. *
  4315. * Parameters:
  4316. *
  4317. * inHotKeyCode:
  4318. * The virtual key code of the key to watch
  4319. *
  4320. * inHotKeyModifiers:
  4321. * The keyboard modifiers to look for. There must be a modifier
  4322. * specified, or this function will return paramErr.
  4323. *
  4324. * inHotKeyID:
  4325. * The application-specified hot key ID. You will receive this in
  4326. * the kEventHotKeyPressed event as the direct object parameter.
  4327. *
  4328. * inTarget:
  4329. * The target to notify when the hot key is pressed.
  4330. *
  4331. * inOptions:
  4332. * Currently unused. Pass 0 or face the consequences.
  4333. *
  4334. * outRef:
  4335. * The EventHotKeyRef that represents your new, shiny hot key. You
  4336. * need this if you later wish to unregister it.
  4337. *
  4338. * Result:
  4339. * An operating system status code.
  4340. *
  4341. * Availability:
  4342. * Non-Carbon CFM: not available
  4343. * CarbonLib: in CarbonLib 1.3 and later
  4344. * Mac OS X: in version 10.0 and later
  4345. */
  4346. EXTERN_API_C( OSStatus )
  4347. RegisterEventHotKey(
  4348. UInt32 inHotKeyCode,
  4349. UInt32 inHotKeyModifiers,
  4350. EventHotKeyID inHotKeyID,
  4351. EventTargetRef inTarget,
  4352. OptionBits inOptions,
  4353. EventHotKeyRef * outRef);
  4354. /*
  4355. * UnregisterEventHotKey()
  4356. *
  4357. * Discussion:
  4358. * Unregisters a global hot key that was previously registered with
  4359. * the RegisterEventHotKey API. You do not need to unregister a hot
  4360. * key when your application terminates, the system will take care
  4361. * of that for you. This would be used if the user changes a hot key
  4362. * for something in your application - you would unregister the
  4363. * previous key and register your new key.
  4364. *
  4365. * Parameters:
  4366. *
  4367. * inHotKey:
  4368. * The EventHotKeyRef to unregister.
  4369. *
  4370. * Result:
  4371. * An operating system status code.
  4372. *
  4373. * Availability:
  4374. * Non-Carbon CFM: not available
  4375. * CarbonLib: in CarbonLib 1.3 and later
  4376. * Mac OS X: in version 10.0 and later
  4377. */
  4378. EXTERN_API_C( OSStatus )
  4379. UnregisterEventHotKey(EventHotKeyRef inHotKey);
  4380. /*--------------------------------------------------------------------------------------*/
  4381. /* o MouseTrackingRegions */
  4382. /*--------------------------------------------------------------------------------------*/
  4383. /*
  4384. * MouseTrackingRef
  4385. *
  4386. * Discussion:
  4387. * A MouseTrackingRef is an object that controls the generation of
  4388. * mouse-enter and mouse-exit events. When the user moves the mouse
  4389. * into a tracking region, a kEventClassMouse/kEventMouseEntered
  4390. * event is sent to the app. When the user moves the mouse out of a
  4391. * tracking region, an event of type
  4392. * kEventClassMouse/kEventMouseExited is sent. Mouse tracking
  4393. * regions are uniquely identified within the scope of a window by a
  4394. * MouseTrackingRegionID which is a client signature/id pair. The
  4395. * client signature is the usual DTS-registered creator OSType.
  4396. * Mouse tracking regions can overlap, but are not exclusive. Mouse
  4397. * motion events are generated for each of the tracking areas
  4398. * intersected by the mouse. Mouse tracking regions are initially
  4399. * enabled. You can explicitly disable a mouse tracking area to
  4400. * prevent mouse-enter/exit events from being generated. Unlike
  4401. * global mouse-moved events, mouse-enter and mouse-exit events are
  4402. * generated while your app is in the background. If this is not
  4403. * considered desirable, disable the tracking areas while the
  4404. * application is in the background. MouseTrackingRefs become
  4405. * invalid when the window that they are bound to is disposed of.
  4406. */
  4407. typedef struct OpaqueMouseTrackingRef* MouseTrackingRef;
  4408. /*
  4409. * MouseTrackingOptions
  4410. *
  4411. * Discussion:
  4412. * These values define how the user's region is handled by the Mouse
  4413. * Tracking Region API. They define the behavior throughout the life
  4414. * of the Mouse Tracking Region. For example, if a region is created
  4415. * with the option of kMouseTrackingOptionsGlobalClip then all
  4416. * operations on this region will be interpreted in global
  4417. * coordinates and will be clipped to the owning window's structure.
  4418. */
  4419. typedef UInt32 MouseTrackingOptions;
  4420. enum {
  4421. /*
  4422. * The region is expected in local coordinates and mouse movement
  4423. * tracking is clipped to the owning window's content region.
  4424. */
  4425. kMouseTrackingOptionsLocalClip = 0,
  4426. /*
  4427. * The region is expected in global coordinates and mouse movement
  4428. * tracking is clipped to the owning window's structure region.
  4429. */
  4430. kMouseTrackingOptionsGlobalClip = 1,
  4431. /*
  4432. * Standard options. The region will be handled in local coordinates
  4433. * and remain clipped against the windows content region.
  4434. */
  4435. kMouseTrackingOptionsStandard = kMouseTrackingOptionsLocalClip
  4436. };
  4437. struct MouseTrackingRegionID {
  4438. OSType signature;
  4439. SInt32 id;
  4440. };
  4441. typedef struct MouseTrackingRegionID MouseTrackingRegionID;
  4442. /* Creation*/
  4443. /*
  4444. * CreateMouseTrackingRegion()
  4445. *
  4446. * Discussion:
  4447. * Creates a mouse tracking region and installs it into the window
  4448. * system.
  4449. *
  4450. * Parameters:
  4451. *
  4452. * inWindow:
  4453. * The window that will contain the created region.
  4454. *
  4455. * inRegion:
  4456. * The region for which you will receive entered/exit events.
  4457. *
  4458. * inClip:
  4459. * A region to clip inRegion against (can be NULL).
  4460. *
  4461. * inOptions:
  4462. * The options which define whether inRegion is given in global or
  4463. * local coordinates.
  4464. *
  4465. * inID:
  4466. * The signature/id pair which uniquely defines this region.
  4467. *
  4468. * inRefCon:
  4469. * Any user defined value.
  4470. *
  4471. * inTargetToNotify:
  4472. * The event target that should receive kEventMouseEntered/Exited
  4473. * events for this tracking region. If NULL, the window's event
  4474. * target receives these events.
  4475. *
  4476. * outTrackingRef:
  4477. * A reference to the newly created mouse tracking region.
  4478. *
  4479. * Result:
  4480. * An operating system status code.
  4481. *
  4482. * Availability:
  4483. * Non-Carbon CFM: not available
  4484. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  4485. * Mac OS X: in version 10.2 and later
  4486. */
  4487. EXTERN_API_C( OSStatus )
  4488. CreateMouseTrackingRegion(
  4489. WindowRef inWindow,
  4490. RgnHandle inRegion,
  4491. RgnHandle inClip, /* can be NULL */
  4492. MouseTrackingOptions inOptions,
  4493. MouseTrackingRegionID inID,
  4494. void * inRefCon,
  4495. EventTargetRef inTargetToNotify, /* can be NULL */
  4496. MouseTrackingRef * outTrackingRef);
  4497. /*
  4498. * RetainMouseTrackingRegion()
  4499. *
  4500. * Discussion:
  4501. * Retains the MouseTrackingRef.
  4502. *
  4503. * Parameters:
  4504. *
  4505. * inMouseRef:
  4506. * A valid MouseTrackingRef to retain.
  4507. *
  4508. * Result:
  4509. * An operating system status code.
  4510. *
  4511. * Availability:
  4512. * Non-Carbon CFM: not available
  4513. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  4514. * Mac OS X: in version 10.2 and later
  4515. */
  4516. EXTERN_API_C( OSStatus )
  4517. RetainMouseTrackingRegion(MouseTrackingRef inMouseRef);
  4518. /*
  4519. * ReleaseMouseTrackingRegion()
  4520. *
  4521. * Discussion:
  4522. * Releases the MouseTrackingRef. Since mouse tracking regions are
  4523. * bound to a window, they are automatically released when the
  4524. * window is disposed of.
  4525. *
  4526. * Parameters:
  4527. *
  4528. * inMouseRef:
  4529. * A valid MouseTrackingRef to release.
  4530. *
  4531. * Result:
  4532. * An operating system status code.
  4533. *
  4534. * Availability:
  4535. * Non-Carbon CFM: not available
  4536. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  4537. * Mac OS X: in version 10.2 and later
  4538. */
  4539. EXTERN_API_C( OSStatus )
  4540. ReleaseMouseTrackingRegion(MouseTrackingRef inMouseRef);
  4541. /*
  4542. * ChangeMouseTrackingRegion()
  4543. *
  4544. * Discussion:
  4545. * Changes the MouseTrackingRefs region and optionally, its clip.
  4546. * This will not change the enabled state or options of the region.
  4547. *
  4548. * Parameters:
  4549. *
  4550. * inMouseRef:
  4551. * A valid MouseTrackingRef to modify.
  4552. *
  4553. * inRegion:
  4554. * The region to set as the mouse tracking region.
  4555. *
  4556. * inClip:
  4557. * An optional clip to clip inRegion against (may be NULL).
  4558. *
  4559. * Result:
  4560. * An operating system status code.
  4561. *
  4562. * Availability:
  4563. * Non-Carbon CFM: not available
  4564. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  4565. * Mac OS X: in version 10.2 and later
  4566. */
  4567. EXTERN_API_C( OSStatus )
  4568. ChangeMouseTrackingRegion(
  4569. MouseTrackingRef inMouseRef,
  4570. RgnHandle inRegion,
  4571. RgnHandle inClip); /* can be NULL */
  4572. /*
  4573. * ClipMouseTrackingRegion()
  4574. *
  4575. * Discussion:
  4576. * Adjust the region to clip the MouseTrackingRef against. This can
  4577. * be used in the case where a window is resized or when a
  4578. * previously obscured region becomes exposed.
  4579. *
  4580. * Parameters:
  4581. *
  4582. * inMouseRef:
  4583. * A valid MouseTrackingRef to adjust.
  4584. *
  4585. * inRegion:
  4586. * A new region to clip inMouseRef against (can be NULL). If NULL,
  4587. * standard clipping will be provided.
  4588. *
  4589. * Result:
  4590. * An operating system status code.
  4591. *
  4592. * Availability:
  4593. * Non-Carbon CFM: not available
  4594. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  4595. * Mac OS X: in version 10.2 and later
  4596. */
  4597. EXTERN_API_C( OSStatus )
  4598. ClipMouseTrackingRegion(
  4599. MouseTrackingRef inMouseRef,
  4600. RgnHandle inRegion);
  4601. /* Accessors*/
  4602. /*
  4603. * GetMouseTrackingRegionID()
  4604. *
  4605. * Discussion:
  4606. * Retrieves the MouseTrackingRegionID of the given
  4607. * MouseTrackingRef. Can be used to determine if the region belongs
  4608. * to your app, and if so, which region it is.
  4609. *
  4610. * Parameters:
  4611. *
  4612. * inMouseRef:
  4613. * A valid MouseTrackingRef from which to obtain the
  4614. * MouseTrackingRegionID.
  4615. *
  4616. * outID:
  4617. * Receives the MouseTrackingRegionID.
  4618. *
  4619. * Result:
  4620. * An operating system status code.
  4621. *
  4622. * Availability:
  4623. * Non-Carbon CFM: not available
  4624. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  4625. * Mac OS X: in version 10.2 and later
  4626. */
  4627. EXTERN_API_C( OSStatus )
  4628. GetMouseTrackingRegionID(
  4629. MouseTrackingRef inMouseRef,
  4630. MouseTrackingRegionID * outID);
  4631. /*
  4632. * GetMouseTrackingRegionRefCon()
  4633. *
  4634. * Discussion:
  4635. * Retrieves the RefCon from the given mouse tracking region.
  4636. *
  4637. * Parameters:
  4638. *
  4639. * inMouseRef:
  4640. * A valid MouseTrackingRef from which to obtain the refcon.
  4641. *
  4642. * outRefCon:
  4643. * Receives the refcon.
  4644. *
  4645. * Result:
  4646. * An operating system status code.
  4647. *
  4648. * Availability:
  4649. * Non-Carbon CFM: not available
  4650. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  4651. * Mac OS X: in version 10.2 and later
  4652. */
  4653. EXTERN_API_C( OSStatus )
  4654. GetMouseTrackingRegionRefCon(
  4655. MouseTrackingRef inMouseRef,
  4656. void ** outRefCon);
  4657. /* Geometry*/
  4658. /*
  4659. * MoveMouseTrackingRegion()
  4660. *
  4661. * Discussion:
  4662. * Moves the given mouse tracking region by the specified delta. It
  4663. * can also optionally reclip the region, such as if the region is
  4664. * scrolled within a pane.
  4665. *
  4666. * Parameters:
  4667. *
  4668. * inMouseRef:
  4669. * A valid MouseTrackingRef to move.
  4670. *
  4671. * deltaH:
  4672. * The horizontal delta to move the MouseTrackingRef.
  4673. *
  4674. * deltaV:
  4675. * The vertical delta to move the MouseTrackingRef.
  4676. *
  4677. * inClip:
  4678. * A region to optionally clip against (can be NULL).
  4679. *
  4680. * Result:
  4681. * An operating system status code.
  4682. *
  4683. * Availability:
  4684. * Non-Carbon CFM: not available
  4685. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  4686. * Mac OS X: in version 10.2 and later
  4687. */
  4688. EXTERN_API_C( OSStatus )
  4689. MoveMouseTrackingRegion(
  4690. MouseTrackingRef inMouseRef,
  4691. SInt16 deltaH,
  4692. SInt16 deltaV,
  4693. RgnHandle inClip); /* can be NULL */
  4694. /* Enable/disable*/
  4695. /*
  4696. * SetMouseTrackingRegionEnabled()
  4697. *
  4698. * Discussion:
  4699. * Set the enabled state of the mouse tracking region
  4700. *
  4701. * Parameters:
  4702. *
  4703. * inMouseRef:
  4704. * A valid MouseTrackingRef to modify.
  4705. *
  4706. * inEnabled:
  4707. * Indicate whether this region should be enabled (true) or
  4708. * disabled (false).
  4709. *
  4710. * Result:
  4711. * An operating system status code.
  4712. *
  4713. * Availability:
  4714. * Non-Carbon CFM: not available
  4715. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  4716. * Mac OS X: in version 10.2 and later
  4717. */
  4718. EXTERN_API_C( OSStatus )
  4719. SetMouseTrackingRegionEnabled(
  4720. MouseTrackingRef inMouseRef,
  4721. Boolean inEnabled);
  4722. /*
  4723. Namespace operators
  4724. */
  4725. /*
  4726. * ClipWindowMouseTrackingRegions()
  4727. *
  4728. * Discussion:
  4729. * Bulk clip operation to modify the region that all mouse tracking
  4730. * regions with the given signature will be clipped against.
  4731. *
  4732. * Parameters:
  4733. *
  4734. * inWindow:
  4735. * The window that contains the regions with the given signature
  4736. * that you are interested in updating.
  4737. *
  4738. * inSignature:
  4739. * The signature of the mouse tracking regions that will be
  4740. * reclipped.
  4741. *
  4742. * inClip:
  4743. * The region to clip all of the regions against (can be NULL). If
  4744. * NULL, standard clipping will be provided.
  4745. *
  4746. * Result:
  4747. * An operating system status code.
  4748. *
  4749. * Availability:
  4750. * Non-Carbon CFM: not available
  4751. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  4752. * Mac OS X: in version 10.2 and later
  4753. */
  4754. EXTERN_API_C( OSStatus )
  4755. ClipWindowMouseTrackingRegions(
  4756. WindowRef inWindow,
  4757. OSType inSignature,
  4758. RgnHandle inClip); /* can be NULL */
  4759. /*
  4760. * MoveWindowMouseTrackingRegions()
  4761. *
  4762. * Discussion:
  4763. * Bulk move operation to move all regions with the given signature
  4764. * the specified delta. An optional clip can be provided to reclip
  4765. * the regions against, such as in the case of the regions are being
  4766. * scrolled within a pane.
  4767. *
  4768. * Parameters:
  4769. *
  4770. * inWindow:
  4771. * The window that contains the regions with the given signature
  4772. * that you are interested in moving.
  4773. *
  4774. * inSignature:
  4775. * The signature of the mouse tracking regions that will be moved.
  4776. *
  4777. * deltaH:
  4778. * The horizontal delta to move all of the regions.
  4779. *
  4780. * deltaV:
  4781. * The vertical delta to move all of the regions.
  4782. *
  4783. * inClip:
  4784. * An optional clipping region to clip against (can be NULL). If
  4785. * NULL, standard clipping will be provided.
  4786. *
  4787. * Result:
  4788. * An operating system status code.
  4789. *
  4790. * Availability:
  4791. * Non-Carbon CFM: not available
  4792. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  4793. * Mac OS X: in version 10.2 and later
  4794. */
  4795. EXTERN_API_C( OSStatus )
  4796. MoveWindowMouseTrackingRegions(
  4797. WindowRef inWindow,
  4798. OSType inSignature,
  4799. SInt16 deltaH,
  4800. SInt16 deltaV,
  4801. RgnHandle inClip); /* can be NULL */
  4802. /*
  4803. * SetWindowMouseTrackingRegionsEnabled()
  4804. *
  4805. * Discussion:
  4806. * Bulk set the enabled state of the mouse tracking regions of the
  4807. * given signature belonging to the given window.
  4808. *
  4809. * Parameters:
  4810. *
  4811. * inWindow:
  4812. * The window which contains the mouse tracking regions that you
  4813. * are interested in modifying.
  4814. *
  4815. * inSignature:
  4816. * The signature of the mouse tracking regions whose enabled state
  4817. * you wish to modify.
  4818. *
  4819. * inEnabled:
  4820. * Indicates whether the regions should be enabled (true) or
  4821. * disabled (false).
  4822. *
  4823. * Result:
  4824. * An operating system status code.
  4825. *
  4826. * Availability:
  4827. * Non-Carbon CFM: not available
  4828. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  4829. * Mac OS X: in version 10.2 and later
  4830. */
  4831. EXTERN_API_C( OSStatus )
  4832. SetWindowMouseTrackingRegionsEnabled(
  4833. WindowRef inWindow,
  4834. OSType inSignature,
  4835. Boolean inEnabled);
  4836. /*
  4837. * ReleaseWindowMouseTrackingRegions()
  4838. *
  4839. * Discussion:
  4840. * Bulk release the mouse tracking regions with the given signature.
  4841. *
  4842. * Parameters:
  4843. *
  4844. * inWindow:
  4845. * The window to which the regions to be released belong.
  4846. *
  4847. * inSignature:
  4848. * The signature of the regions to be released.
  4849. *
  4850. * Result:
  4851. * An operating system status code.
  4852. *
  4853. * Availability:
  4854. * Non-Carbon CFM: not available
  4855. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  4856. * Mac OS X: in version 10.2 and later
  4857. */
  4858. EXTERN_API_C( OSStatus )
  4859. ReleaseWindowMouseTrackingRegions(
  4860. WindowRef inWindow,
  4861. OSType inSignature);
  4862. /* OBSOLETE CONSTANTS*/
  4863. enum {
  4864. kMouseTrackingMousePressed = kMouseTrackingMouseDown,
  4865. kMouseTrackingMouseReleased = kMouseTrackingMouseUp
  4866. };
  4867. enum {
  4868. kEventControlGetSubviewForMouseEvent = kEventControlInterceptSubviewClick
  4869. };
  4870. #if PRAGMA_STRUCT_ALIGN
  4871. #pragma options align=reset
  4872. #elif PRAGMA_STRUCT_PACKPUSH
  4873. #pragma pack(pop)
  4874. #elif PRAGMA_STRUCT_PACK
  4875. #pragma pack()
  4876. #endif
  4877. #ifdef PRAGMA_IMPORT_OFF
  4878. #pragma import off
  4879. #elif PRAGMA_IMPORT
  4880. #pragma import reset
  4881. #endif
  4882. #ifdef __cplusplus
  4883. }
  4884. #endif
  4885. #endif /* __CARBONEVENTS__ */