comparison dstep/appkit/NSBox.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.appkit.NSBox;
8
9 import dstep.appkit.NSColor;
10 import dstep.appkit.NSFont;
11 import dstep.appkit.NSView;
12 import dstep.applicationservices.coregraphics.CGBase;
13 import dstep.foundation.NSGeometry;
14 import dstep.foundation.NSObjCRuntime;
15 import dstep.foundation.NSString;
16 import dstep.objc.bridge.Bridge;
17 import dstep.objc.objc;
18
19 alias NSUInteger NSTitlePosition;
20 alias NSUInteger NSBoxType;
21
22 enum
23 {
24 NSNoTitle = 0,
25 NSAboveTop = 1,
26 NSAtTop = 2,
27 NSBelowTop = 3,
28 NSAboveBottom = 4,
29 NSAtBottom = 5,
30 NSBelowBottom = 6
31 }
32
33 enum
34 {
35 NSBoxPrimary = 0,
36 NSBoxSecondary = 1,
37 NSBoxSeparator = 2,
38 NSBoxOldStyle = 3,
39 NSBoxCustom = 4
40 }
41
42 const TNSCustomBoxTypeProperties = `
43
44 CGFloat borderWidth ()
45 {
46 return invokeObjcSelf!(CGFloat, "borderWidth");
47 }
48
49 void setBorderWidth (CGFloat borderWidth)
50 {
51 return invokeObjcSelf!(void, "setBorderWidth:", CGFloat)(borderWidth);
52 }
53
54 CGFloat cornerRadius ()
55 {
56 return invokeObjcSelf!(CGFloat, "cornerRadius");
57 }
58
59 void setCornerRadius (CGFloat cornerRadius)
60 {
61 return invokeObjcSelf!(void, "setCornerRadius:", CGFloat)(cornerRadius);
62 }
63
64 NSColor borderColor ()
65 {
66 return invokeObjcSelf!(NSColor, "borderColor");
67 }
68
69 void setBorderColor (NSColor borderColor)
70 {
71 return invokeObjcSelf!(void, "setBorderColor:", NSColor)(borderColor);
72 }
73
74 NSColor fillColor ()
75 {
76 return invokeObjcSelf!(NSColor, "fillColor");
77 }
78
79 void setFillColor (NSColor fillColor)
80 {
81 return invokeObjcSelf!(void, "setFillColor:", NSColor)(fillColor);
82 }
83
84 //mixin ObjcBindMethod!(borderWidth, "borderWidth");
85 //mixin ObjcBindMethod!(setBorderWidth, "setBorderWidth:");
86 //mixin ObjcBindMethod!(cornerRadius, "cornerRadius");
87 //mixin ObjcBindMethod!(setCornerRadius, "setCornerRadius:");
88 //mixin ObjcBindMethod!(borderColor, "borderColor");
89 //mixin ObjcBindMethod!(setBorderColor, "setBorderColor:");
90 //mixin ObjcBindMethod!(fillColor, "fillColor");
91 //mixin ObjcBindMethod!(setFillColor, "setFillColor:");
92
93 `;
94
95 class NSBox : NSView
96 {
97 mixin (ObjcWrap);
98
99 uint borderType ()
100 {
101 return invokeObjcSelf!(uint, "borderType");
102 }
103
104 uint titlePosition ()
105 {
106 return invokeObjcSelf!(uint, "titlePosition");
107 }
108
109 void setBorderType (uint aType)
110 {
111 return invokeObjcSelf!(void, "setBorderType:", uint)(aType);
112 }
113
114 void setBoxType (uint boxType)
115 {
116 return invokeObjcSelf!(void, "setBoxType:", uint)(boxType);
117 }
118
119 uint boxType ()
120 {
121 return invokeObjcSelf!(uint, "boxType");
122 }
123
124 void setTitlePosition (uint aPosition)
125 {
126 return invokeObjcSelf!(void, "setTitlePosition:", uint)(aPosition);
127 }
128
129 NSString title ()
130 {
131 return invokeObjcSelf!(NSString, "title");
132 }
133
134 void setTitle (NSString aString)
135 {
136 return invokeObjcSelf!(void, "setTitle:", NSString)(aString);
137 }
138
139 NSFont titleFont ()
140 {
141 return invokeObjcSelf!(NSFont, "titleFont");
142 }
143
144 void setTitleFont (NSFont fontObj)
145 {
146 return invokeObjcSelf!(void, "setTitleFont:", NSFont)(fontObj);
147 }
148
149 NSRect borderRect ()
150 {
151 return invokeObjcSelf!(NSRect, "borderRect");
152 }
153
154 NSRect titleRect ()
155 {
156 return invokeObjcSelf!(NSRect, "titleRect");
157 }
158
159 Object titleCell ()
160 {
161 return invokeObjcSelf!(Object, "titleCell");
162 }
163
164 void sizeToFit ()
165 {
166 return invokeObjcSelf!(void, "sizeToFit");
167 }
168
169 NSSize contentViewMargins ()
170 {
171 return invokeObjcSelf!(NSSize, "contentViewMargins");
172 }
173
174 void setContentViewMargins (NSSize offsetSize)
175 {
176 return invokeObjcSelf!(void, "setContentViewMargins:", NSSize)(offsetSize);
177 }
178
179 void setFrameFromContentFrame (NSRect contentFrame)
180 {
181 return invokeObjcSelf!(void, "setFrameFromContentFrame:", NSRect)(contentFrame);
182 }
183
184 Object contentView ()
185 {
186 return invokeObjcSelf!(Object, "contentView");
187 }
188
189 void setContentView (NSView aView)
190 {
191 return invokeObjcSelf!(void, "setContentView:", NSView)(aView);
192 }
193
194 bool isTransparent ()
195 {
196 return invokeObjcSelf!(bool, "isTransparent");
197 }
198
199 void setTransparent (bool flag)
200 {
201 return invokeObjcSelf!(void, "setTransparent:", bool)(flag);
202 }
203
204 // NSCustomBoxTypeProperties
205 CGFloat borderWidth ()
206 {
207 return invokeObjcSelf!(CGFloat, "borderWidth");
208 }
209
210 void setBorderWidth (CGFloat borderWidth)
211 {
212 return invokeObjcSelf!(void, "setBorderWidth:", CGFloat)(borderWidth);
213 }
214
215 CGFloat cornerRadius ()
216 {
217 return invokeObjcSelf!(CGFloat, "cornerRadius");
218 }
219
220 void setCornerRadius (CGFloat cornerRadius)
221 {
222 return invokeObjcSelf!(void, "setCornerRadius:", CGFloat)(cornerRadius);
223 }
224
225 NSColor borderColor ()
226 {
227 return invokeObjcSelf!(NSColor, "borderColor");
228 }
229
230 void setBorderColor (NSColor borderColor)
231 {
232 return invokeObjcSelf!(void, "setBorderColor:", NSColor)(borderColor);
233 }
234
235 NSColor fillColor ()
236 {
237 return invokeObjcSelf!(NSColor, "fillColor");
238 }
239
240 void setFillColor (NSColor fillColor)
241 {
242 return invokeObjcSelf!(void, "setFillColor:", NSColor)(fillColor);
243 }
244 }