Mercurial > projects > dwt-mac
diff dwt/widgets/Spinner.d @ 7:e831403a80a9
Add 'cast' to casts
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 27 Aug 2008 14:30:35 +0200 |
parents | 1a8b3cb347e0 |
children | d8635bb48c7c |
line wrap: on
line diff
--- a/dwt/widgets/Spinner.d Wed Aug 27 14:10:03 2008 +0200 +++ b/dwt/widgets/Spinner.d Wed Aug 27 14:30:35 2008 +0200 @@ -203,7 +203,7 @@ char [] chars = new char [length]; string.getChars (0, length, chars, 0); NSString nsString = NSString.stringWithCharacters (chars, length); - NSAttributedString str = ((NSAttributedString) new NSAttributedString ().alloc ()).initWithString_attributes_ (nsString, dict); + NSAttributedString str = (cast(NSAttributedString) new NSAttributedString ().alloc ()).initWithString_attributes_ (nsString, dict); NSSize size = str.size (); str.release (); width = size.width; @@ -222,7 +222,7 @@ height = Math.max (height, newRect.height); if (wHint !is DWT.DEFAULT) width = wHint; if (hHint !is DWT.DEFAULT) height = hHint; - Rectangle trim = computeTrim (0, 0, (int) width, (int) height); + Rectangle trim = computeTrim (0, 0, cast(int) width, cast(int) height); return new Point (trim.width, trim.height); } @@ -240,11 +240,11 @@ public void copy () { checkWidget (); // short [] selection = new short [2]; -// if (OS.GetControlData (textHandle, (short)OS.kControlEntireControl, OS.kControlEditTextSelectionTag, 4, selection, null) !is OS.noErr) return; +// if (OS.GetControlData (textHandle, cast(short)OS.kControlEntireControl, OS.kControlEditTextSelectionTag, 4, selection, null) !is OS.noErr) return; // if (selection [0] is selection [1]) return; // int [] actualSize = new int [1]; // int [] ptr = new int [1]; -// if (OS.GetControlData (textHandle, (short)OS.kControlEntireControl, OS.kControlEditTextCFStringTag, 4, ptr, actualSize) !is OS.noErr) return; +// if (OS.GetControlData (textHandle, cast(short)OS.kControlEntireControl, OS.kControlEditTextCFStringTag, 4, ptr, actualSize) !is OS.noErr) return; // CFRange range = new CFRange (); // range.location = selection [0]; // range.length = selection [1] - selection [0]; @@ -255,17 +255,17 @@ } void createHandle () { - SWTView widget = (SWTView)new SWTView().alloc(); + SWTView widget = cast(SWTView)new SWTView().alloc(); widget.initWithFrame(new NSRect()); // widget.setDrawsBackground(false); widget.setTag(jniRef); - NSStepper buttonWidget = (NSStepper)new SWTStepper().alloc(); + NSStepper buttonWidget = cast(NSStepper)new SWTStepper().alloc(); buttonWidget.initWithFrame(new NSRect()); buttonWidget.setValueWraps((style & DWT.WRAP) !is 0); buttonWidget.setTarget(buttonWidget); buttonWidget.setAction(OS.sel_sendSelection); buttonWidget.setTag(jniRef); - NSTextField textWidget = (NSTextField)new SWTTextField().alloc(); + NSTextField textWidget = cast(NSTextField)new SWTTextField().alloc(); textWidget.initWithFrame(new NSRect()); // textWidget.setTarget(widget); textWidget.setTag(jniRef); @@ -295,7 +295,7 @@ checkWidget (); if ((style & DWT.READ_ONLY) !is 0) return; // short [] selection = new short [2]; -// if (OS.GetControlData (textHandle, (short)OS.kControlEntireControl, OS.kControlEditTextSelectionTag, 4, selection, null) !is OS.noErr) return; +// if (OS.GetControlData (textHandle, cast(short)OS.kControlEntireControl, OS.kControlEditTextSelectionTag, 4, selection, null) !is OS.noErr) return; // if (selection [0] is selection [1]) return; // char [] buffer = setText ("", selection [0], selection [1], true); // if (buffer !is null) { @@ -336,7 +336,7 @@ */ public int getIncrement () { checkWidget (); - return (int)buttonView.increment(); + return cast(int)buttonView.increment(); } /** @@ -351,7 +351,7 @@ */ public int getMaximum () { checkWidget (); - return (int)buttonView.maxValue(); + return cast(int)buttonView.maxValue(); } /** @@ -366,7 +366,7 @@ */ public int getMinimum () { checkWidget (); - return (int)buttonView.minValue(); + return cast(int)buttonView.minValue(); } /** @@ -397,7 +397,7 @@ */ public int getSelection () { checkWidget (); - return (int)((NSStepper)buttonView).doubleValue(); + return cast(int)(cast(NSStepper)buttonView).doubleValue(); } int getSelectionText () { @@ -421,7 +421,7 @@ if ((style & DWT.READ_ONLY) !is 0) return; // String text = getClipboardText (); // short [] selection = new short [2]; -// if (OS.GetControlData (textHandle, (short)OS.kControlEntireControl, OS.kControlEditTextSelectionTag, 4, selection, null) !is OS.noErr) return; +// if (OS.GetControlData (textHandle, cast(short)OS.kControlEntireControl, OS.kControlEditTextSelectionTag, 4, selection, null) !is OS.noErr) return; // setText (text, selection [0], selection [1], true); } @@ -667,7 +667,7 @@ void setSelection (int value, bool setPos, bool setText, bool notify) { if (setPos) { - ((NSStepper)buttonView).setDoubleValue(value); + (cast(NSStepper)buttonView).setDoubleValue(value); } if (setText) { String string = String.valueOf (value); @@ -694,8 +694,8 @@ if (string is null) return; } cell.setTitle(NSString.stringWith(string)); -// short [] selection = new short [] {0, (short)string.length ()}; -// OS.SetControlData (textHandle, (short)OS.kControlEntireControl, OS.kControlEditTextSelectionTag, 4, selection); +// short [] selection = new short [] {0, cast(short)string.length ()}; +// OS.SetControlData (textHandle, cast(short)OS.kControlEntireControl, OS.kControlEditTextSelectionTag, 4, selection); sendEvent (DWT.Modify); } if (notify) postEvent (DWT.Selection);