# HG changeset patch # User Jacob Carlborg # Date 1230072817 -3600 # Node ID 16f9078aa1ff0de27b674973b2deee8b13c0e355 # Parent e08aaf7b68307fdf664b23b3e9c782134f64c485 Ported dwt.widgets.ProgressBar diff -r e08aaf7b6830 -r 16f9078aa1ff dwt/widgets/ProgressBar.d --- 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 *******************************************************************************/ 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); } }