Mercurial > projects > dwt-mac
changeset 73:16f9078aa1ff
Ported dwt.widgets.ProgressBar
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Tue, 23 Dec 2008 23:53:37 +0100 |
parents | e08aaf7b6830 |
children | 8e8040261b20 |
files | dwt/widgets/ProgressBar.d |
diffstat | 1 files changed, 13 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/dwt/widgets/ProgressBar.d Tue Dec 23 23:51:30 2008 +0100 +++ b/dwt/widgets/ProgressBar.d Tue Dec 23 23:53:37 2008 +0100 @@ -7,6 +7,9 @@ * * Contributors: * IBM Corporation - initial API and implementation + * + * Port to the D programming language: + * Jacob Carlborg <doob@me.com> *******************************************************************************/ module dwt.widgets.ProgressBar; @@ -20,6 +23,9 @@ import dwt.internal.cocoa.NSRect; import dwt.internal.cocoa.SWTProgressIndicator; +import dwt.widgets.Composite; +import dwt.widgets.Control; + /** * Instances of the receiver represent an unselectable * user interface object that is used to display progress, @@ -104,7 +110,7 @@ } void createHandle () { - NSProgressIndicator widget = cast(NSProgressIndicator)new SWTProgressIndicator().alloc(); + NSProgressIndicator widget = cast(NSProgressIndicator)(new SWTProgressIndicator()).alloc(); widget.initWithFrame(NSRect()); widget.setUsesThreadedAnimation(false); widget.setIndeterminate((style & DWT.INDETERMINATE) !is 0); @@ -194,12 +200,12 @@ */ public void setMaximum (int value) { checkWidget(); - int minimum = (int)((NSProgressIndicator)view).minValue(); + int minimum = cast(int)(cast(NSProgressIndicator)view).minValue(); if (value <= minimum) return; - int selection = (int)((NSProgressIndicator)view).doubleValue(); + int selection = cast(int)(cast(NSProgressIndicator)view).doubleValue(); int newSelection = Math.min (selection, value); if (selection !is newSelection) { - ((NSProgressIndicator)view).setDoubleValue(newSelection); + (cast(NSProgressIndicator)view).setDoubleValue(newSelection); } } @@ -218,12 +224,12 @@ */ public void setMinimum (int value) { checkWidget(); - int maximum = (int)((NSProgressIndicator)view).maxValue(); + int maximum = cast(int)(cast(NSProgressIndicator)view).maxValue(); if (!(0 <= value && value < maximum)) return; - int selection = (int)((NSProgressIndicator)view).doubleValue(); + int selection = cast(int)(cast(NSProgressIndicator)view).doubleValue(); int newSelection = Math.max (selection, value); if (selection !is newSelection) { - ((NSProgressIndicator)view).setDoubleValue(newSelection); + (cast(NSProgressIndicator)view).setDoubleValue(newSelection); } }