Mercurial > projects > dwt-mac
diff dwt/widgets/Spinner.d @ 123:63a09873578e
Fixed compile errors
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Thu, 15 Jan 2009 23:08:54 +0100 |
parents | c7f7f4d7091a |
children |
line wrap: on
line diff
--- a/dwt/widgets/Spinner.d Wed Dec 31 21:01:13 2008 +0100 +++ b/dwt/widgets/Spinner.d Thu Jan 15 23:08:54 2009 +0100 @@ -80,7 +80,7 @@ int digits = 0; static int GAP = 0; - + /** * Constructs a new instance of this class given its parent * and a style value describing its behavior and appearance. @@ -205,12 +205,12 @@ static int checkStyle (int style) { /* - * Even though it is legal to create this widget - * with scroll bars, they serve no useful purpose - * because they do not automatically scroll the - * widget's client area. The fix is to clear - * the DWT style. - */ + * Even though it is legal to create this widget + * with scroll bars, they serve no useful purpose + * because they do not automatically scroll the + * widget's client area. The fix is to clear + * the DWT style. + */ return style & ~(DWT.H_SCROLL | DWT.V_SCROLL); } @@ -264,25 +264,25 @@ */ public void copy () { checkWidget (); -// short [] selection = new short [2]; -// 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, 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]; -// char [] buffer= new char [range.length]; -// OS.CFStringGetCharacters (ptr [0], range, buffer); -// OS.CFRelease (ptr [0]); -// copyToClipboard (buffer); + // short [] selection = new short [2]; + // 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, 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]; + // char [] buffer= new char [range.length]; + // OS.CFStringGetCharacters (ptr [0], range, buffer); + // OS.CFRelease (ptr [0]); + // copyToClipboard (buffer); } void createHandle () { NSView widget = cast(NSView)(new SWTView()).alloc(); widget.initWithFrame(NSRect()); -// widget.setDrawsBackground(false); + // widget.setDrawsBackground(false); NSStepper buttonWidget = cast(NSStepper)(new SWTStepper()).alloc(); buttonWidget.initWithFrame(NSRect()); buttonWidget.setValueWraps((style & DWT.WRAP) !is 0); @@ -290,7 +290,7 @@ buttonWidget.setAction(OS.sel_sendSelection); NSTextField textWidget = cast(NSTextField)(new SWTTextField()).alloc(); textWidget.initWithFrame(NSRect()); -// textWidget.setTarget(widget); + // textWidget.setTarget(widget); textWidget.setEditable((style & DWT.READ_ONLY) is 0); textFormatter = new NSNumberFormatter(); textFormatter.alloc().init(); //.autorelease(); @@ -319,13 +319,13 @@ public void cut () { checkWidget (); if ((style & DWT.READ_ONLY) !is 0) return; -// short [] selection = new short [2]; -// 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) { -// copyToClipboard (buffer); -// } + // short [] selection = new short [2]; + // 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) { + // copyToClipboard (buffer); + // } } void deregister () { @@ -488,11 +488,11 @@ int delta = 0; wchar keyChar = 0; - + if (chars.length() !is 1) return; keyChar = chars.characterAtIndex(0); - + switch (keyChar) { case OS.NSEnterCharacter: /* KP Enter */ case OS.NSNewlineCharacter: /* Return */ @@ -502,7 +502,7 @@ case OS.NSPageDownFunctionKey: delta = -pageIncrement; break; case OS.NSDownArrowFunctionKey: delta = -getIncrement(); break; case OS.NSUpArrowFunctionKey: delta = getIncrement(); break; - + default: { NSCharacterSet numbers = new NSCharacterSet(NSCharacterSet.decimalDigitCharacterSet().id); bool isANumber = numbers.characterIsMember(cast(short) keyChar); @@ -511,7 +511,7 @@ if (isANumber || (isSeparator && digits > 0) || isMathSymbol) super.keyDown(id, sel, theEvent); } } - + if (delta !is 0) { bool [] parseFail = new bool [1]; int value = getSelectionText (parseFail); @@ -553,10 +553,10 @@ public void paste () { checkWidget (); if ((style & DWT.READ_ONLY) !is 0) return; -// String text = getClipboardText (); -// short [] selection = new short [2]; -// if (OS.GetControlData (textHandle, cast(short)OS.kControlEntireControl, OS.kControlEditTextSelectionTag, 4, selection, null) !is OS.noErr) return; -// setText (text, selection [0], selection [1], true); + // String text = getClipboardText (); + // short [] selection = new short [2]; + // if (OS.GetControlData (textHandle, cast(short)OS.kControlEntireControl, OS.kControlEditTextSelectionTag, 4, selection, null) !is OS.noErr) return; + // setText (text, selection [0], selection [1], true); } void register () {