diff dwt/widgets/CoolItem.d @ 63:a3f5118c8b37

Ported CoolBar and CoolItem
author Jacob Carlborg <doob@me.com>
date Tue, 23 Dec 2008 22:38:33 +0100
parents d8635bb48c7c
children c7f7f4d7091a
line wrap: on
line diff
--- a/dwt/widgets/CoolItem.d	Tue Dec 23 22:21:02 2008 +0100
+++ b/dwt/widgets/CoolItem.d	Tue Dec 23 22:38:33 2008 +0100
@@ -7,6 +7,9 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     
+ * Port to the D programming language:
+ *     Jacob Carlborg <doob@me.com>
  *******************************************************************************/
 module dwt.widgets.CoolItem;
 
@@ -25,6 +28,14 @@
 import dwt.graphics.Point;
 import dwt.graphics.RGB;
 import dwt.graphics.Rectangle;
+
+import dwt.widgets.Control;
+import dwt.widgets.CoolBar;
+import dwt.widgets.Event;
+import dwt.widgets.Item;
+import dwt.widgets.ToolBar;
+import dwt.widgets.ToolItem;
+import dwt.widgets.TypedListener;
  
 /**
  * Instances of this class are selectable user interface
@@ -261,7 +272,7 @@
     Color black = display.getSystemColor (DWT.COLOR_BLACK);
     Color background = parent.getBackground ();
     
-    PaletteData palette = new PaletteData (new RGB[]{foreground.getRGB(), background.getRGB(), black.getRGB()});
+    PaletteData palette = new PaletteData ([foreground.getRGB(), background.getRGB(), black.getRGB()]);
     ImageData imageData = new ImageData (width, height, 4, palette);
     imageData.transparentPixel = 1;
     Image image = new Image (display, imageData);
@@ -624,9 +635,9 @@
             if (chevron is null) {
                 chevron = new ToolBar (parent, DWT.FLAT | DWT.NO_FOCUS);
                 ToolItem toolItem = new ToolItem (chevron, DWT.PUSH);
-                toolItem.addListener (DWT.Selection, new Listener() {
+                toolItem.addListener (DWT.Selection, new class () Listener {
                     public void handleEvent (Event event) {
-                        CoolItem.this.onSelection (event);
+                        CoolItem.outer.onSelection (event);
                     }
                 });
             }