summaryrefslogtreecommitdiff
path: root/packages/cocoaint/src/foundation/NSGeometry.inc
blob: b1ee02d2c0b7a7c375c314367194d1f57474cc3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
{ Parsed from Foundation.framework NSGeometry.h }
{ Version: 2.1.2 - Wed Dec 8 10:06:43 CET 2010 }


{$ifdef TYPES}
{$ifndef NSGEOMETRY_PAS_T}
{$define NSGEOMETRY_PAS_T}

{$if defined(cpu64) or defined(cpuarm) or defined(win32)}
{ Types }
type
  NSPoint = CGPoint;
  NSPointPtr = ^NSPoint;
  NSPointPointer = ^NSPointPtr;
  NSPointArray = ^NSPoint;
  NSSize = CGSize;
  NSSizePtr = ^NSSize;
  NSSizePointer = NSSizePtr;
  NSSizeArray = ^NSSize;
  NSRect = CGRect;
  NSRectPtr = ^NSRect;
  NSRectPointer = NSRectPtr;
  NSRectArray = ^NSRect;

{ Defines }
{$define  NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES}

{$endif cpu64 or cpuarm or win32}

{ Types }
type
{$ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES}
  NSRectEdge = NSUInteger;
{$else}
  NSRectEdge = culong;
{$endif}
  NSRectEdgePtr = ^NSRectEdge;

{ Constants }
{$ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES}
const
  NSMinXEdge = CGRectMinXEdge;
  NSMinYEdge = CGRectMinYEdge;
  NSMaxXEdge = CGRectMaxXEdge;
  NSMaxYEdge = CGRectMaxYEdge;

{$else NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES}
const
  NSMinXEdge = 0;
  NSMinYEdge = 1;
  NSMaxXEdge = 2;
  NSMaxYEdge = 3;
{$endif NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES}

{$endif}
{$endif}

{$ifdef RECORDS}
{$ifndef NSGEOMETRY_PAS_R}
{$define NSGEOMETRY_PAS_R}

{ Records }
{$ifndef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES}
type
  _NSPoint = record
    x: CGFloat;
    y: CGFloat;
  end;
  NSPoint = _NSPoint;
  NSPointPtr = ^NSPoint;
  NSPointPointer = NSPointPtr;
  NSPointArray = ^NSPoint;

type
  _NSSize = record
    width: CGFloat;
    height: CGFloat;
  end;
  NSSize = _NSSize;
  NSSizePtr = ^NSSize;
  NSSizePointer = NSSizePtr;
  NSSizeArray = ^NSSize;

type
  _NSRect = record
    origin: NSPoint;
    size: NSSize;
  end;
  NSRect = _NSRect;
  NSRectPtr = ^NSRect;
  NSRectPointer = NSRectPtr;
  NSRectArray = ^NSRect;
{$endif not NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES}

{$endif}
{$endif}

{$ifdef FUNCTIONS}
{$ifndef NSGEOMETRY_PAS_F}
{$define NSGEOMETRY_PAS_F}

{ Functions }
function NSEqualPoints(aPoint: NSPoint; bPoint: NSPoint): Boolean; cdecl; external;
function NSEqualSizes(aSize: NSSize; bSize: NSSize): Boolean; cdecl; external;
function NSEqualRects(aRect: NSRect; bRect: NSRect): Boolean; cdecl; external;
function NSIsEmptyRect(aRect: NSRect): Boolean; cdecl; external;
function NSInsetRect(aRect: NSRect; dX: CGFloat; dY: CGFloat): NSRect; cdecl; external;
function NSIntegralRect(aRect: NSRect): NSRect; cdecl; external;
function NSUnionRect(aRect: NSRect; bRect: NSRect): NSRect; cdecl; external;
function NSIntersectionRect(aRect: NSRect; bRect: NSRect): NSRect; cdecl; external;
function NSOffsetRect(aRect: NSRect; dX: CGFloat; dY: CGFloat): NSRect; cdecl; external;
procedure NSDivideRect(inRect: NSRect; slice: NSRectPtr; rem: NSRectPtr; amount: CGFloat; edge: NSRectEdge); cdecl; external;
function NSPointInRect(aPoint: NSPoint; aRect: NSRect): Boolean; cdecl; external;
function NSMouseInRect(aPoint: NSPoint; aRect: NSRect; flipped: Boolean): Boolean; cdecl; external;
function NSContainsRect(aRect: NSRect; bRect: NSRect): Boolean; cdecl; external;
function NSIntersectsRect(aRect: NSRect; bRect: NSRect): Boolean; cdecl; external;
function NSStringFromPoint(aPoint: NSPoint): NSString; cdecl; external;
function NSStringFromSize(aSize: NSSize): NSString; cdecl; external;
function NSStringFromRect(aRect: NSRect): NSString; cdecl; external;
function NSPointFromString(aString: NSString): NSPoint; cdecl; external;
function NSSizeFromString(aString: NSString): NSSize; cdecl; external;
function NSRectFromString(aString: NSString): NSRect; cdecl; external;

{$endif}
{$endif}

{$ifdef EXTERNAL_SYMBOLS}
{$ifndef NSGEOMETRY_PAS_S}
{$define NSGEOMETRY_PAS_S}

{ External symbols }
var
  NSZeroPoint: NSPoint; cvar; external;
  NSZeroSize: NSSize; cvar; external;
  NSZeroRect: NSRect; cvar; external;

{$endif}
{$endif}

{$ifdef FORWARD}

{$endif}

{$ifdef CLASSES}
{$ifndef NSGEOMETRY_PAS_C}
{$define NSGEOMETRY_PAS_C}

{ NSValueGeometryExtensionsCategory }
  NSValueGeometryExtensionsCategory = objccategory(NSValue)
    class function valueWithPoint(point: NSPoint): NSValue; message 'valueWithPoint:';
    class function valueWithSize(size: NSSize): NSValue; message 'valueWithSize:';
    class function valueWithRect(rect: NSRect): NSValue; message 'valueWithRect:';
    function pointValue: NSPoint; message 'pointValue';
    function sizeValue: NSSize; message 'sizeValue';
    function rectValue: NSRect; message 'rectValue';
  end; external;

{ NSGeometryCodingCategory }
  NSGeometryCodingCategory = objccategory(NSCoder)
    procedure encodePoint(point: NSPoint); message 'encodePoint:';
    function decodePoint: NSPoint; message 'decodePoint';
    procedure encodeSize(size: NSSize); message 'encodeSize:';
    function decodeSize: NSSize; message 'decodeSize';
    procedure encodeRect(rect: NSRect); message 'encodeRect:';
    function decodeRect: NSRect; message 'decodeRect';
  end; external;

{ NSGeometryKeyedCodingCategory }
  NSGeometryKeyedCodingCategory = objccategory(NSCoder)
    procedure encodePoint_forKey(point: NSPoint; key: NSString); message 'encodePoint:forKey:';
    procedure encodeSize_forKey(size: NSSize; key: NSString); message 'encodeSize:forKey:';
    procedure encodeRect_forKey(rect: NSRect; key: NSString); message 'encodeRect:forKey:';
    function decodePointForKey(key: NSString): NSPoint; message 'decodePointForKey:';
    function decodeSizeForKey(key: NSString): NSSize; message 'decodeSizeForKey:';
    function decodeRectForKey(key: NSString): NSRect; message 'decodeRectForKey:';
  end; external;

{$endif}
{$endif}