Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSProgressIndicator.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.NSProgressIndicator; | 14 module dwt.internal.cocoa.NSProgressIndicator; |
15 | 15 |
16 import dwt.internal.cocoa.id; | 16 import dwt.dwthelper.utils; |
17 import dwt.internal.cocoa.NSDate : NSTimeInterval; | 17 import cocoa = dwt.internal.cocoa.id; |
18 import dwt.internal.cocoa.NSCell : NSControlTint, NSControlSize; | |
19 import dwt.internal.cocoa.NSView; | 18 import dwt.internal.cocoa.NSView; |
20 import dwt.internal.cocoa.OS; | 19 import dwt.internal.cocoa.OS; |
21 import objc = dwt.internal.objc.runtime; | 20 import objc = dwt.internal.objc.runtime; |
22 | 21 |
23 enum NSProgressIndicatorStyle | 22 public class NSProgressIndicator : NSView { |
24 { | 23 |
25 NSProgressIndicatorBarStyle = 0, | 24 public this() { |
26 NSProgressIndicatorSpinningStyle = 1 | 25 super(); |
27 } | 26 } |
28 | 27 |
29 alias NSProgressIndicatorStyle.NSProgressIndicatorBarStyle NSProgressIndicatorBarStyle; | 28 public this(objc.id id) { |
30 alias NSProgressIndicatorStyle.NSProgressIndicatorSpinningStyle NSProgressIndicatorSpinningStyle; | 29 super(id); |
30 } | |
31 | 31 |
32 public class NSProgressIndicator : NSView | 32 public this(cocoa.id id) { |
33 { | 33 super(id); |
34 } | |
34 | 35 |
35 public this () | 36 public double doubleValue() { |
36 { | 37 return OS.objc_msgSend_fpret(this.id, OS.sel_doubleValue); |
37 super(); | 38 } |
38 } | |
39 | 39 |
40 public this (objc.id id) | 40 public double maxValue() { |
41 { | 41 return OS.objc_msgSend_fpret(this.id, OS.sel_maxValue); |
42 super(id); | 42 } |
43 } | |
44 | 43 |
45 public void animate (id sender) | 44 public double minValue() { |
46 { | 45 return OS.objc_msgSend_fpret(this.id, OS.sel_minValue); |
47 OS.objc_msgSend(this.id_, OS.sel_animate_1, sender !is null ? sender.id_ : null); | 46 } |
48 } | |
49 | 47 |
50 public NSTimeInterval animationDelay () | 48 public void setDoubleValue(double doubleValue) { |
51 { | 49 OS.objc_msgSend(this.id, OS.sel_setDoubleValue_, doubleValue); |
52 return cast(NSTimeInterval) OS.objc_msgSend_fpret(this.id_, OS.sel_animationDelay); | 50 } |
53 } | |
54 | 51 |
55 public NSControlSize controlSize () | 52 public void setIndeterminate(bool flag) { |
56 { | 53 OS.objc_msgSend(this.id, OS.sel_setIndeterminate_, flag); |
57 return cast(NSControlSize) OS.objc_msgSend(this.id_, OS.sel_controlSize); | 54 } |
58 } | |
59 | 55 |
60 public NSControlTint controlTint () | 56 public void setMaxValue(double newMaximum) { |
61 { | 57 OS.objc_msgSend(this.id, OS.sel_setMaxValue_, newMaximum); |
62 return cast(NSControlTint) OS.objc_msgSend(this.id_, OS.sel_controlTint); | 58 } |
63 } | |
64 | 59 |
65 public double doubleValue () | 60 public void setMinValue(double newMinimum) { |
66 { | 61 OS.objc_msgSend(this.id, OS.sel_setMinValue_, newMinimum); |
67 return OS.objc_msgSend_fpret(this.id_, OS.sel_doubleValue); | 62 } |
68 } | |
69 | 63 |
70 public void incrementBy (double delta) | 64 public void setUsesThreadedAnimation(bool threadedAnimation) { |
71 { | 65 OS.objc_msgSend(this.id, OS.sel_setUsesThreadedAnimation_, threadedAnimation); |
72 OS.objc_msgSend(this.id_, OS.sel_incrementBy_1, delta); | 66 } |
73 } | |
74 | 67 |
75 public bool isBezeled () | 68 public void sizeToFit() { |
76 { | 69 OS.objc_msgSend(this.id, OS.sel_sizeToFit); |
77 return OS.objc_msgSend(this.id_, OS.sel_isBezeled) !is null; | 70 } |
78 } | |
79 | 71 |
80 public bool isDisplayedWhenStopped () | 72 public void startAnimation(cocoa.id sender) { |
81 { | 73 OS.objc_msgSend(this.id, OS.sel_startAnimation_, sender !is null ? sender.id : null); |
82 return OS.objc_msgSend(this.id_, OS.sel_isDisplayedWhenStopped) !is null; | 74 } |
83 } | |
84 | |
85 public bool isIndeterminate () | |
86 { | |
87 return OS.objc_msgSend(this.id_, OS.sel_isIndeterminate) !is null; | |
88 } | |
89 | |
90 public double maxValue () | |
91 { | |
92 return OS.objc_msgSend_fpret(this.id_, OS.sel_maxValue); | |
93 } | |
94 | |
95 public double minValue () | |
96 { | |
97 return OS.objc_msgSend_fpret(this.id_, OS.sel_minValue); | |
98 } | |
99 | |
100 public void setAnimationDelay (NSTimeInterval delay) | |
101 { | |
102 OS.objc_msgSend(this.id_, OS.sel_setAnimationDelay_1, delay); | |
103 } | |
104 | |
105 public void setBezeled (bool flag) | |
106 { | |
107 OS.objc_msgSend(this.id_, OS.sel_setBezeled_1, flag); | |
108 } | |
109 | |
110 public void setControlSize (NSControlSize size) | |
111 { | |
112 OS.objc_msgSend(this.id_, OS.sel_setControlSize_1, size); | |
113 } | |
114 | |
115 public void setControlTint (NSControlSize tint) | |
116 { | |
117 OS.objc_msgSend(this.id_, OS.sel_setControlTint_1, tint); | |
118 } | |
119 | |
120 public void setDisplayedWhenStopped (bool isDisplayed) | |
121 { | |
122 OS.objc_msgSend(this.id_, OS.sel_setDisplayedWhenStopped_1, isDisplayed); | |
123 } | |
124 | |
125 public void setDoubleValue (double doubleValue) | |
126 { | |
127 OS.objc_msgSend(this.id_, OS.sel_setDoubleValue_1, doubleValue); | |
128 } | |
129 | |
130 public void setIndeterminate (bool flag) | |
131 { | |
132 OS.objc_msgSend(this.id_, OS.sel_setIndeterminate_1, flag); | |
133 } | |
134 | |
135 public void setMaxValue (double newMaximum) | |
136 { | |
137 OS.objc_msgSend(this.id_, OS.sel_setMaxValue_1, newMaximum); | |
138 } | |
139 | |
140 public void setMinValue (double newMinimum) | |
141 { | |
142 OS.objc_msgSend(this.id_, OS.sel_setMinValue_1, newMinimum); | |
143 } | |
144 | |
145 public void setStyle (NSProgressIndicatorStyle style) | |
146 { | |
147 OS.objc_msgSend(this.id_, OS.sel_setStyle_1, style); | |
148 } | |
149 | |
150 public void setUsesThreadedAnimation (bool threadedAnimation) | |
151 { | |
152 OS.objc_msgSend(this.id_, OS.sel_setUsesThreadedAnimation_1, threadedAnimation); | |
153 } | |
154 | |
155 public void sizeToFit () | |
156 { | |
157 OS.objc_msgSend(this.id_, OS.sel_sizeToFit); | |
158 } | |
159 | |
160 public void startAnimation (id sender) | |
161 { | |
162 OS.objc_msgSend(this.id_, OS.sel_startAnimation_1, sender !is null ? sender.id_ : null); | |
163 } | |
164 | |
165 public void stopAnimation (id sender) | |
166 { | |
167 OS.objc_msgSend(this.id_, OS.sel_stopAnimation_1, sender !is null ? sender.id_ : null); | |
168 } | |
169 | |
170 public NSProgressIndicatorStyle style () | |
171 { | |
172 return cast(NSProgressIndicatorStyle) OS.objc_msgSend(this.id_, OS.sel_style); | |
173 } | |
174 | |
175 public bool usesThreadedAnimation () | |
176 { | |
177 return OS.objc_msgSend(this.id_, OS.sel_usesThreadedAnimation) !is null; | |
178 } | |
179 | 75 |
180 } | 76 } |