Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSSlider.d @ 45:d8635bb48c7c
Merge with SWT 3.5
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 01 Dec 2008 17:07:00 +0100 |
parents | f565d3a95c0a |
children |
comparison
equal
deleted
inserted
replaced
44:ca5e494f2bbf | 45:d8635bb48c7c |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2007 IBM Corporation and others. | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
8 * Contributors: | 8 * Contributors: |
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 * | 10 * |
11 * Port to the D programming language: | 11 * Port to the D programming language: |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | 12 * Jacob Carlborg <doob@me.com> |
13 *******************************************************************************/ | 13 *******************************************************************************/ |
14 module dwt.internal.cocoa.NSSlider; | 14 module dwt.internal.cocoa.NSSlider; |
15 | 15 |
16 import dwt.internal.cocoa.CGFloat; | 16 import dwt.dwthelper.utils; |
17 import dwt.internal.cocoa.id; | 17 import cocoa = dwt.internal.cocoa.id; |
18 import dwt.internal.cocoa.NSCell; | |
19 import dwt.internal.cocoa.NSColor; | |
20 import dwt.internal.cocoa.NSControl; | 18 import dwt.internal.cocoa.NSControl; |
21 import dwt.internal.cocoa.NSEvent; | |
22 import dwt.internal.cocoa.NSFont; | |
23 import dwt.internal.cocoa.NSImage; | |
24 import dwt.internal.cocoa.NSInteger; | |
25 import dwt.internal.cocoa.NSPoint; | |
26 import dwt.internal.cocoa.NSRect; | |
27 import dwt.internal.cocoa.NSSliderCell : NSTickMarkPosition; | |
28 import dwt.internal.cocoa.NSString; | |
29 import dwt.internal.cocoa.OS; | 19 import dwt.internal.cocoa.OS; |
30 import objc = dwt.internal.objc.runtime; | 20 import objc = dwt.internal.objc.runtime; |
31 | 21 |
32 public class NSSlider : NSControl | 22 public class NSSlider : NSControl { |
33 { | |
34 | 23 |
35 public this () | 24 public this() { |
36 { | 25 super(); |
37 super(); | 26 } |
38 } | |
39 | 27 |
40 public this (objc.id id) | 28 public this(objc.id id) { |
41 { | 29 super(id); |
42 super(id); | 30 } |
43 } | |
44 | 31 |
45 public bool acceptsFirstMouse (NSEvent theEvent) | 32 public this(cocoa.id id) { |
46 { | 33 super(id); |
47 return OS.objc_msgSend(this.id_, OS.sel_acceptsFirstMouse_1, theEvent !is null ? theEvent.id_ : null) !is null; | 34 } |
48 } | |
49 | 35 |
50 public bool allowsTickMarkValuesOnly () | 36 public double maxValue() { |
51 { | 37 return OS.objc_msgSend_fpret(this.id, OS.sel_maxValue); |
52 return OS.objc_msgSend(this.id_, OS.sel_allowsTickMarkValuesOnly) !is null; | 38 } |
53 } | |
54 | 39 |
55 public double altIncrementValue () | 40 public double minValue() { |
56 { | 41 return OS.objc_msgSend_fpret(this.id, OS.sel_minValue); |
57 return cast(double) OS.objc_msgSend_fpret(this.id_, OS.sel_altIncrementValue); | 42 } |
58 } | |
59 | 43 |
60 public double closestTickMarkValueToValue (double value) | 44 public void setMaxValue(double aDouble) { |
61 { | 45 OS.objc_msgSend(this.id, OS.sel_setMaxValue_, aDouble); |
62 return cast(double) OS.objc_msgSend_fpret(this.id_, OS.sel_closestTickMarkValueToValue_1, value); | 46 } |
63 } | |
64 | 47 |
65 public NSImage image () | 48 public void setMinValue(double aDouble) { |
66 { | 49 OS.objc_msgSend(this.id, OS.sel_setMinValue_, aDouble); |
67 objc.id result = OS.objc_msgSend(this.id_, OS.sel_image); | 50 } |
68 return result !is null ? new NSImage(result) : null; | |
69 } | |
70 | 51 |
71 public NSInteger indexOfTickMarkAtPoint (NSPoint point) | 52 public static objc.Class cellClass() { |
72 { | 53 return cast(objc.Class) OS.objc_msgSend(OS.class_NSSlider, OS.sel_cellClass); |
73 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_indexOfTickMarkAtPoint_1, point); | 54 } |
74 } | |
75 | 55 |
76 public NSInteger isVertical () | 56 public static void setCellClass(objc.Class factoryId) { |
77 { | 57 OS.objc_msgSend(OS.class_NSSlider, OS.sel_setCellClass_, factoryId); |
78 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_isVertical); | 58 } |
79 } | |
80 | |
81 public CGFloat knobThickness () | |
82 { | |
83 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_knobThickness); | |
84 } | |
85 | |
86 public double maxValue () | |
87 { | |
88 return cast(double) OS.objc_msgSend_fpret(this.id_, OS.sel_maxValue); | |
89 } | |
90 | |
91 public double minValue () | |
92 { | |
93 return cast(double) OS.objc_msgSend_fpret(this.id_, OS.sel_minValue); | |
94 } | |
95 | |
96 public NSInteger numberOfTickMarks () | |
97 { | |
98 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_numberOfTickMarks); | |
99 } | |
100 | |
101 public NSRect rectOfTickMarkAtIndex (NSInteger index) | |
102 { | |
103 NSRect result; | |
104 OS.objc_msgSend_stret(&result, this.id_, OS.sel_rectOfTickMarkAtIndex_1, index); | |
105 return result; | |
106 } | |
107 | |
108 public void setAllowsTickMarkValuesOnly (bool yorn) | |
109 { | |
110 OS.objc_msgSend(this.id_, OS.sel_setAllowsTickMarkValuesOnly_1, yorn); | |
111 } | |
112 | |
113 public void setAltIncrementValue (double incValue) | |
114 { | |
115 OS.objc_msgSend(this.id_, OS.sel_setAltIncrementValue_1, incValue); | |
116 } | |
117 | |
118 public void setImage (NSImage backgroundImage) | |
119 { | |
120 OS.objc_msgSend(this.id_, OS.sel_setImage_1, backgroundImage !is null ? backgroundImage.id_ : null); | |
121 } | |
122 | |
123 public void setKnobThickness (CGFloat aFloat) | |
124 { | |
125 OS.objc_msgSend(this.id_, OS.sel_setKnobThickness_1, aFloat); | |
126 } | |
127 | |
128 public void setMaxValue (double aDouble) | |
129 { | |
130 OS.objc_msgSend(this.id_, OS.sel_setMaxValue_1, aDouble); | |
131 } | |
132 | |
133 public void setMinValue (double aDouble) | |
134 { | |
135 OS.objc_msgSend(this.id_, OS.sel_setMinValue_1, aDouble); | |
136 } | |
137 | |
138 public void setNumberOfTickMarks (NSInteger count) | |
139 { | |
140 OS.objc_msgSend(this.id_, OS.sel_setNumberOfTickMarks_1, count); | |
141 } | |
142 | |
143 public void setTickMarkPosition (NSTickMarkPosition position) | |
144 { | |
145 OS.objc_msgSend(this.id_, OS.sel_setTickMarkPosition_1, position); | |
146 } | |
147 | |
148 public void setTitle (NSString aString) | |
149 { | |
150 OS.objc_msgSend(this.id_, OS.sel_setTitle_1, aString !is null ? aString.id_ : null); | |
151 } | |
152 | |
153 public void setTitleCell (NSCell aCell) | |
154 { | |
155 OS.objc_msgSend(this.id_, OS.sel_setTitleCell_1, aCell !is null ? aCell.id_ : null); | |
156 } | |
157 | |
158 public void setTitleColor (NSColor newColor) | |
159 { | |
160 OS.objc_msgSend(this.id_, OS.sel_setTitleColor_1, newColor !is null ? newColor.id_ : null); | |
161 } | |
162 | |
163 public void setTitleFont (NSFont fontObj) | |
164 { | |
165 OS.objc_msgSend(this.id_, OS.sel_setTitleFont_1, fontObj !is null ? fontObj.id_ : null); | |
166 } | |
167 | |
168 public NSTickMarkPosition tickMarkPosition () | |
169 { | |
170 return cast(NSTickMarkPosition) OS.objc_msgSend(this.id_, OS.sel_tickMarkPosition); | |
171 } | |
172 | |
173 public double tickMarkValueAtIndex (NSInteger index) | |
174 { | |
175 return cast(double) OS.objc_msgSend_fpret(this.id_, OS.sel_tickMarkValueAtIndex_1, index); | |
176 } | |
177 | |
178 public NSString title () | |
179 { | |
180 objc.id result = OS.objc_msgSend(this.id_, OS.sel_title); | |
181 return result !is null ? new NSString(result) : null; | |
182 } | |
183 | |
184 public id titleCell () | |
185 { | |
186 objc.id result = OS.objc_msgSend(this.id_, OS.sel_titleCell); | |
187 return result !is null ? new id(result) : null; | |
188 } | |
189 | |
190 public NSColor titleColor () | |
191 { | |
192 objc.id result = OS.objc_msgSend(this.id_, OS.sel_titleColor); | |
193 return result !is null ? new NSColor(result) : null; | |
194 } | |
195 | |
196 public NSFont titleFont () | |
197 { | |
198 objc.id result = OS.objc_msgSend(this.id_, OS.sel_titleFont); | |
199 return result !is null ? new NSFont(result) : null; | |
200 } | |
201 | 59 |
202 } | 60 } |