~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to packages/extra/univint/HIGeometry.pas

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

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