comparison 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
comparison
equal deleted inserted replaced
15:7ff919f595d5 16:19885b43130e
4 * Version: Initial created: Aug 3, 2009 4 * Version: Initial created: Aug 3, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) 5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */ 6 */
7 module dstep.foundation.NSGeometry; 7 module dstep.foundation.NSGeometry;
8 8
9 import dstep.AvailabilityMacros;
10 import dstep.applicationservices.coregraphics.CGBase; 9 import dstep.applicationservices.coregraphics.CGBase;
11 import dstep.applicationservices.coregraphics.CGGeometry; 10 import dstep.applicationservices.coregraphics.CGGeometry;
12 import dstep.foundation.NSCoder; 11 import dstep.foundation.NSCoder;
12 import dstep.foundation.NSObjCRuntime;
13 import dstep.foundation.NSString; 13 import dstep.foundation.NSString;
14 import dstep.foundation.NSValue; 14 import dstep.foundation.NSValue;
15 import dstep.internal.Version;
15 import dstep.objc.bridge.Bridge; 16 import dstep.objc.bridge.Bridge;
16 import dstep.objc.objc : id; 17 import dstep.objc.objc;
17 18
18 import bindings = dstep.foundation.NSGeometry_bindings; 19 import bindings = dstep.foundation.NSGeometry_bindings;
19 20
20 alias CGPoint NSPoint; 21 alias dstep.applicationservices.coregraphics.CGGeometry.CGPoint NSPoint;
21 alias NSPoint* NSPointPointer; 22 alias NSPoint* NSPointPointer;
22 alias NSPoint* NSPointArray; 23 alias NSPoint* NSPointArray;
23 alias CGSize NSSize; 24 alias dstep.applicationservices.coregraphics.CGGeometry.CGSize NSSize;
24 alias NSSize* NSSizePointer; 25 alias NSSize* NSSizePointer;
25 alias NSSize* NSSizeArray; 26 alias NSSize* NSSizeArray;
26 alias CGRect NSRect; 27 alias dstep.applicationservices.coregraphics.CGGeometry.CGRect NSRect;
27 alias NSRect* NSRectPointer; 28 alias NSRect* NSRectPointer;
28 alias NSRect* NSRectArray; 29 alias NSRect* NSRectArray;
29 alias NSUInteger NSRectEdge; 30 alias NSUInteger NSRectEdge;
30 31
31 extern (C) 32 extern (C)
36 const NSSize NSZeroSize; 37 const NSSize NSZeroSize;
37 const NSRect NSZeroRect; 38 const NSRect NSZeroRect;
38 } 39 }
39 } 40 }
40 41
41 template TNSGeometryCoding () 42 const TNSGeometryCoding = `
42 { 43
43 void encodePoint (NSPoint point) 44 void encodePoint (NSPoint point)
44 { 45 {
45 return invokeObjcSelf!(void, "encodePoint:", NSPoint)(point); 46 return invokeObjcSelf!(void, "encodePoint:", NSPoint)(point);
46 } 47 }
47 48
67 68
68 NSRect decodeRect () 69 NSRect decodeRect ()
69 { 70 {
70 return invokeObjcSelf!(NSRect, "decodeRect"); 71 return invokeObjcSelf!(NSRect, "decodeRect");
71 } 72 }
72 } 73 `;
73 74
74 template TNSValueGeometryExtensions () 75 const TNSValueGeometryExtensions = `
75 { 76
76 static NSValue valueWithPoint (NSPoint point) 77 static NSValue valueWithPoint (NSPoint point)
77 { 78 {
78 return invokeObjcSelfClass!(NSValue, "valueWithPoint:", NSPoint)(point); 79 return invokeObjcSuperClass!(NSValue, "valueWithPoint:", NSPoint)(point);
79 } 80 }
80 81
81 static NSValue valueWithSize (NSSize size) 82 static NSValue valueWithSize (NSSize size)
82 { 83 {
83 return invokeObjcSelfClass!(NSValue, "valueWithSize:", NSSize)(size); 84 return invokeObjcSuperClass!(NSValue, "valueWithSize:", NSSize)(size);
84 } 85 }
85 86
86 static NSValue valueWithRect (NSRect rect) 87 static NSValue valueWithRect (NSRect rect)
87 { 88 {
88 return invokeObjcSelfClass!(NSValue, "valueWithRect:", NSRect)(rect); 89 return invokeObjcSuperClass!(NSValue, "valueWithRect:", NSRect)(rect);
89 } 90 }
90 91
91 NSPoint pointValue () 92 NSPoint pointValue ()
92 { 93 {
93 return invokeObjcSelf!(NSPoint, "pointValue"); 94 return invokeObjcSelf!(NSPoint, "pointValue");
100 101
101 NSRect rectValue () 102 NSRect rectValue ()
102 { 103 {
103 return invokeObjcSelf!(NSRect, "rectValue"); 104 return invokeObjcSelf!(NSRect, "rectValue");
104 } 105 }
105 } 106 `;
106 107
107 NSString NSStringFromPoint (NSPoint aPoint) 108 NSString NSStringFromPoint (NSPoint aPoint)
108 { 109 {
109 return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromPoint, NSPoint)(aPoint); 110 return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromPoint, NSPoint)(aPoint);
110 } 111 }