Mercurial > projects > dstep
annotate dstep/foundation/NSGeometry.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | 89f3c3ef1fd2 |
children |
rev | line source |
---|---|
14 | 1 /** |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Aug 3, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.foundation.NSGeometry; | |
8 | |
9 import dstep.applicationservices.coregraphics.CGBase; | |
10 import dstep.applicationservices.coregraphics.CGGeometry; | |
11 import dstep.foundation.NSCoder; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
12 import dstep.foundation.NSObjCRuntime; |
14 | 13 import dstep.foundation.NSString; |
14 import dstep.foundation.NSValue; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
15 import dstep.internal.Version; |
14 | 16 import dstep.objc.bridge.Bridge; |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
17 import dstep.objc.objc; |
14 | 18 |
19 import bindings = dstep.foundation.NSGeometry_bindings; | |
20 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
21 alias dstep.applicationservices.coregraphics.CGGeometry.CGPoint NSPoint; |
14 | 22 alias NSPoint* NSPointPointer; |
23 alias NSPoint* NSPointArray; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
24 alias dstep.applicationservices.coregraphics.CGGeometry.CGSize NSSize; |
14 | 25 alias NSSize* NSSizePointer; |
26 alias NSSize* NSSizeArray; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
27 alias dstep.applicationservices.coregraphics.CGGeometry.CGRect NSRect; |
14 | 28 alias NSRect* NSRectPointer; |
29 alias NSRect* NSRectArray; | |
30 alias NSUInteger NSRectEdge; | |
31 | |
32 extern (C) | |
33 { | |
34 extern | |
35 { | |
36 const NSPoint NSZeroPoint; | |
37 const NSSize NSZeroSize; | |
38 const NSRect NSZeroRect; | |
39 } | |
40 } | |
41 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
42 const TNSGeometryCoding = ` |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
43 |
14 | 44 void encodePoint (NSPoint point) |
45 { | |
46 return invokeObjcSelf!(void, "encodePoint:", NSPoint)(point); | |
47 } | |
48 | |
49 NSPoint decodePoint () | |
50 { | |
51 return invokeObjcSelf!(NSPoint, "decodePoint"); | |
52 } | |
53 | |
54 void encodeSize (NSSize size) | |
55 { | |
56 return invokeObjcSelf!(void, "encodeSize:", NSSize)(size); | |
57 } | |
58 | |
59 NSSize decodeSize () | |
60 { | |
61 return invokeObjcSelf!(NSSize, "decodeSize"); | |
62 } | |
63 | |
64 void encodeRect (NSRect rect) | |
65 { | |
66 return invokeObjcSelf!(void, "encodeRect:", NSRect)(rect); | |
67 } | |
68 | |
69 NSRect decodeRect () | |
70 { | |
71 return invokeObjcSelf!(NSRect, "decodeRect"); | |
72 } | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
73 `; |
14 | 74 |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
75 const TNSValueGeometryExtensions = ` |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
76 |
14 | 77 static NSValue valueWithPoint (NSPoint point) |
78 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
79 return invokeObjcSuperClass!(NSValue, "valueWithPoint:", NSPoint)(point); |
14 | 80 } |
81 | |
82 static NSValue valueWithSize (NSSize size) | |
83 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
84 return invokeObjcSuperClass!(NSValue, "valueWithSize:", NSSize)(size); |
14 | 85 } |
86 | |
87 static NSValue valueWithRect (NSRect rect) | |
88 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
89 return invokeObjcSuperClass!(NSValue, "valueWithRect:", NSRect)(rect); |
14 | 90 } |
91 | |
92 NSPoint pointValue () | |
93 { | |
94 return invokeObjcSelf!(NSPoint, "pointValue"); | |
95 } | |
96 | |
97 NSSize sizeValue () | |
98 { | |
99 return invokeObjcSelf!(NSSize, "sizeValue"); | |
100 } | |
101 | |
102 NSRect rectValue () | |
103 { | |
104 return invokeObjcSelf!(NSRect, "rectValue"); | |
105 } | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
106 `; |
14 | 107 |
108 NSString NSStringFromPoint (NSPoint aPoint) | |
109 { | |
110 return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromPoint, NSPoint)(aPoint); | |
111 } | |
112 | |
113 NSString NSStringFromSize (NSSize aSize) | |
114 { | |
115 return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromSize, NSSize)(aSize); | |
116 } | |
117 | |
118 NSString NSStringFromRect (NSRect aRect) | |
119 { | |
120 return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromRect, NSRect)(aRect); | |
121 } | |
122 | |
123 NSPoint NSPointFromString (NSString aString) | |
124 { | |
125 return Bridge.invokeObjcFunction!(NSPoint, bindings.NSPointFromString, NSString)(aString); | |
126 } | |
127 | |
128 NSSize NSSizeFromString (NSString aString) | |
129 { | |
130 return Bridge.invokeObjcFunction!(NSSize, bindings.NSSizeFromString, NSString)(aString); | |
131 } | |
132 | |
133 NSRect NSRectFromString (NSString aString) | |
134 { | |
135 return Bridge.invokeObjcFunction!(NSRect, bindings.NSRectFromString, NSString)(aString); | |
136 } | |
137 | |
138 extern (C) | |
139 { | |
140 bool NSEqualPoints (NSPoint aPoint, NSPoint bPoint); | |
141 bool NSEqualSizes (NSSize aSize, NSSize bSize); | |
142 bool NSEqualRects (NSRect aRect, NSRect bRect); | |
143 bool NSIsEmptyRect (NSRect aRect); | |
144 NSRect NSInsetRect (NSRect aRect, CGFloat dX, CGFloat dY); | |
145 NSRect NSIntegralRect (NSRect aRect); | |
146 NSRect NSUnionRect (NSRect aRect, NSRect bRect); | |
147 NSRect NSIntersectionRect (NSRect aRect, NSRect bRect); | |
148 NSRect NSOffsetRect (NSRect aRect, CGFloat dX, CGFloat dY); | |
149 void NSDivideRect (NSRect inRect, NSRect* slice, NSRect* rem, CGFloat amount, int edge); | |
150 bool NSPointInRect (NSPoint aPoint, NSRect aRect); | |
151 bool NSMouseInRect (NSPoint aPoint, NSRect aRect, bool flipped); | |
152 bool NSContainsRect (NSRect aRect, NSRect bRect); | |
153 bool NSIntersectsRect (NSRect aRect, NSRect bRect); | |
154 } |