comparison dwt/internal/cocoa/NSBox.d @ 0:380af2bdd8e5

Upload of whole dwt tree
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Sat, 09 Aug 2008 17:00:02 +0200
parents
children 8b48be5454ce
comparison
equal deleted inserted replaced
-1:000000000000 0:380af2bdd8e5
1 /*******************************************************************************
2 * Copyright (c) 2007 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *
11 * Port to the D Programming language:
12 * Jacob Carlborg <jacob.carlborg@gmail.com>
13 *******************************************************************************/
14 module dwt.internal.cocoa.NSBox;
15
16 import dwt.internal.cocoa.CGFloat;
17 import dwt.internal.cocoa.NSCell;
18 import dwt.internal.cocoa.NSColor;
19 import dwt.internal.cocoa.NSFont;
20 import dwt.internal.cocoa.NSRect;
21 import dwt.internal.cocoa.NSSize;
22 import dwt.internal.cocoa.NSString;
23 import dwt.internal.cocoa.NSView;
24 import dwt.internal.cocoa.OS;
25 import objc = dwt.internal.objc.runtime;
26
27 alias NSUInteger NSBoxType;
28
29 enum
30 {
31 NSBoxPrimary = 0,
32 NSBoxSecondary = 1,
33 NSBoxSeparator = 2,
34 NSBoxOldStyle = 3,
35 NSBoxCustom = 4
36 }
37
38 enum NSTitlePosition
39 {
40 NSNoTitle = 0,
41 NSAboveTop = 1,
42 NSAtTop = 2,
43 NSBelowTop = 3,
44 NSAboveBottom = 4,
45 NSAtBottom = 5,
46 NSBelowBottom = 6
47 }
48
49 public class NSBox : NSView
50 {
51 public this ()
52 {
53 super();
54 }
55
56 public this (objc.id id)
57 {
58 super(id);
59 }
60
61 public NSColor borderColor ()
62 {
63 objc.id result = OS.objc_msgSend(this.id, OS.sel_borderColor);
64 return result !is null ? new NSColor(result) : null;
65 }
66
67 public NSRect borderRect ()
68 {
69 NSRect result;
70 OS.objc_msgSend_stret(result, this.id, OS.sel_borderRect);
71 return result;
72 }
73
74 public NSBorderType borderType ()
75 {
76 return OS.objc_msgSend(this.id, OS.sel_borderType);
77 }
78
79 public CGFloat borderWidth ()
80 {
81 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_borderWidth);
82 }
83
84 public NSBoxType boxType ()
85 {
86 return OS.objc_msgSend(this.id, OS.sel_boxType);
87 }
88
89 public NSView contentView ()
90 {
91 objc.id result = OS.objc_msgSend(this.id, OS.sel_contentView);
92 return result !is null ? new NSView(result) : null;
93 }
94
95 public NSSize contentViewMargins ()
96 {
97 NSSize result;
98 OS.objc_msgSend_stret(result, this.id, OS.sel_contentViewMargins);
99 return result;
100 }
101
102 public CGFloat cornerRadius ()
103 {
104 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_cornerRadius);
105 }
106
107 public NSColor fillColor ()
108 {
109 objc.id result = OS.objc_msgSend(this.id, OS.sel_fillColor);
110 return result !is null ? new NSColor(result) : null;
111 }
112
113 public bool isTransparent ()
114 {
115 return OS.objc_msgSend(this.id, OS.sel_isTransparent) !is null;
116 }
117
118 public void setBorderColor (NSColor borderColor)
119 {
120 OS.objc_msgSend(this.id, OS.sel_setBorderColor_1, borderColor !is null ? borderColor.id : null);
121 }
122
123 public void setBorderType (NSBorderType aType)
124 {
125 OS.objc_msgSend(this.id, OS.sel_setBorderType_1, aType);
126 }
127
128 public void setBorderWidth (CGFloat borderWidth)
129 {
130 OS.objc_msgSend(this.id, OS.sel_setBorderWidth_1, borderWidth);
131 }
132
133 public void setBoxType (NSBoxType boxType)
134 {
135 OS.objc_msgSend(this.id, OS.sel_setBoxType_1, boxType);
136 }
137
138 public void setContentView (NSView aView)
139 {
140 OS.objc_msgSend(this.id, OS.sel_setContentView_1, aView !is null ? aView.id : null);
141 }
142
143 public void setContentViewMargins (NSSize offsetSize)
144 {
145 OS.objc_msgSend(this.id, OS.sel_setContentViewMargins_1, offsetSize);
146 }
147
148 public void setCornerRadius (CGFloat cornerRadius)
149 {
150 OS.objc_msgSend(this.id, OS.sel_setCornerRadius_1, cornerRadius);
151 }
152
153 public void setFillColor (NSColor fillColor)
154 {
155 OS.objc_msgSend(this.id, OS.sel_setFillColor_1, fillColor !is null ? fillColor.id : null);
156 }
157
158 public void setFrameFromContentFrame (NSRect contentFrame)
159 {
160 OS.objc_msgSend(this.id, OS.sel_setFrameFromContentFrame_1, contentFrame);
161 }
162
163 public void setTitle (NSString aString)
164 {
165 OS.objc_msgSend(this.id, OS.sel_setTitle_1, aString !is null ? aString.id : null);
166 }
167
168 public void setTitleFont (NSFont fontObj)
169 {
170 OS.objc_msgSend(this.id, OS.sel_setTitleFont_1, fontObj !is null ? fontObj.id : null);
171 }
172
173 public void setTitlePosition (NSTitlePosition aPosition)
174 {
175 OS.objc_msgSend(this.id, OS.sel_setTitlePosition_1, aPosition);
176 }
177
178 public void setTitleWithMnemonic (NSString StringWithAmpersand)
179 {
180 OS.objc_msgSend(this.id, OS.sel_setTitleWithMnemonic_1, StringWithAmpersand !is null ? StringWithAmpersand.id : null);
181 }
182
183 public void setTransparent (bool flag)
184 {
185 OS.objc_msgSend(this.id, OS.sel_setTransparent_1, flag);
186 }
187
188 public void sizeToFit ()
189 {
190 OS.objc_msgSend(this.id, OS.sel_sizeToFit);
191 }
192
193 public NSString title ()
194 {
195 objc.id result = OS.objc_msgSend(this.id, OS.sel_title);
196 return result !is null ? new NSString(result) : null;
197 }
198
199 public NSCell titleCell ()
200 {
201 objc.id result = OS.objc_msgSend(this.id, OS.sel_titleCell);
202 return result !is null ? new NSCell(result) : null;
203 }
204
205 public NSFont titleFont ()
206 {
207 objc.id result = OS.objc_msgSend(this.id, OS.sel_titleFont);
208 return result !is null ? new NSFont(result) : null;
209 }
210
211 public NSTitlePosition titlePosition ()
212 {
213 return OS.objc_msgSend(this.id, OS.sel_titlePosition);
214 }
215
216 public NSRect titleRect ()
217 {
218 NSRect result;
219 OS.objc_msgSend_stret(result, this.id, OS.sel_titleRect);
220 return result;
221 }
222 }