comparison dwt/widgets/ColorDialog.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 642f460a0908
comparison
equal deleted inserted replaced
6:b903c16b6f48 7:e831403a80a9
127 NSColorPanel panel = NSColorPanel.sharedColorPanel(); 127 NSColorPanel panel = NSColorPanel.sharedColorPanel();
128 if (rgb !is null) { 128 if (rgb !is null) {
129 NSColor color = NSColor.colorWithDeviceRed(rgb.red / 255f, rgb.green / 255f, rgb.blue / 255f, 1); 129 NSColor color = NSColor.colorWithDeviceRed(rgb.red / 255f, rgb.green / 255f, rgb.blue / 255f, 1);
130 panel.setColor(color); 130 panel.setColor(color);
131 } 131 }
132 SWTPanelDelegate delegate = (SWTPanelDelegate)new SWTPanelDelegate().alloc().init(); 132 SWTPanelDelegate delegate = cast(SWTPanelDelegate)new SWTPanelDelegate().alloc().init();
133 int jniRef = OS.NewGlobalRef(this); 133 int jniRef = OS.NewGlobalRef(this);
134 if (jniRef is 0) DWT.error(DWT.ERROR_NO_HANDLES); 134 if (jniRef is 0) DWT.error(DWT.ERROR_NO_HANDLES);
135 delegate.setTag(jniRef); 135 delegate.setTag(jniRef);
136 panel.setDelegate(delegate); 136 panel.setDelegate(delegate);
137 rgb = null; 137 rgb = null;
141 delegate.release(); 141 delegate.release();
142 OS.DeleteGlobalRef(jniRef); 142 OS.DeleteGlobalRef(jniRef);
143 NSColor color = panel.color(); 143 NSColor color = panel.color();
144 if (color !is null) { 144 if (color !is null) {
145 color = color.colorUsingColorSpaceName_(NSString.stringWith("NSCalibratedRGBColorSpace")); 145 color = color.colorUsingColorSpaceName_(NSString.stringWith("NSCalibratedRGBColorSpace"));
146 rgb = new RGB((int)(color.redComponent() * 255), (int)(color.greenComponent() * 255), (int)(color.blueComponent() * 255)); 146 rgb = new RGB(cast(int)(color.redComponent() * 255), cast(int)(color.greenComponent() * 255), cast(int)(color.blueComponent() * 255));
147 } 147 }
148 return rgb; 148 return rgb;
149 } 149 }
150 150
151 /** 151 /**