Mercurial > projects > dstep
comparison dstep/quartzcore/CAConstraintLayoutManager.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.CAConstraintLayoutManager; | |
8 | |
9 import dstep.applicationservices.coregraphics.CGBase; | |
10 import dstep.foundation.NSCoder; | |
11 import dstep.foundation.NSObject; | |
12 import dstep.foundation.NSString; | |
13 import dstep.objc.bridge.Bridge; | |
14 import dstep.objc.objc; | |
15 | |
16 alias int CAConstraintAttribute; | |
17 | |
18 enum _CAConstraintAttribute | |
19 | |
20 { | |
21 kCAConstraintMinX, | |
22 kCAConstraintMidX, | |
23 kCAConstraintMaxX, | |
24 kCAConstraintWidth, | |
25 kCAConstraintMinY, | |
26 kCAConstraintMidY, | |
27 kCAConstraintMaxY, | |
28 kCAConstraintHeight | |
29 } | |
30 | |
31 class CAConstraintLayoutManager : NSObject | |
32 { | |
33 mixin (ObjcWrap); | |
34 | |
35 static Object layoutManager () | |
36 { | |
37 return invokeObjcSelfClass!(Object, "layoutManager"); | |
38 } | |
39 } | |
40 | |
41 class CAConstraint : NSObject, INSCoding | |
42 { | |
43 mixin (ObjcWrap); | |
44 | |
45 static Object constraintWithAttribute (int attr, NSString srcId, int srcAttr, CGFloat m, CGFloat c) | |
46 { | |
47 return invokeObjcSelfClass!(Object, "constraintWithAttribute:relativeTo:attribute:scale:offset:", int, NSString, int, CGFloat, CGFloat)(attr, srcId, srcAttr, m, c); | |
48 } | |
49 | |
50 static Object constraintWithAttribute (int attr, NSString srcId, int srcAttr, CGFloat c) | |
51 { | |
52 return invokeObjcSelfClass!(Object, "constraintWithAttribute:relativeTo:attribute:offset:", int, NSString, int, CGFloat)(attr, srcId, srcAttr, c); | |
53 } | |
54 | |
55 static Object constraintWithAttribute (int attr, NSString srcId, int srcAttr) | |
56 { | |
57 return invokeObjcSelfClass!(Object, "constraintWithAttribute:relativeTo:attribute:", int, NSString, int)(attr, srcId, srcAttr); | |
58 } | |
59 | |
60 CAConstraint initWithAttribute (int attr, NSString srcId, int srcAttr, CGFloat m, CGFloat c) | |
61 { | |
62 id result = invokeObjcSelf!(id, "initWithAttribute:relativeTo:attribute:scale:offset:", int, NSString, int, CGFloat, CGFloat)(attr, srcId, srcAttr, m, c); | |
63 return result is this.objcObject ? this : (result !is null ? new CAConstraint(result) : null); | |
64 } | |
65 | |
66 this (int attr, NSString srcId, int srcAttr, CGFloat m, CGFloat c) | |
67 { | |
68 super(CAConstraint.alloc.initWithAttribute(attr, srcId, srcAttr, m, c).objcObject); | |
69 } | |
70 | |
71 void encodeWithCoder (NSCoder aCoder) | |
72 { | |
73 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); | |
74 } | |
75 | |
76 CAConstraint initWithCoder (NSCoder aDecoder) | |
77 { | |
78 return invokeObjcSelf!(CAConstraint, "initWithCoder:", NSCoder)(aDecoder); | |
79 } | |
80 | |
81 } | |
82 | |
83 const TCAConstraintLayoutManager = ` | |
84 | |
85 void addConstraint (CAConstraint c) | |
86 { | |
87 return invokeObjcSelf!(void, "addConstraint:", CAConstraint)(c); | |
88 } | |
89 | |
90 //mixin ObjcBindMethod!(addConstraint, "addConstraint:"); | |
91 | |
92 `; | |
93 |