comparison dwt/internal/cocoa/NSSliderCell.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.NSSliderCell;
15
16 import dwt.internal.cocoa.CGFloat;
17 import dwt.internal.cocoa.id;
18 import dwt.internal.cocoa.NSActionCell;
19 import dwt.internal.cocoa.NSCell;
20 import dwt.internal.cocoa.NSColor;
21 import dwt.internal.cocoa.NSFont;
22 import dwt.internal.cocoa.NSInteger;
23 import dwt.internal.cocoa.NSPoint;
24 import dwt.internal.cocoa.NSRect;
25 import dwt.internal.cocoa.NSString;
26 import dwt.internal.cocoa.OS;
27 import objc = dwt.internal.objc.runtime;
28
29
30
31 enum NSTickMarkPosition
32 {
33 NSTickMarkBelow = 0,
34 NSTickMarkAbove = 1,
35 NSTickMarkLeft = NSTickMarkAbove,
36 NSTickMarkRight = NSTickMarkBelow
37 }
38
39 alias NSTickMarkPosition.NSTickMarkBelow NSTickMarkBelow;
40 alias NSTickMarkPosition.NSTickMarkAbove NSTickMarkAbove;
41 alias NSTickMarkPosition.NSTickMarkLeft NSTickMarkLeft;
42 alias NSTickMarkPosition.NSTickMarkRight NSTickMarkRight;
43
44
45
46 enum NSSliderType
47 {
48 NSLinearSlider = 0,
49 NSCircularSlider = 1
50 }
51
52 alias NSSliderType.NSLinearSlider NSLinearSlider;
53 alias NSSliderType.NSCircularSlider NSCircularSlider;
54
55 public class NSSliderCell : NSActionCell
56 {
57
58 public this ()
59 {
60 super();
61 }
62
63 public this (objc.id id)
64 {
65 super(id);
66 }
67
68 public bool allowsTickMarkValuesOnly ()
69 {
70 return OS.objc_msgSend(this.id, OS.sel_allowsTickMarkValuesOnly) !is null;
71 }
72
73 public double altIncrementValue ()
74 {
75 return OS.objc_msgSend_fpret(this.id, OS.sel_altIncrementValue);
76 }
77
78 public double closestTickMarkValueToValue (double value)
79 {
80 return OS.objc_msgSend_fpret(this.id, OS.sel_closestTickMarkValueToValue_1, value);
81 }
82
83 public void drawBarInside (NSRect aRect, bool flipped)
84 {
85 OS.objc_msgSend(this.id, OS.sel_drawBarInside_1flipped_1, aRect, flipped);
86 }
87
88 public void drawKnob ()
89 {
90 OS.objc_msgSend(this.id, OS.sel_drawKnob);
91 }
92
93 public void drawKnob_ (NSRect knobRect)
94 {
95 OS.objc_msgSend(this.id, OS.sel_drawKnob_1, knobRect);
96 }
97
98 public NSInteger indexOfTickMarkAtPoint (NSPoint point)
99 {
100 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfTickMarkAtPoint_1, point);
101 }
102
103 public NSInteger isVertical ()
104 {
105 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_isVertical);
106 }
107
108 public NSRect knobRectFlipped (bool flipped)
109 {
110 NSRect result;
111 OS.objc_msgSend_stret(result, this.id, OS.sel_knobRectFlipped_1, flipped);
112 return result;
113 }
114
115 public CGFloat knobThickness ()
116 {
117 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_knobThickness);
118 }
119
120 public double maxValue ()
121 {
122 return OS.objc_msgSend_fpret(this.id, OS.sel_maxValue);
123 }
124
125 public double minValue ()
126 {
127 return OS.objc_msgSend_fpret(this.id, OS.sel_minValue);
128 }
129
130 public NSInteger numberOfTickMarks ()
131 {
132 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_numberOfTickMarks);
133 }
134
135 public static bool prefersTrackingUntilMouseUp ()
136 {
137 return OS.objc_msgSend(OS.class_NSSliderCell, OS.sel_prefersTrackingUntilMouseUp) !is null;
138 }
139
140 public NSRect rectOfTickMarkAtIndex (NSInteger index)
141 {
142 NSRect result;
143 OS.objc_msgSend_stret(result, this.id, OS.sel_rectOfTickMarkAtIndex_1, index);
144 return result;
145 }
146
147 public void setAllowsTickMarkValuesOnly (bool yorn)
148 {
149 OS.objc_msgSend(this.id, OS.sel_setAllowsTickMarkValuesOnly_1, yorn);
150 }
151
152 public void setAltIncrementValue (double incValue)
153 {
154 OS.objc_msgSend(this.id, OS.sel_setAltIncrementValue_1, incValue);
155 }
156
157 public void setKnobThickness (CGFloat aFloat)
158 {
159 OS.objc_msgSend(this.id, OS.sel_setKnobThickness_1, aFloat);
160 }
161
162 public void setMaxValue (double aDouble)
163 {
164 OS.objc_msgSend(this.id, OS.sel_setMaxValue_1, aDouble);
165 }
166
167 public void setMinValue (double aDouble)
168 {
169 OS.objc_msgSend(this.id, OS.sel_setMinValue_1, aDouble);
170 }
171
172 public void setNumberOfTickMarks (NSInteger count)
173 {
174 OS.objc_msgSend(this.id, OS.sel_setNumberOfTickMarks_1, count);
175 }
176
177 public void setSliderType (NSSliderType sliderType)
178 {
179 OS.objc_msgSend(this.id, OS.sel_setSliderType_1, sliderType);
180 }
181
182 public void setTickMarkPosition (NSTickMarkPosition position)
183 {
184 OS.objc_msgSend(this.id, OS.sel_setTickMarkPosition_1, position);
185 }
186
187 public void setTitle (NSString aString)
188 {
189 OS.objc_msgSend(this.id, OS.sel_setTitle_1, aString !is null ? aString.id : null);
190 }
191
192 public void setTitleCell (NSCell aCell)
193 {
194 OS.objc_msgSend(this.id, OS.sel_setTitleCell_1, aCell !is null ? aCell.id : null);
195 }
196
197 public void setTitleColor (NSColor newColor)
198 {
199 OS.objc_msgSend(this.id, OS.sel_setTitleColor_1, newColor !is null ? newColor.id : null);
200 }
201
202 public void setTitleFont (NSFont fontObj)
203 {
204 OS.objc_msgSend(this.id, OS.sel_setTitleFont_1, fontObj !is null ? fontObj.id : null);
205 }
206
207 public NSSliderType sliderType ()
208 {
209 return cast(NSSliderType) OS.objc_msgSend(this.id, OS.sel_sliderType);
210 }
211
212 public NSTickMarkPosition tickMarkPosition ()
213 {
214 return cast(NSTickMarkPosition) OS.objc_msgSend(this.id, OS.sel_tickMarkPosition);
215 }
216
217 public double tickMarkValueAtIndex (NSInteger index)
218 {
219 return OS.objc_msgSend_fpret(this.id, OS.sel_tickMarkValueAtIndex_1, index);
220 }
221
222 public NSString title ()
223 {
224 objc.id result = OS.objc_msgSend(this.id, OS.sel_title);
225 return result !is null ? new NSString(result) : null;
226 }
227
228 public id titleCell ()
229 {
230 objc.id result = OS.objc_msgSend(this.id, OS.sel_titleCell);
231 return result !is null ? new id(result) : null;
232 }
233
234 public NSColor titleColor ()
235 {
236 objc.id result = OS.objc_msgSend(this.id, OS.sel_titleColor);
237 return result !is null ? new NSColor(result) : null;
238 }
239
240 public NSFont titleFont ()
241 {
242 objc.id result = OS.objc_msgSend(this.id, OS.sel_titleFont);
243 return result !is null ? new NSFont(result) : null;
244 }
245
246 public NSRect trackRect ()
247 {
248 NSRect result;
249 OS.objc_msgSend_stret(result, this.id, OS.sel_trackRect);
250 return result;
251 }
252
253 }