HIGeometry.pas 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. {
  2. File: HIToolbox/HIGeometry.h
  3. Contains: HIToolbox interfaces for geometry
  4. Version: HIToolbox-219.4.81~2
  5. Copyright: © 1984-2005 by Apple Computer, Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://www.freepascal.org/bugs.html
  9. }
  10. { Pascal Translation: Peter N Lewis, <[email protected]>, August 2005 }
  11. {
  12. Modified for use with Free Pascal
  13. Version 210
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$mode macpas}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$calling mwpascal}
  21. unit HIGeometry;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  24. {$setc GAP_INTERFACES_VERSION := $0210}
  25. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  26. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  27. {$endc}
  28. {$ifc defined CPUPOWERPC and defined CPUI386}
  29. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  30. {$endc}
  31. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  32. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  33. {$endc}
  34. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __i386__ and defined CPUI386}
  40. {$setc __i386__ := 1}
  41. {$elsec}
  42. {$setc __i386__ := 0}
  43. {$endc}
  44. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  45. {$error Conflicting definitions for __ppc__ and __i386__}
  46. {$endc}
  47. {$ifc defined __ppc__ and __ppc__}
  48. {$setc TARGET_CPU_PPC := TRUE}
  49. {$setc TARGET_CPU_X86 := FALSE}
  50. {$elifc defined __i386__ and __i386__}
  51. {$setc TARGET_CPU_PPC := FALSE}
  52. {$setc TARGET_CPU_X86 := TRUE}
  53. {$elsec}
  54. {$error Neither __ppc__ nor __i386__ is defined.}
  55. {$endc}
  56. {$setc TARGET_CPU_PPC_64 := FALSE}
  57. {$ifc defined FPC_BIG_ENDIAN}
  58. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  59. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  60. {$elifc defined FPC_LITTLE_ENDIAN}
  61. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  62. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  63. {$elsec}
  64. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  65. {$endc}
  66. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  67. {$setc CALL_NOT_IN_CARBON := FALSE}
  68. {$setc OLDROUTINENAMES := FALSE}
  69. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  70. {$setc OPAQUE_UPP_TYPES := TRUE}
  71. {$setc OTCARBONAPPLICATION := TRUE}
  72. {$setc OTKERNEL := FALSE}
  73. {$setc PM_USE_SESSION_APIS := TRUE}
  74. {$setc TARGET_API_MAC_CARBON := TRUE}
  75. {$setc TARGET_API_MAC_OS8 := FALSE}
  76. {$setc TARGET_API_MAC_OSX := TRUE}
  77. {$setc TARGET_CARBON := TRUE}
  78. {$setc TARGET_CPU_68K := FALSE}
  79. {$setc TARGET_CPU_MIPS := FALSE}
  80. {$setc TARGET_CPU_SPARC := FALSE}
  81. {$setc TARGET_OS_MAC := TRUE}
  82. {$setc TARGET_OS_UNIX := FALSE}
  83. {$setc TARGET_OS_WIN32 := FALSE}
  84. {$setc TARGET_RT_MAC_68881 := FALSE}
  85. {$setc TARGET_RT_MAC_CFM := FALSE}
  86. {$setc TARGET_RT_MAC_MACHO := TRUE}
  87. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  88. {$setc TYPE_BOOL := FALSE}
  89. {$setc TYPE_EXTENDED := FALSE}
  90. {$setc TYPE_LONGLONG := TRUE}
  91. uses MacTypes,CGGeometry;
  92. {$ALIGN MAC68K}
  93. {
  94. * HIPoint
  95. *
  96. * Discussion:
  97. * HIPoint is a new, floating point-based type to help express
  98. * coordinates in a much richer fashion than the classic QuickDraw
  99. * points. It will, in time, be more heavily used throughout the
  100. * Toolbox. For now, it is replacing our use of typeQDPoint in mouse
  101. * events. This is to better support sub-pixel tablet coordinates.
  102. * If you ask for a mouse location with typeQDPoint, and the point
  103. * is actually stored as typeHIPoint, it will automatically be
  104. * coerced to typeQDPoint for you, so this change should be largely
  105. * transparent to applications. HIPoints are in screen space, i.e.
  106. * the top left of the screen is 0, 0.
  107. }
  108. type
  109. HIPoint = CGPoint;
  110. HIPointPtr = ^HIPoint;
  111. {
  112. * HISize
  113. *
  114. * Discussion:
  115. * HISize is a floating point-based type to help express dimensions
  116. * in a much richer fashion than the classic QuickDraw coordinates.
  117. }
  118. type
  119. HISize = CGSize;
  120. HISizePtr = ^HISize;
  121. {
  122. * HIRect
  123. *
  124. * Discussion:
  125. * HIRect is a new, floating point-based type to help express
  126. * rectangles in a much richer fashion than the classic QuickDraw
  127. * rects. It will, in time, be more heavily used throughout the
  128. * Toolbox. HIRects are in screen space, i.e. the top left of the
  129. * screen is 0, 0.
  130. }
  131. type
  132. HIRect = CGRect;
  133. HIRectPtr = ^HIRect;
  134. {
  135. * HIGetScaleFactor()
  136. *
  137. * Discussion:
  138. * Returns the resolution independence scale factor.
  139. *
  140. * Mac OS X threading:
  141. * Not thread safe
  142. *
  143. * Result:
  144. * A float indicating the resolution independence scale factor.
  145. *
  146. * Availability:
  147. * Mac OS X: in version 10.4 and later in Carbon.framework
  148. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  149. * Non-Carbon CFM: not available
  150. }
  151. function HIGetScaleFactor: Float32; external name '_HIGetScaleFactor';
  152. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  153. {
  154. * HICoordinateSpace
  155. *
  156. * Summary:
  157. * Coordinate spaces for use with HIPointConvert, HIRectConvert, and
  158. * HISizeConvert.
  159. }
  160. type
  161. HICoordinateSpace = UInt32;
  162. const
  163. {
  164. * The coordinate space defined by the position and sizes of the
  165. * screen GDevices. More correctly, this is a 72 DPI coordinate space
  166. * covering the screens. When the scale factor is not 1.0, this is
  167. * the compatibility notion of global coordinates. When the scale
  168. * factor is 1.0, this and kHICoordSpaceScreenPixel are the same.
  169. }
  170. kHICoordSpace72DPIGlobal = 1;
  171. {
  172. * The coordinate space defined by physical screen pixels. When the
  173. * scale factor is 1.0, this and kHICoordSpace72DPIGlobal are the
  174. * same.
  175. }
  176. kHICoordSpaceScreenPixel = 2;
  177. {
  178. * The coordinate space of a specified WindowRef, with ( 0, 0 ) at
  179. * the top left of the window's structure. When this is passed to a
  180. * conversion routine as a source or destination coordinate space,
  181. * you must also pass a WindowRef as a source or destination object.
  182. }
  183. kHICoordSpaceWindow = 3;
  184. {
  185. * The coordinate space of a given HIViewRef, with ( 0, 0 ) at the
  186. * top left of the view unless changed by HIViewSetBoundsOrigin. When
  187. * this is passed to a conversion routine as a source or destination
  188. * coordinate space, you must also pass an HIViewRef as a source or
  189. * destination object.
  190. }
  191. kHICoordSpaceView = 4;
  192. {
  193. * HIPointConvert()
  194. *
  195. * Discussion:
  196. * This routine converts an HIPoint from one coordinate space to
  197. * another. It takes into account the resolution-independent display
  198. * scale factor as appropriate.
  199. *
  200. * Mac OS X threading:
  201. * Not thread safe
  202. *
  203. * Parameters:
  204. *
  205. * ioPoint:
  206. * The HIPoint to convert.
  207. *
  208. * inSourceSpace:
  209. * The HICoordinateSpace constant specifying the source coordinate
  210. * space that the point is to be converted from. Some coordinate
  211. * spaces require the caller to pass extra information in the
  212. * inSourceObject parameter.
  213. *
  214. * inSourceObject:
  215. * An specific object defining the source coordinate space that
  216. * the point is to be converted from. You might pass a WindowRef
  217. * or an HIViewRef. If no object is necessary, you must pass NULL.
  218. * See the HICoordinateSpace documentation for details on which
  219. * HICoordinateSpaces require objects.
  220. *
  221. * inDestinationSpace:
  222. * The HICoordinateSpace constant specifying the destination
  223. * coordinate space that the point is to be converted to. Some
  224. * coordinate spaces require the caller to pass extra information
  225. * in the inDestinationObject parameter.
  226. *
  227. * inDestinationObject:
  228. * An specific object defining the destination coordinate space
  229. * that the point is to be converted to. You might pass a
  230. * WindowRef or an HIViewRef. If no object is necessary, you must
  231. * pass NULL. See the HICoordinateSpace documentation for details
  232. * on which HICoordinateSpaces require objects.
  233. *
  234. * Availability:
  235. * Mac OS X: in version 10.4 and later in Carbon.framework
  236. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  237. * Non-Carbon CFM: not available
  238. }
  239. procedure HIPointConvert( var ioPoint: HIPoint; inSourceSpace: HICoordinateSpace; inSourceObject: UnivPtr { can be NULL }; inDestinationSpace: HICoordinateSpace; inDestinationObject: UnivPtr { can be NULL } ); external name '_HIPointConvert';
  240. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  241. {
  242. * HIRectConvert()
  243. *
  244. * Discussion:
  245. * This routine converts an HIRect from one coordinate space to
  246. * another. It takes into account the resolution-independent display
  247. * scale factor as appropriate.
  248. *
  249. * Mac OS X threading:
  250. * Not thread safe
  251. *
  252. * Parameters:
  253. *
  254. * ioRect:
  255. * The HIRect to convert.
  256. *
  257. * inSourceSpace:
  258. * The HICoordinateSpace constant specifying the source coordinate
  259. * space that the rect is to be converted from. Some coordinate
  260. * spaces require the caller to pass extra information in the
  261. * inSourceObject parameter.
  262. *
  263. * inSourceObject:
  264. * An specific object defining the source coordinate space that
  265. * the rect is to be converted from. You might pass a WindowRef or
  266. * an HIViewRef. If no object is necessary, you must pass NULL.
  267. * See the HICoordinateSpace documentation for details on which
  268. * HICoordinateSpaces require objects.
  269. *
  270. * inDestinationSpace:
  271. * The HICoordinateSpace constant specifying the destination
  272. * coordinate space that the rect is to be converted to. Some
  273. * coordinate spaces require the caller to pass extra information
  274. * in the inDestinationObject parameter.
  275. *
  276. * inDestinationObject:
  277. * An specific object defining the destination coordinate space
  278. * that the rect is to be converted to. You might pass a WindowRef
  279. * or an HIViewRef. If no object is necessary, you must pass NULL.
  280. * See the HICoordinateSpace documentation for details on which
  281. * HICoordinateSpaces require objects.
  282. *
  283. * Availability:
  284. * Mac OS X: in version 10.4 and later in Carbon.framework
  285. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  286. * Non-Carbon CFM: not available
  287. }
  288. procedure HIRectConvert( var ioRect: HIRect; inSourceSpace: HICoordinateSpace; inSourceObject: UnivPtr { can be NULL }; inDestinationSpace: HICoordinateSpace; inDestinationObject: UnivPtr { can be NULL } ); external name '_HIRectConvert';
  289. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  290. {
  291. * HISizeConvert()
  292. *
  293. * Discussion:
  294. * This routine converts an HISize from one coordinate space to
  295. * another. It takes into account the resolution-independent display
  296. * scale factor as appropriate.
  297. *
  298. * Mac OS X threading:
  299. * Not thread safe
  300. *
  301. * Parameters:
  302. *
  303. * ioSize:
  304. * The HISize to convert.
  305. *
  306. * inSourceSpace:
  307. * The HICoordinateSpace constant specifying the source coordinate
  308. * space that the size is to be converted from. Some coordinate
  309. * spaces require the caller to pass extra information in the
  310. * inSourceObject parameter.
  311. *
  312. * inSourceObject:
  313. * An specific object defining the source coordinate space that
  314. * the size is to be converted from. You might pass a WindowRef or
  315. * an HIViewRef. If no object is necessary, you must pass NULL.
  316. * See the HICoordinateSpace documentation for details on which
  317. * HICoordinateSpaces require objects.
  318. *
  319. * inDestinationSpace:
  320. * The HICoordinateSpace constant specifying the destination
  321. * coordinate space that the size is to be converted to. Some
  322. * coordinate spaces require the caller to pass extra information
  323. * in the inDestinationObject parameter.
  324. *
  325. * inDestinationObject:
  326. * An specific object defining the destination coordinate space
  327. * that the size is to be converted to. You might pass a WindowRef
  328. * or an HIViewRef. If no object is necessary, you must pass NULL.
  329. * See the HICoordinateSpace documentation for details on which
  330. * HICoordinateSpaces require objects.
  331. *
  332. * Availability:
  333. * Mac OS X: in version 10.4 and later in Carbon.framework
  334. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  335. * Non-Carbon CFM: not available
  336. }
  337. procedure HISizeConvert( var ioSize: HISize; inSourceSpace: HICoordinateSpace; inSourceObject: UnivPtr { can be NULL }; inDestinationSpace: HICoordinateSpace; inDestinationObject: UnivPtr { can be NULL } ); external name '_HISizeConvert';
  338. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  339. end.