Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSSegmentedCell.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.NSSegmentedCell; | |
15 | |
16 import dwt.internal.cocoa.CGFloat; | |
17 import dwt.internal.cocoa.NSActionCell; | |
18 import dwt.internal.cocoa.NSImage; | |
19 import dwt.internal.cocoa.NSImageCell : NSImageScaling; | |
20 import dwt.internal.cocoa.NSInteger; | |
21 import dwt.internal.cocoa.NSMenu; | |
22 import dwt.internal.cocoa.NSRect; | |
23 import dwt.internal.cocoa.NSString; | |
24 import dwt.internal.cocoa.NSView; | |
25 import dwt.internal.cocoa.OS; | |
26 import objc = dwt.internal.objc.runtime; | |
27 | |
28 enum NSBackgroundStyle : NSUInteger | |
29 { | |
30 NSBackgroundStyleLight = 0, | |
31 NSBackgroundStyleDark, | |
32 NSBackgroundStyleRaised, | |
33 NSBackgroundStyleLowered | |
34 } | |
35 | |
36 alias NSBackgroundStyle.NSBackgroundStyleLight NSBackgroundStyleLight; | |
37 alias NSBackgroundStyle.NSBackgroundStyleDark NSBackgroundStyleDark; | |
38 alias NSBackgroundStyle.NSBackgroundStyleRaised NSBackgroundStyleRaised; | |
39 alias NSBackgroundStyle.NSBackgroundStyleLowered NSBackgroundStyleLowered; | |
40 | |
41 enum NSSegmentSwitchTracking | |
42 { | |
43 NSSegmentSwitchTrackingSelectOne = 0, | |
44 NSSegmentSwitchTrackingSelectAny = 1, | |
45 NSSegmentSwitchTrackingMomentary = 2 | |
46 } | |
47 | |
48 alias NSSegmentSwitchTracking.NSSegmentSwitchTrackingSelectOne NSSegmentSwitchTrackingSelectOne; | |
49 alias NSSegmentSwitchTracking.NSSegmentSwitchTrackingSelectAny NSSegmentSwitchTrackingSelectAny; | |
50 alias NSSegmentSwitchTracking.NSSegmentSwitchTrackingMomentary NSSegmentSwitchTrackingMomentary; | |
51 | |
52 public class NSSegmentedCell : NSActionCell | |
53 { | |
54 | |
55 public this () | |
56 { | |
57 super(); | |
58 } | |
59 | |
60 public this (objc.id id) | |
61 { | |
62 super(id); | |
63 } | |
64 | |
65 public void drawSegment (NSInteger segment, NSRect frame, NSView controlView) | |
66 { | |
67 OS.objc_msgSend(this.id, OS.sel_drawSegment_1inFrame_1withView_1, segment, frame, controlView !is null ? controlView.id : null); | |
68 } | |
69 | |
70 public NSImage imageForSegment (NSInteger segment) | |
71 { | |
72 objc.id result = OS.objc_msgSend(this.id, OS.sel_imageForSegment_1, segment); | |
73 return result !is null ? new NSImage(result) : null; | |
74 } | |
75 | |
76 public NSImageScaling imageScalingForSegment (NSInteger segment) | |
77 { | |
78 return OS.objc_msgSend(this.id, OS.sel_imageScalingForSegment_1, segment); | |
79 } | |
80 | |
81 public NSBackgroundStyle interiorBackgroundStyleForSegment (NSInteger segment) | |
82 { | |
83 return OS.objc_msgSend(this.id, OS.sel_interiorBackgroundStyleForSegment_1, segment); | |
84 } | |
85 | |
86 public bool isEnabledForSegment (NSInteger segment) | |
87 { | |
88 return OS.objc_msgSend(this.id, OS.sel_isEnabledForSegment_1, segment) !is null; | |
89 } | |
90 | |
91 public bool isSelectedForSegment (NSInteger segment) | |
92 { | |
93 return OS.objc_msgSend(this.id, OS.sel_isSelectedForSegment_1, segment) !is null; | |
94 } | |
95 | |
96 public NSString labelForSegment (NSInteger segment) | |
97 { | |
98 objc.id result = OS.objc_msgSend(this.id, OS.sel_labelForSegment_1, segment); | |
99 return result !is null ? new NSString(result) : null; | |
100 } | |
101 | |
102 public void makeNextSegmentKey () | |
103 { | |
104 OS.objc_msgSend(this.id, OS.sel_makeNextSegmentKey); | |
105 } | |
106 | |
107 public void makePreviousSegmentKey () | |
108 { | |
109 OS.objc_msgSend(this.id, OS.sel_makePreviousSegmentKey); | |
110 } | |
111 | |
112 public NSMenu menuForSegment (NSInteger segment) | |
113 { | |
114 objc.id result = OS.objc_msgSend(this.id, OS.sel_menuForSegment_1, segment); | |
115 return result !is null ? new NSMenu(result) : null; | |
116 } | |
117 | |
118 public NSInteger segmentCount () | |
119 { | |
120 return OS.objc_msgSend(this.id, OS.sel_segmentCount); | |
121 } | |
122 | |
123 public NSInteger segmentStyle () | |
124 { | |
125 return OS.objc_msgSend(this.id, OS.sel_segmentStyle); | |
126 } | |
127 | |
128 public bool selectSegmentWithTag (NSInteger tag) | |
129 { | |
130 return OS.objc_msgSend(this.id, OS.sel_selectSegmentWithTag_1, tag) !is null; | |
131 } | |
132 | |
133 public NSInteger selectedSegment () | |
134 { | |
135 return OS.objc_msgSend(this.id, OS.sel_selectedSegment); | |
136 } | |
137 | |
138 public void setEnabled (bool enabled, NSInteger segment) | |
139 { | |
140 OS.objc_msgSend(this.id, OS.sel_setEnabled_1forSegment_1, enabled, segment); | |
141 } | |
142 | |
143 public void setImage (NSImage image, NSInteger segment) | |
144 { | |
145 OS.objc_msgSend(this.id, OS.sel_setImage_1forSegment_1, image !is null ? image.id : null, segment); | |
146 } | |
147 | |
148 public void setImageScaling (NSImageScaling scaling, NSInteger segment) | |
149 { | |
150 OS.objc_msgSend(this.id, OS.sel_setImageScaling_1forSegment_1, scaling, segment); | |
151 } | |
152 | |
153 public void setLabel (NSString label, NSInteger segment) | |
154 { | |
155 OS.objc_msgSend(this.id, OS.sel_setLabel_1forSegment_1, label !is null ? label.id : null, segment); | |
156 } | |
157 | |
158 public void setMenu (NSMenu menu, NSInteger segment) | |
159 { | |
160 OS.objc_msgSend(this.id, OS.sel_setMenu_1forSegment_1, menu !is null ? menu.id : null, segment); | |
161 } | |
162 | |
163 public void setSegmentCount (NSInteger count) | |
164 { | |
165 OS.objc_msgSend(this.id, OS.sel_setSegmentCount_1, count); | |
166 } | |
167 | |
168 public void setSegmentStyle (NSInteger segmentStyle) | |
169 { | |
170 OS.objc_msgSend(this.id, OS.sel_setSegmentStyle_1, segmentStyle); | |
171 } | |
172 | |
173 public void setSelected (bool selected, NSInteger segment) | |
174 { | |
175 OS.objc_msgSend(this.id, OS.sel_setSelected_1forSegment_1, selected, segment); | |
176 } | |
177 | |
178 public void setSelectedSegment (NSInteger selectedSegment) | |
179 { | |
180 OS.objc_msgSend(this.id, OS.sel_setSelectedSegment_1, selectedSegment); | |
181 } | |
182 | |
183 public void setTag (NSInteger tag, NSInteger segment) | |
184 { | |
185 OS.objc_msgSend(this.id, OS.sel_setTag_1forSegment_1, tag, segment); | |
186 } | |
187 | |
188 public void setToolTip (NSString toolTip, NSInteger segment) | |
189 { | |
190 OS.objc_msgSend(this.id, OS.sel_setToolTip_1forSegment_1, toolTip !is null ? toolTip.id : null, segment); | |
191 } | |
192 | |
193 public void setTrackingMode (NSSegmentSwitchTracking trackingMode) | |
194 { | |
195 OS.objc_msgSend(this.id, OS.sel_setTrackingMode_1, trackingMode); | |
196 } | |
197 | |
198 public void setWidth (CGFloat width, NSInteger segment) | |
199 { | |
200 OS.objc_msgSend(this.id, OS.sel_setWidth_1forSegment_1, width, segment); | |
201 } | |
202 | |
203 public NSInteger tagForSegment (NSInteger segment) | |
204 { | |
205 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_tagForSegment_1, segment); | |
206 } | |
207 | |
208 public NSString toolTipForSegment (NSInteger segment) | |
209 { | |
210 objc.id result = OS.objc_msgSend(this.id, OS.sel_toolTipForSegment_1, segment); | |
211 return result !is null ? new NSString(result) : null; | |
212 } | |
213 | |
214 public NSSegmentSwitchTracking trackingMode () | |
215 { | |
216 return cast(NSSegmentSwitchTracking) OS.objc_msgSend(this.id, OS.sel_trackingMode); | |
217 } | |
218 | |
219 public CGFloat widthForSegment (NSInteger segment) | |
220 { | |
221 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_widthForSegment_1, segment); | |
222 } | |
223 | |
224 } |