HIScrollView.pas 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794
  1. {
  2. File: HIToolbox/HIScrollView.h
  3. Contains: Definition of the scrollbar and scroll views provided by HIToolbox.
  4. Version: HIToolbox-624~3
  5. Copyright: © 2006-2008 by Apple Computer, Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://bugs.freepascal.org
  9. }
  10. { Initial Pascal Translation: Jonas Maebe, <[email protected]>, October 2009 }
  11. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2012 }
  12. {
  13. Modified for use with Free Pascal
  14. Version 308
  15. Please report any bugs to <[email protected]>
  16. }
  17. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  18. {$mode macpas}
  19. {$modeswitch cblocks}
  20. {$packenum 1}
  21. {$macro on}
  22. {$inline on}
  23. {$calling mwpascal}
  24. unit HIScrollView;
  25. interface
  26. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  27. {$setc GAP_INTERFACES_VERSION := $0308}
  28. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  29. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  30. {$endc}
  31. {$ifc defined CPUPOWERPC and defined CPUI386}
  32. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  33. {$endc}
  34. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  35. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  36. {$endc}
  37. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  38. {$setc __ppc__ := 1}
  39. {$elsec}
  40. {$setc __ppc__ := 0}
  41. {$endc}
  42. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  43. {$setc __ppc64__ := 1}
  44. {$elsec}
  45. {$setc __ppc64__ := 0}
  46. {$endc}
  47. {$ifc not defined __i386__ and defined CPUI386}
  48. {$setc __i386__ := 1}
  49. {$elsec}
  50. {$setc __i386__ := 0}
  51. {$endc}
  52. {$ifc not defined __x86_64__ and defined CPUX86_64}
  53. {$setc __x86_64__ := 1}
  54. {$elsec}
  55. {$setc __x86_64__ := 0}
  56. {$endc}
  57. {$ifc not defined __arm__ and defined CPUARM}
  58. {$setc __arm__ := 1}
  59. {$elsec}
  60. {$setc __arm__ := 0}
  61. {$endc}
  62. {$ifc not defined __arm64__ and defined CPUAARCH64}
  63. {$setc __arm64__ := 1}
  64. {$elsec}
  65. {$setc __arm64__ := 0}
  66. {$endc}
  67. {$ifc defined cpu64}
  68. {$setc __LP64__ := 1}
  69. {$elsec}
  70. {$setc __LP64__ := 0}
  71. {$endc}
  72. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  73. {$error Conflicting definitions for __ppc__ and __i386__}
  74. {$endc}
  75. {$ifc defined __ppc__ and __ppc__}
  76. {$setc TARGET_CPU_PPC := TRUE}
  77. {$setc TARGET_CPU_PPC64 := FALSE}
  78. {$setc TARGET_CPU_X86 := FALSE}
  79. {$setc TARGET_CPU_X86_64 := FALSE}
  80. {$setc TARGET_CPU_ARM := FALSE}
  81. {$setc TARGET_CPU_ARM64 := FALSE}
  82. {$setc TARGET_OS_MAC := TRUE}
  83. {$setc TARGET_OS_IPHONE := FALSE}
  84. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  85. {$setc TARGET_OS_EMBEDDED := FALSE}
  86. {$elifc defined __ppc64__ and __ppc64__}
  87. {$setc TARGET_CPU_PPC := FALSE}
  88. {$setc TARGET_CPU_PPC64 := TRUE}
  89. {$setc TARGET_CPU_X86 := FALSE}
  90. {$setc TARGET_CPU_X86_64 := FALSE}
  91. {$setc TARGET_CPU_ARM := FALSE}
  92. {$setc TARGET_CPU_ARM64 := FALSE}
  93. {$setc TARGET_OS_MAC := TRUE}
  94. {$setc TARGET_OS_IPHONE := FALSE}
  95. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  96. {$setc TARGET_OS_EMBEDDED := FALSE}
  97. {$elifc defined __i386__ and __i386__}
  98. {$setc TARGET_CPU_PPC := FALSE}
  99. {$setc TARGET_CPU_PPC64 := FALSE}
  100. {$setc TARGET_CPU_X86 := TRUE}
  101. {$setc TARGET_CPU_X86_64 := FALSE}
  102. {$setc TARGET_CPU_ARM := FALSE}
  103. {$setc TARGET_CPU_ARM64 := FALSE}
  104. {$ifc defined iphonesim}
  105. {$setc TARGET_OS_MAC := FALSE}
  106. {$setc TARGET_OS_IPHONE := TRUE}
  107. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  108. {$elsec}
  109. {$setc TARGET_OS_MAC := TRUE}
  110. {$setc TARGET_OS_IPHONE := FALSE}
  111. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  112. {$endc}
  113. {$setc TARGET_OS_EMBEDDED := FALSE}
  114. {$elifc defined __x86_64__ and __x86_64__}
  115. {$setc TARGET_CPU_PPC := FALSE}
  116. {$setc TARGET_CPU_PPC64 := FALSE}
  117. {$setc TARGET_CPU_X86 := FALSE}
  118. {$setc TARGET_CPU_X86_64 := TRUE}
  119. {$setc TARGET_CPU_ARM := FALSE}
  120. {$setc TARGET_CPU_ARM64 := FALSE}
  121. {$ifc defined iphonesim}
  122. {$setc TARGET_OS_MAC := FALSE}
  123. {$setc TARGET_OS_IPHONE := TRUE}
  124. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  125. {$elsec}
  126. {$setc TARGET_OS_MAC := TRUE}
  127. {$setc TARGET_OS_IPHONE := FALSE}
  128. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  129. {$endc}
  130. {$setc TARGET_OS_EMBEDDED := FALSE}
  131. {$elifc defined __arm__ and __arm__}
  132. {$setc TARGET_CPU_PPC := FALSE}
  133. {$setc TARGET_CPU_PPC64 := FALSE}
  134. {$setc TARGET_CPU_X86 := FALSE}
  135. {$setc TARGET_CPU_X86_64 := FALSE}
  136. {$setc TARGET_CPU_ARM := TRUE}
  137. {$setc TARGET_CPU_ARM64 := FALSE}
  138. {$setc TARGET_OS_MAC := FALSE}
  139. {$setc TARGET_OS_IPHONE := TRUE}
  140. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  141. {$setc TARGET_OS_EMBEDDED := TRUE}
  142. {$elifc defined __arm64__ and __arm64__}
  143. {$setc TARGET_CPU_PPC := FALSE}
  144. {$setc TARGET_CPU_PPC64 := FALSE}
  145. {$setc TARGET_CPU_X86 := FALSE}
  146. {$setc TARGET_CPU_X86_64 := FALSE}
  147. {$setc TARGET_CPU_ARM := FALSE}
  148. {$setc TARGET_CPU_ARM64 := TRUE}
  149. {$ifc defined ios}
  150. {$setc TARGET_OS_MAC := FALSE}
  151. {$setc TARGET_OS_IPHONE := TRUE}
  152. {$setc TARGET_OS_EMBEDDED := TRUE}
  153. {$elsec}
  154. {$setc TARGET_OS_MAC := TRUE}
  155. {$setc TARGET_OS_IPHONE := FALSE}
  156. {$setc TARGET_OS_EMBEDDED := FALSE}
  157. {$endc}
  158. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  159. {$elsec}
  160. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  161. {$endc}
  162. {$ifc defined __LP64__ and __LP64__ }
  163. {$setc TARGET_CPU_64 := TRUE}
  164. {$elsec}
  165. {$setc TARGET_CPU_64 := FALSE}
  166. {$endc}
  167. {$ifc defined FPC_BIG_ENDIAN}
  168. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  169. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  170. {$elifc defined FPC_LITTLE_ENDIAN}
  171. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  172. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  173. {$elsec}
  174. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  175. {$endc}
  176. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  177. {$setc CALL_NOT_IN_CARBON := FALSE}
  178. {$setc OLDROUTINENAMES := FALSE}
  179. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  180. {$setc OPAQUE_UPP_TYPES := TRUE}
  181. {$setc OTCARBONAPPLICATION := TRUE}
  182. {$setc OTKERNEL := FALSE}
  183. {$setc PM_USE_SESSION_APIS := TRUE}
  184. {$setc TARGET_API_MAC_CARBON := TRUE}
  185. {$setc TARGET_API_MAC_OS8 := FALSE}
  186. {$setc TARGET_API_MAC_OSX := TRUE}
  187. {$setc TARGET_CARBON := TRUE}
  188. {$setc TARGET_CPU_68K := FALSE}
  189. {$setc TARGET_CPU_MIPS := FALSE}
  190. {$setc TARGET_CPU_SPARC := FALSE}
  191. {$setc TARGET_OS_UNIX := FALSE}
  192. {$setc TARGET_OS_WIN32 := FALSE}
  193. {$setc TARGET_RT_MAC_68881 := FALSE}
  194. {$setc TARGET_RT_MAC_CFM := FALSE}
  195. {$setc TARGET_RT_MAC_MACHO := TRUE}
  196. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  197. {$setc TYPE_BOOL := FALSE}
  198. {$setc TYPE_EXTENDED := FALSE}
  199. {$setc TYPE_LONGLONG := TRUE}
  200. uses MacTypes,Appearance,CarbonEvents,Controls,QuickdrawTypes,HIObject,HIView;
  201. {$endc} {not MACOSALLINCLUDE}
  202. {$ifc TARGET_OS_MAC}
  203. {$ALIGN POWER}
  204. {
  205. * HIScrollView.h
  206. *
  207. * Discussion:
  208. * API definitions for the scrollbar and scroll views.
  209. }
  210. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  211. { ¥ SCROLL BAR (CDEF 24) }
  212. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  213. { This is the new Appearance scroll bar. }
  214. { Mac OS X has a "Scroll to here" option in the General pane of System Preferences }
  215. { which allows users to click in the page up/down regions of a scroll bar and have }
  216. { the thumb/indicator jump directly to the clicked position, which alters the value }
  217. { of the scroll bar and moves the scrolled content appropriately. As long as the }
  218. { mouse button is held down, the click is treated as though the user had clicked in }
  219. { the thumb/indicator in the first place. }
  220. { If you want the scroll bars in your application to work with the "Scroll to here" }
  221. { option, you must do the following: }
  222. { 1. Create live-tracking scroll bars, not scroll bars that show a "ghost" thumb }
  223. { when you click on it. You can request live-tracking scroll bars by passing true }
  224. { in the liveTracking parameter to CreateScrollBarControl. If you create scroll bars }
  225. { with NewControl, use the kControlScrollBarLiveProc. }
  226. { 2. Write an appropriate ControlActionProc and associate it with your scroll bar }
  227. { via the SetControlAction API. This allows your application to update its content }
  228. { appropriately when the live-tracking scroll bar is clicked. }
  229. { 3. When calling HandleControlClick or TrackControl, pass -1 in the action proc }
  230. { parameter. This is a request for the Control Manager to use the action proc you }
  231. { associated with your control in step 2. If you rely on the standard window event }
  232. { handler to do your control tracking, this step is handled for you automatically. }
  233. { Theme Scroll Bar proc IDs }
  234. const
  235. kControlScrollBarProc = 384; { normal scroll bar}
  236. kControlScrollBarLiveProc = 386; { live scrolling variant}
  237. { Control Kind Tag }
  238. const
  239. kControlKindScrollBar = FourCharCode('sbar');
  240. { The HIObject class ID for the HIScrollBar class. }
  241. {$ifc USE_CFSTR_CONSTANT_MACROS}
  242. {$definec kHIScrollBarClassID CFSTRP('com.apple.HIScrollBar')}
  243. {$endc}
  244. {$ifc not TARGET_CPU_64}
  245. {
  246. * CreateScrollBarControl()
  247. *
  248. * Summary:
  249. * Creates a scroll bar control.
  250. *
  251. * Discussion:
  252. * This creation API is available in Carbon only.
  253. *
  254. * Mac OS X threading:
  255. * Not thread safe
  256. *
  257. * Parameters:
  258. *
  259. * window:
  260. * The window that should contain the control. May be NULL on 10.3
  261. * and later.
  262. *
  263. * boundsRect:
  264. * The bounding box of the control.
  265. *
  266. * value:
  267. * The initial value of the control.
  268. *
  269. * minimum:
  270. * The minimum value of the control.
  271. *
  272. * maximum:
  273. * The maximum value of the control.
  274. *
  275. * viewSize:
  276. * The size of the visible area of the scroll bar content.
  277. *
  278. * liveTracking:
  279. * A Boolean indicating whether or not live tracking is enabled
  280. * for this scroll bar. If set to true and a valid
  281. * liveTrackingProc is also passed in, the callback will be called
  282. * repeatedly as the thumb is moved during tracking. If set to
  283. * false, a semi-transparent thumb called a "ghost thumb" will
  284. * draw and no live tracking will occur.
  285. *
  286. * liveTrackingProc:
  287. * If liveTracking is on, a ControlActionUPP callback to be called
  288. * as the control live tracks. This callback is called repeatedly
  289. * as the scroll thumb is moved during tracking.
  290. *
  291. * outControl:
  292. * On exit, contains the new control.
  293. *
  294. * Availability:
  295. * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
  296. * CarbonLib: in CarbonLib 1.1 and later
  297. * Non-Carbon CFM: not available
  298. }
  299. function CreateScrollBarControl( window: WindowRef; const (*var*) boundsRect: Rect; value: SInt32; minimum: SInt32; maximum: SInt32; viewSize: SInt32; liveTracking: Boolean; liveTrackingProc: ControlActionUPP; var outControl: ControlRef ): OSStatus; external name '_CreateScrollBarControl';
  300. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  301. { These tags are available in Mac OS X or later }
  302. {$endc} {not TARGET_CPU_64}
  303. const
  304. kControlScrollBarShowsArrowsTag = FourCharCode('arro'); { Boolean whether or not to draw the scroll arrows}
  305. {==============================================================================}
  306. { HIScrollView }
  307. { The scroll view is a new view starting in Mac OS 10.2. It can be used in }
  308. { the new compositing mode ONLY due to the nature of how it works. Like all }
  309. { new HIFoo views, this view is created invisibly. You must show the view }
  310. { after creation if you want to, like, see it and stuff. }
  311. { The HIScrollView will set the frame of the contained view when its bounds }
  312. { change, so it is not necessary to set up the layout of the embedded view. }
  313. { Using an HIScrollView requires a few steps: }
  314. { 1. Install your scrollable content view into the HIScrollView instance using }
  315. { HIViewAddSubview. }
  316. { 2. If the scrollable content view doesn't already handle the }
  317. { kEventScrollableGetInfo and kEventScrollableScrollTo events, you must }
  318. { install handlers on your scrollable content view and handle those events }
  319. { manually. More details on those events can be found below. }
  320. { 3. If the scrollable content view doesn't already send out the }
  321. { kEventScrollableInfoChanged event to its parent view, you must send this }
  322. { event to the HIScrollView instance whenever your scrollable content }
  323. { view's size or origin changes. More details on this event can be found }
  324. { below. }
  325. {==============================================================================}
  326. { The HIObject class ID for the HIScrollView class. }
  327. {$ifc USE_CFSTR_CONSTANT_MACROS}
  328. {$definec kHIScrollViewClassID CFSTRP('com.apple.HIScrollView')}
  329. {$endc}
  330. { Control Kind}
  331. const
  332. kControlKindHIScrollView = FourCharCode('scrl');
  333. {
  334. kEventClassScrollable quick reference:
  335. kEventScrollableGetInfo = 1,
  336. kEventScrollableInfoChanged = 2,
  337. kEventScrollableScrollTo = 10
  338. }
  339. const
  340. kEventClassScrollable = FourCharCode('scrl');
  341. const
  342. {
  343. * The image size is the total size of the scrollable view, including
  344. * any parts of the view that are not currently visible. For example,
  345. * a scrollable view that displays a 100-page document would return a
  346. * horizontal size equal to the width of a page and a vertical image
  347. * size equal to 100 times the height of a page.
  348. }
  349. kEventParamImageSize = FourCharCode('imsz'); { typeHISize}
  350. {
  351. * The view size is the current size of the scrollable view.
  352. * Typically, this is the same as the view's bounds, and can be
  353. * acquired by calling HIViewGetBounds.
  354. }
  355. kEventParamViewSize = FourCharCode('vwsz'); { typeHISize}
  356. {
  357. * The line size is the distance that the HIScrollView should scroll
  358. * its subview when the user clicks the scroll bar arrows. For
  359. * example, this might be 10 pixels vertically and 20 pixels
  360. * horizontally.
  361. }
  362. kEventParamLineSize = FourCharCode('lnsz'); { typeHISize}
  363. {
  364. * The origin is the current view-relative origin with the total
  365. * scrollable image that is displayed at the top left corner of the
  366. * view. These coordinates should always be greater than or equal to
  367. * zero. They should be less than or equal to the viewÕs image size
  368. * minus its view size. Typically, a view that implements the
  369. * kEventScrollableScrollTo event by calling HIViewSetBoundsOrigin
  370. * will return the current bounds origin for this parameter, and a
  371. * view that implements the ScrollTo event by storing the origin in
  372. * its instance data will return its stored origin for this
  373. * parameter. For example, a scrollable view that is currently
  374. * displaying page 10 of a 100-page document would return a
  375. * horizontal origin of zero and a vertical origin equal to 10 times
  376. * the height of a page.
  377. }
  378. kEventParamOrigin = FourCharCode('orgn'); { typeHIPoint}
  379. {
  380. * kEventClassScrollable / kEventScrollableGetInfo
  381. *
  382. * Summary:
  383. * Requests information from an HIScrollViewÕs scrollable view about
  384. * its size and origin.
  385. *
  386. * Discussion:
  387. * This event is sent by an HIScrollView to its scrollable view to
  388. * determine the current size and origin of the scrollable view. A
  389. * scrollable view must implement this event in order to scroll
  390. * properly inside an HIScrollView. This event is sent only to the
  391. * view, and is not propagated past it.
  392. *
  393. * Mac OS X threading:
  394. * Not thread safe
  395. *
  396. * Parameters:
  397. *
  398. * <-- kEventParamImageSize (out, typeHISize)
  399. * On exit, contains the size of the entire scrollable view.
  400. *
  401. * <-- kEventParamViewSize (out, typeHISize)
  402. * On exit, contains the amount of the scrollable view that is
  403. * visible.
  404. *
  405. * <-- kEventParamLineSize (out, typeHISize)
  406. * On exit, contains the amount that should be scrolled in
  407. * response to a single click on a scrollbar arrow.
  408. *
  409. * <-- kEventParamOrigin (out, typeHIPoint)
  410. * On exit, contains the scrollable viewÕs current origin.
  411. *
  412. * Availability:
  413. * Mac OS X: in version 10.2 and later in Carbon.framework
  414. * CarbonLib: not available
  415. }
  416. const
  417. kEventScrollableGetInfo = 1;
  418. {
  419. * kEventClassScrollable / kEventScrollableInfoChanged
  420. *
  421. * Summary:
  422. * Notification that the size or origin of an HIScrollViewÕs
  423. * scrollable view has changed.
  424. *
  425. * Discussion:
  426. * This event is not sent by HIScrollView itself; rather, it may be
  427. * sent to an instance of HIScrollView to notify the scroll view
  428. * that the size or origin of its scrollable view have changed. The
  429. * HIScrollView responds to this event by sending a
  430. * kEventScrollableGetInfo to its scrollable view. It then updates
  431. * the scroll bars appropriately to reflect the new reality of the
  432. * scrollable view. It does NOT move the origin of the scrollable
  433. * view at all. It is just a notification to allow the scroll view
  434. * to sync up with its scrollable view.
  435. *
  436. * Mac OS X threading:
  437. * Not thread safe
  438. *
  439. * Availability:
  440. * Mac OS X: in version 10.2 and later in Carbon.framework
  441. * CarbonLib: not available
  442. }
  443. const
  444. kEventScrollableInfoChanged = 2;
  445. {
  446. * kEventClassScrollable / kEventScrollableScrollTo
  447. *
  448. * Summary:
  449. * Requests that an HIScrollViewÕs scrollable view should scroll to
  450. * a particular origin.
  451. *
  452. * Discussion:
  453. * This event is sent by an HIScrollView to its scrollable view to
  454. * request that the scrollable view update its current origin and
  455. * redraw. Typically, a scrollable view scrolls its content either
  456. * by setting its bounds origin with HIViewSetBoundsOrigin or by
  457. * offsetting its drawing by the scroll origin. If the view embeds
  458. * other views, it must use HIViewSetBoundsOrigin to allow the
  459. * embedded views to scroll along with their containing view. A view
  460. * that uses HIViewSetBoundsOrigin should call that API in response
  461. * to this event; a view that offsets its drawing by the scroll
  462. * origin should update its current origin in its own instance data
  463. * in response to this event. A scrollable view should also use
  464. * either HIViewScrollRect to scroll its content, or
  465. * HIViewSetNeedsDisplay to cause itself to redraw using the new
  466. * origin point. A scrollable view must implement this event in
  467. * order to scroll properly inside an HIScrollView.
  468. *
  469. * Mac OS X threading:
  470. * Not thread safe
  471. *
  472. * Parameters:
  473. *
  474. * --> kEventParamOrigin (in, typeHIPoint)
  475. * The new origin for the scrollable view. The origin
  476. * coordinates will vary from (0,0) to the scrollable viewÕs
  477. * image size minus its view size.
  478. *
  479. * Availability:
  480. * Mac OS X: in version 10.2 and later in Carbon.framework
  481. * CarbonLib: not available
  482. }
  483. const
  484. kEventScrollableScrollTo = 10;
  485. {
  486. * Summary:
  487. * HIScrollView options
  488. }
  489. const
  490. {
  491. * This indicates that a vertical scroll bar is desired.
  492. }
  493. kHIScrollViewOptionsVertScroll = 1 shl 0;
  494. {
  495. * This indicates that a horizontal scroll bar is desired.
  496. }
  497. kHIScrollViewOptionsHorizScroll = 1 shl 1;
  498. {
  499. * This indicates that space for a grow box should be taken into
  500. * account when laying out scroll bars. On Mac OS X 10.3 and earlier,
  501. * if both the horizontal and vertical scroll bars are requested,
  502. * this attribute is assumed. On Mac OS X 10.4 and later, this
  503. * attribute is *NOT* assumed; this allows the scroll view to support
  504. * auto-hiding of the two scroll bars independently on Mac OS X 10.4
  505. * and later. If you want to preserve space for the grow box on all
  506. * systems, specify this option bit.
  507. }
  508. kHIScrollViewOptionsAllowGrow = 1 shl 2;
  509. {
  510. * This indicates that if the grow area is visible, then the scroll
  511. * view should fill it with white. Available in Mac OS X 10.5 and
  512. * later.
  513. }
  514. kHIScrollViewOptionsFillGrowArea = 1 shl 3;
  515. {
  516. * Indicates that the scroll view should never use smooth scrolling,
  517. * overriding the user's preference. Applications should rarely use
  518. * this option, but it may be appropriate for certain cases.
  519. }
  520. kHIScrollViewOptionsDisableSmoothScrolling = 1 shl 4;
  521. kHIScrollViewValidOptions = kHIScrollViewOptionsVertScroll or kHIScrollViewOptionsHorizScroll or kHIScrollViewOptionsAllowGrow or kHIScrollViewOptionsFillGrowArea or kHIScrollViewOptionsDisableSmoothScrolling;
  522. {
  523. * HIScrollViewAction
  524. *
  525. * Summary:
  526. * HIScrollView navigation actions. See HIScrollViewNavigate for
  527. * more information.
  528. }
  529. type
  530. HIScrollViewAction = UInt32;
  531. const
  532. {
  533. * The scroll view should move to the top of the content.
  534. }
  535. kHIScrollViewScrollToTop = 1 shl 0;
  536. {
  537. * The scroll view should move to the bottom of the content.
  538. }
  539. kHIScrollViewScrollToBottom = 1 shl 1;
  540. {
  541. * The scroll view should move to the left of the content.
  542. }
  543. kHIScrollViewScrollToLeft = 1 shl 2;
  544. {
  545. * The scroll view should move to the right of the content.
  546. }
  547. kHIScrollViewScrollToRight = 1 shl 3;
  548. {
  549. * The scroll view should page up.
  550. }
  551. kHIScrollViewPageUp = 1 shl 4;
  552. {
  553. * The scroll view should page down.
  554. }
  555. kHIScrollViewPageDown = 1 shl 5;
  556. {
  557. * The scroll view should page left.
  558. }
  559. kHIScrollViewPageLeft = 1 shl 6;
  560. {
  561. * The scroll view should page right.
  562. }
  563. kHIScrollViewPageRight = 1 shl 7;
  564. {$ifc not TARGET_CPU_64}
  565. {
  566. * HIScrollViewCreate()
  567. *
  568. * Discussion:
  569. * Creates a scroll view. This view has 3 parts, essentially. It can
  570. * have one or two scroll bars (horizontal/vertical), and a view to
  571. * be scrolled. The view to be scrolled is merely added via
  572. * HIViewAddSubview. The scroll view will automatically connect it
  573. * up appropriately. By default, the HIScrollView will not
  574. * automatically hide the scroll bars if the content fits within the
  575. * scrollable view. Use the HIScrollViewSetScrollBarAutoHide API to
  576. * enable that feature.
  577. *
  578. * Mac OS X threading:
  579. * Not thread safe
  580. *
  581. * Parameters:
  582. *
  583. * inOptions:
  584. * Options for our scroll view. You must specify either a
  585. * horizontal or a vertical scroll bar. If neither is passed, an
  586. * error is returned.
  587. *
  588. * outView:
  589. * The new scroll view.
  590. *
  591. * Result:
  592. * An operating system result code.
  593. *
  594. * Availability:
  595. * Mac OS X: in version 10.2 and later in Carbon.framework [32-bit only]
  596. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  597. * Non-Carbon CFM: not available
  598. }
  599. function HIScrollViewCreate( inOptions: OptionBits; var outView: HIViewRef ): OSStatus; external name '_HIScrollViewCreate';
  600. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  601. {
  602. * HIScrollViewSetScrollBarAutoHide()
  603. *
  604. * Discussion:
  605. * Sets a scroll view's scroll bars to auto-hide when the entire
  606. * scrollable view it is managing can be fully displayed in its
  607. * bounds. This is similar to the behavior you see in the Preview
  608. * application.
  609. *
  610. * Mac OS X threading:
  611. * Not thread safe
  612. *
  613. * Parameters:
  614. *
  615. * inView:
  616. * The view to affect.
  617. *
  618. * inAutoHide:
  619. * The new auto-hide setting (true == auto-hide).
  620. *
  621. * Result:
  622. * An operating system result code.
  623. *
  624. * Availability:
  625. * Mac OS X: in version 10.2 and later in Carbon.framework [32-bit only]
  626. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  627. * Non-Carbon CFM: not available
  628. }
  629. function HIScrollViewSetScrollBarAutoHide( inView: HIViewRef; inAutoHide: Boolean ): OSStatus; external name '_HIScrollViewSetScrollBarAutoHide';
  630. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  631. {
  632. * HIScrollViewGetScrollBarAutoHide()
  633. *
  634. * Discussion:
  635. * Gets a scroll view's current scroll bar auto-hide setting.
  636. *
  637. * Mac OS X threading:
  638. * Not thread safe
  639. *
  640. * Parameters:
  641. *
  642. * inView:
  643. * The view to examine.
  644. *
  645. * Result:
  646. * A boolean result.
  647. *
  648. * Availability:
  649. * Mac OS X: in version 10.2 and later in Carbon.framework [32-bit only]
  650. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  651. * Non-Carbon CFM: not available
  652. }
  653. function HIScrollViewGetScrollBarAutoHide( inView: HIViewRef ): Boolean; external name '_HIScrollViewGetScrollBarAutoHide';
  654. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  655. {
  656. * HIScrollViewNavigate()
  657. *
  658. * Discussion:
  659. * Allows you to programmatically change what portion of a scroll
  660. * view's target you are seeing. For example, you can move to the
  661. * beginning or end of a document. You can also page up, down, left
  662. * and right. In general, you should not call this from embedded
  663. * content (i.e. the scrollable view inside the scroll view). For
  664. * those cases, you should instead position yourself appropriately
  665. * and tell the scroll view you changed via the
  666. * kEventScrollableInfoChanged carbon event. This routine merely is
  667. * a programmatic way to scroll as one would by hand using the
  668. * scroll bars.
  669. *
  670. * Mac OS X threading:
  671. * Not thread safe
  672. *
  673. * Parameters:
  674. *
  675. * inView:
  676. * The scroll view to affect.
  677. *
  678. * inAction:
  679. * The action to take.
  680. *
  681. * Result:
  682. * A operating system status code.
  683. *
  684. * Availability:
  685. * Mac OS X: in version 10.3 and later in Carbon.framework [32-bit only]
  686. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  687. * Non-Carbon CFM: not available
  688. }
  689. function HIScrollViewNavigate( inView: HIViewRef; inAction: HIScrollViewAction ): OSStatus; external name '_HIScrollViewNavigate';
  690. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  691. {
  692. * HIScrollViewCanNavigate()
  693. *
  694. * Discussion:
  695. * Allows you to tell whether it is currently possible to navigate
  696. * somehow in a scroll view. For example, if a scroll view is
  697. * already at the top of the scrollable content, it is not possible
  698. * to navigate upward, so home and page up actions would not be
  699. * possible. You might use this function to help you update the
  700. * state of menu items or the like.
  701. *
  702. * Mac OS X threading:
  703. * Not thread safe
  704. *
  705. * Parameters:
  706. *
  707. * inView:
  708. * The view to examine.
  709. *
  710. * inAction:
  711. * The action to test.
  712. *
  713. * Result:
  714. * A boolean result.
  715. *
  716. * Availability:
  717. * Mac OS X: in version 10.3 and later in Carbon.framework [32-bit only]
  718. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  719. * Non-Carbon CFM: not available
  720. }
  721. function HIScrollViewCanNavigate( inView: HIViewRef; inAction: HIScrollViewAction ): Boolean; external name '_HIScrollViewCanNavigate';
  722. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  723. {$endc} {not TARGET_CPU_64}
  724. {$endc} {TARGET_OS_MAC}
  725. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  726. end.
  727. {$endc} {not MACOSALLINCLUDE}