Mercurial > projects > dstep
comparison dstep/quartzcore/CIVector.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 | |
children | b9de51448c6b |
comparison
equal
deleted
inserted
replaced
15:7ff919f595d5 | 16:19885b43130e |
---|---|
1 /** | |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Sep 24, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.quartzcore.CIVector; | |
8 | |
9 import dstep.applicationservices.ApplicationServices; | |
10 import dstep.foundation.NSCoder; | |
11 import dstep.foundation.NSObject; | |
12 import dstep.foundation.NSString; | |
13 import dstep.foundation.NSZone; | |
14 import dstep.objc.bridge.Bridge; | |
15 import dstep.objc.objc; | |
16 | |
17 class CIVector : NSObject, INSCopying, INSCoding | |
18 { | |
19 mixin (ObjcWrap); | |
20 | |
21 this (NSCoder aDecoder) | |
22 { | |
23 super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); | |
24 } | |
25 | |
26 void encodeWithCoder (NSCoder aCoder) | |
27 { | |
28 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); | |
29 } | |
30 | |
31 typeof(this) initWithCoder (NSCoder aDecoder) | |
32 { | |
33 return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); | |
34 } | |
35 | |
36 typeof(this) copyWithZone (NSZone* zone) | |
37 { | |
38 return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone); | |
39 } | |
40 | |
41 static CIVector vectorWithValues (CGFloat* values, uint count) | |
42 { | |
43 return invokeObjcSelfClass!(CIVector, "vectorWithValues:count:", CGFloat*, uint)(values, count); | |
44 } | |
45 | |
46 static CIVector vectorWithX (CGFloat x) | |
47 { | |
48 return invokeObjcSelfClass!(CIVector, "vectorWithX:", CGFloat)(x); | |
49 } | |
50 | |
51 static CIVector vectorWithX (CGFloat x, CGFloat y) | |
52 { | |
53 return invokeObjcSelfClass!(CIVector, "vectorWithX:Y:", CGFloat, CGFloat)(x, y); | |
54 } | |
55 | |
56 static CIVector vectorWithX (CGFloat x, CGFloat y, CGFloat z) | |
57 { | |
58 return invokeObjcSelfClass!(CIVector, "vectorWithX:Y:Z:", CGFloat, CGFloat, CGFloat)(x, y, z); | |
59 } | |
60 | |
61 static CIVector vectorWithX (CGFloat x, CGFloat y, CGFloat z, CGFloat w) | |
62 { | |
63 return invokeObjcSelfClass!(CIVector, "vectorWithX:Y:Z:W:", CGFloat, CGFloat, CGFloat, CGFloat)(x, y, z, w); | |
64 } | |
65 | |
66 static CIVector vectorWithString (NSString representation) | |
67 { | |
68 return invokeObjcSelfClass!(CIVector, "vectorWithString:", NSString)(representation); | |
69 } | |
70 | |
71 CIVector initWithValues (CGFloat* values, uint count) | |
72 { | |
73 id result = invokeObjcSelf!(id, "initWithValues:count:", CGFloat*, uint)(values, count); | |
74 return result is this.objcObject ? this : (result !is null ? new CIVector(result) : null); | |
75 } | |
76 | |
77 this (CGFloat* values, uint count) | |
78 { | |
79 super(CIVector.alloc.initWithValues(values, count).objcObject); | |
80 } | |
81 | |
82 CIVector initWithX (CGFloat x) | |
83 { | |
84 id result = invokeObjcSelf!(id, "initWithX:", CGFloat)(x); | |
85 return result is this.objcObject ? this : (result !is null ? new CIVector(result) : null); | |
86 } | |
87 | |
88 this (CGFloat x) | |
89 { | |
90 super(CIVector.alloc.initWithX(x).objcObject); | |
91 } | |
92 | |
93 CIVector initWithX (CGFloat x, CGFloat y) | |
94 { | |
95 id result = invokeObjcSelf!(id, "initWithX:Y:", CGFloat, CGFloat)(x, y); | |
96 return result is this.objcObject ? this : (result !is null ? new CIVector(result) : null); | |
97 } | |
98 | |
99 this (CGFloat x, CGFloat y) | |
100 { | |
101 super(CIVector.alloc.initWithX(x, y).objcObject); | |
102 } | |
103 | |
104 CIVector initWithX (CGFloat x, CGFloat y, CGFloat z) | |
105 { | |
106 id result = invokeObjcSelf!(id, "initWithX:Y:Z:", CGFloat, CGFloat, CGFloat)(x, y, z); | |
107 return result is this.objcObject ? this : (result !is null ? new CIVector(result) : null); | |
108 } | |
109 | |
110 this (CGFloat x, CGFloat y, CGFloat z) | |
111 { | |
112 super(CIVector.alloc.initWithX(x, y, z).objcObject); | |
113 } | |
114 | |
115 CIVector initWithX (CGFloat x, CGFloat y, CGFloat z, CGFloat w) | |
116 { | |
117 id result = invokeObjcSelf!(id, "initWithX:Y:Z:W:", CGFloat, CGFloat, CGFloat, CGFloat)(x, y, z, w); | |
118 return result is this.objcObject ? this : (result !is null ? new CIVector(result) : null); | |
119 } | |
120 | |
121 this (CGFloat x, CGFloat y, CGFloat z, CGFloat w) | |
122 { | |
123 super(CIVector.alloc.initWithX(x, y, z, w).objcObject); | |
124 } | |
125 | |
126 CIVector initWithString (NSString representation) | |
127 { | |
128 id result = invokeObjcSelf!(id, "initWithString:", NSString)(representation); | |
129 return result is this.objcObject ? this : (result !is null ? new CIVector(result) : null); | |
130 } | |
131 | |
132 this (NSString representation) | |
133 { | |
134 super(CIVector.alloc.initWithString(representation).objcObject); | |
135 } | |
136 | |
137 CGFloat valueAtIndex (uint index) | |
138 { | |
139 return invokeObjcSelf!(CGFloat, "valueAtIndex:", uint)(index); | |
140 } | |
141 | |
142 uint count () | |
143 { | |
144 return invokeObjcSelf!(uint, "count"); | |
145 } | |
146 | |
147 CGFloat X () | |
148 { | |
149 return invokeObjcSelf!(CGFloat, "X"); | |
150 } | |
151 | |
152 CGFloat Y () | |
153 { | |
154 return invokeObjcSelf!(CGFloat, "Y"); | |
155 } | |
156 | |
157 CGFloat Z () | |
158 { | |
159 return invokeObjcSelf!(CGFloat, "Z"); | |
160 } | |
161 | |
162 CGFloat W () | |
163 { | |
164 return invokeObjcSelf!(CGFloat, "W"); | |
165 } | |
166 | |
167 NSString stringRepresentation () | |
168 { | |
169 return invokeObjcSelf!(NSString, "stringRepresentation"); | |
170 } | |
171 | |
172 } | |
173 |