Mercurial > projects > dstep
comparison dstep/foundation/NSAffineTransform.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 | 7ff919f595d5 |
children | b9de51448c6b |
comparison
equal
deleted
inserted
replaced
15:7ff919f595d5 | 16:19885b43130e |
---|---|
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.NSAffineTransform; | 7 module dstep.foundation.NSAffineTransform; |
8 | 8 |
9 import dstep.applicationservices.coregraphics.CGAffineTransform; | 9 import dstep.applicationservices.coregraphics.CGAffineTransform; |
10 import dstep.applicationservices.coregraphics.CGBase; | |
11 import dstep.foundation.NSCoder; | |
10 import dstep.foundation.NSGeometry; | 12 import dstep.foundation.NSGeometry; |
11 import dstep.foundation.NSObject; | 13 import dstep.foundation.NSObject; |
14 import dstep.foundation.NSZone; | |
12 import dstep.objc.bridge.Bridge; | 15 import dstep.objc.bridge.Bridge; |
13 import dstep.objc.objc : id; | 16 import dstep.objc.objc; |
14 | 17 |
15 struct NSAffineTransformStruct | 18 struct NSAffineTransformStruct |
16 { | 19 { |
17 CGFloat m11; | 20 CGFloat m11; |
18 CGFloat m12; | 21 CGFloat m12; |
22 CGFloat tY; | 25 CGFloat tY; |
23 } | 26 } |
24 | 27 |
25 class NSAffineTransform : NSObject, INSCopying, INSCoding | 28 class NSAffineTransform : NSObject, INSCopying, INSCoding |
26 { | 29 { |
27 mixin ObjcWrap; | 30 mixin (ObjcWrap); |
31 | |
32 this () | |
33 { | |
34 super(typeof(this).alloc.init.objcObject); | |
35 } | |
36 | |
37 typeof(this) init () | |
38 { | |
39 return invokeObjcSelf!(typeof(this), "init"); | |
40 } | |
28 | 41 |
29 static NSAffineTransform transform () | 42 static NSAffineTransform transform () |
30 { | 43 { |
31 return invokeObjcSelfClass!(NSAffineTransform, "transform"); | 44 return invokeObjcSuperClass!(NSAffineTransform, "transform"); |
32 } | 45 } |
33 | 46 |
34 Object initWithTransform (NSAffineTransform transform) | 47 Object initWithTransform (NSAffineTransform transform) |
35 { | 48 { |
36 return invokeObjcSelf!(Object, "initWithTransform:", NSAffineTransform)(transform); | 49 return invokeObjcSelf!(Object, "initWithTransform:", NSAffineTransform)(transform); |
37 } | 50 } |
38 | 51 |
39 this (NSAffineTransform transform) | 52 this (NSAffineTransform transform) |
40 { | 53 { |
41 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | 54 typeof(this).alloc.initWithTransform(transform); |
42 id result = Bridge.invokeObjcMethod!(id, "initWithTransform:", NSAffineTransform)(objcObject, transform); | |
43 | |
44 if (result) | |
45 objcObject = ret; | |
46 | |
47 dObject = this; | |
48 } | 55 } |
49 | 56 |
50 void translateXBy (CGFloat deltaX, CGFloat deltaY) | 57 void translateXBy (CGFloat deltaX, CGFloat deltaY) |
51 { | 58 { |
52 return invokeObjcSelf!(void, "translateXBy:yBy:", CGFloat, CGFloat)(deltaX, deltaY); | 59 return invokeObjcSelf!(void, "translateXBy:yBy:", CGFloat, CGFloat)(deltaX, deltaY); |
122 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); | 129 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); |
123 } | 130 } |
124 | 131 |
125 this (NSCoder aDecoder) | 132 this (NSCoder aDecoder) |
126 { | 133 { |
127 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | 134 typeof(this).alloc.initWithCoder(aDecoder); |
128 id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); | |
129 | |
130 if (result) | |
131 objcObject = ret; | |
132 | |
133 dObject = this; | |
134 } | 135 } |
135 } | 136 } |
136 | 137 |