diff dwt/widgets/Button.d @ 60:62202ce0039f

Updated and fixed many modules to 3.514
author Jacob Carlborg <doob@me.com>
date Mon, 22 Dec 2008 15:10:19 +0100
parents 858e9a565d62
children 63a09873578e
line wrap: on
line diff
--- a/dwt/widgets/Button.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/widgets/Button.d	Mon Dec 22 15:10:19 2008 +0100
@@ -41,7 +41,7 @@
 import cocoa = dwt.internal.cocoa.id;
 
 import dwt.dwthelper.utils;
-import dwt.internal.c.Carbon;
+import Carbon = dwt.internal.c.Carbon;
 import dwt.internal.cocoa.NSCell;
 import dwt.internal.cocoa.NSText;
 import dwt.internal.objc.cocoa.Cocoa;
@@ -219,7 +219,7 @@
 NSAttributedString createString() {
     NSMutableDictionary dict = NSMutableDictionary.dictionaryWithCapacity(4);
     if (foreground !is null) {
-        NSColor color = NSColor.colorWithDeviceRed(cast(CGFloat) foreground.handle[0], cast(CGFloat) foreground.handle[1], cast(CGFloat) foreground.handle[2], 1);
+        NSColor color = NSColor.colorWithDeviceRed(cast(Carbon.CGFloat) foreground.handle[0], cast(Carbon.CGFloat) foreground.handle[1], cast(Carbon.CGFloat) foreground.handle[2], 1);
         dict.setObject(color, OS.NSForegroundColorAttributeName);
     }
 
@@ -248,29 +248,29 @@
 
 void createHandle () {
     NSButton widget = cast(NSButton)(new SWTButton()).alloc();
-    widget.initWithFrame(new NSRect());
+    widget.initWithFrame(NSRect());
     NSButtonType type = OS.NSMomentaryLightButton;
-    if ((style & SWT.PUSH) !is 0) {
-        if ((style & SWT.FLAT) !is 0) {
+    if ((style & DWT.PUSH) !is 0) {
+        if ((style & DWT.FLAT) !is 0) {
             widget.setBezelStyle(OS.NSShadowlessSquareBezelStyle);
-//          if ((style & SWT.BORDER) is 0) widget.setShowsBorderOnlyWhileMouseInside(true);
+//          if ((style & DWT.BORDER) is 0) widget.setShowsBorderOnlyWhileMouseInside(true);
         } else {
             widget.setBezelStyle(OS.NSRoundedBezelStyle);
         }
-    } else if ((style & SWT.CHECK) !is 0) {
+    } else if ((style & DWT.CHECK) !is 0) {
         type = OS.NSSwitchButton;
         widget.setAllowsMixedState (true);
-    } else if ((style & SWT.RADIO) !is 0) {
+    } else if ((style & DWT.RADIO) !is 0) {
         type = OS.NSRadioButton;        
-    } else if ((style & SWT.TOGGLE) !is 0) {
+    } else if ((style & DWT.TOGGLE) !is 0) {
         type = OS.NSPushOnPushOffButton;
-        if ((style & SWT.FLAT) !is 0) {
+        if ((style & DWT.FLAT) !is 0) {
             widget.setBezelStyle(OS.NSShadowlessSquareBezelStyle);
-//          if ((style & SWT.BORDER) is 0) widget.setShowsBorderOnlyWhileMouseInside(true);
+//          if ((style & DWT.BORDER) is 0) widget.setShowsBorderOnlyWhileMouseInside(true);
         } else {
             widget.setBezelStyle(OS.NSRoundedBezelStyle);
         }
-    } else if ((style & SWT.ARROW) !is 0) {
+    } else if ((style & DWT.ARROW) !is 0) {
         widget.setBezelStyle(OS.NSRegularSquareBezelStyle);
     }
     widget.setButtonType(type);
@@ -294,13 +294,13 @@
         NSGraphicsContext context = NSGraphicsContext.currentContext();
         context.saveGraphicsState();
         NSPoint p1 = NSPoint();
-        p1.x = cast(CGFloat)Math.floor(-arrowSize / 2);
-        p1.y = cast(CGFloat)Math.floor(-arrowSize / 2);
+        p1.x = cast(Carbon.CGFloat)Math.floor(-arrowSize / 2);
+        p1.y = cast(Carbon.CGFloat)Math.floor(-arrowSize / 2);
         NSPoint p2 = NSPoint();
-        p2.x = cast(CGFloat)Math.ceil(arrowSize / 2);
+        p2.x = cast(Carbon.CGFloat)Math.ceil(arrowSize / 2);
         p2.y = p1.y;
         NSPoint p3 = NSPoint();
-        p3.y = cast(CGFloat)Math.ceil(arrowSize / 2);
+        p3.y = cast(Carbon.CGFloat)Math.ceil(arrowSize / 2);
     
         NSBezierPath path = NSBezierPath.bezierPath();
         path.moveToPoint(p1);
@@ -592,7 +592,7 @@
     if (color is null) {
         return; // TODO set to OS default
     } else {
-        nsColor = NSColor.colorWithDeviceRed(cast(CGFloat) color[0], cast(CGFloat) color[1], cast(CGFloat) color[2], 1);
+        nsColor = NSColor.colorWithDeviceRed(cast(Carbon.CGFloat) color[0], cast(Carbon.CGFloat) color[1], cast(Carbon.CGFloat) color[2], 1);
     }
     NSButtonCell cell = new NSButtonCell((cast(NSButton)view).cell());
     cell.setBackgroundColor(nsColor);