changeset 67:a47b2ee8cbde

Ported dwt.widgets.ExpandItem
author Jacob Carlborg <doob@me.com>
date Tue, 23 Dec 2008 23:04:31 +0100
parents 51015bbcb4c6
children cce7edf30dae
files dwt/widgets/ExpandItem.d
diffstat 1 files changed, 19 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/widgets/ExpandItem.d	Tue Dec 23 22:57:31 2008 +0100
+++ b/dwt/widgets/ExpandItem.d	Tue Dec 23 23:04:31 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.ExpandItem;
 
@@ -19,6 +22,11 @@
 import dwt.graphics.Point;
 import dwt.graphics.Rectangle;
 
+import dwt.widgets.Control;
+import dwt.widgets.Display;
+import dwt.widgets.ExpandBar;
+import dwt.widgets.Item;
+
 /**
  * Instances of this class represent a selectable user interface object
  * that represents a expandable item in a expand bar.
@@ -44,9 +52,9 @@
     bool expanded;
     int x, y, width, height;
     int imageHeight, imageWidth;
-    static final int TEXT_INSET = 6;
-    static final int BORDER = 1;
-    static final int CHEVRON_SIZE = 24;
+    static const int TEXT_INSET = 6;
+    static const int BORDER = 1;
+    static const int CHEVRON_SIZE = 24;
 
 /**
  * Constructs a new instance of this class given its parent
@@ -134,23 +142,23 @@
     if (expanded) {
         int px = x + 4 + 5;
         int py = y + 4 + 7;
-        polyline1 = new int [] {
+        polyline1 = [
                 px,py, px+1,py, px+1,py-1, px+2,py-1, px+2,py-2, px+3,py-2, px+3,py-3,
-                px+3,py-2, px+4,py-2, px+4,py-1, px+5,py-1, px+5,py, px+6,py};
+                px+3,py-2, px+4,py-2, px+4,py-1, px+5,py-1, px+5,py, px+6,py];
         py += 4;
-        polyline2 = new int [] {
+        polyline2 = [
                 px,py, px+1,py, px+1,py-1, px+2,py-1, px+2,py-2, px+3,py-2, px+3,py-3,
-                px+3,py-2, px+4,py-2, px+4,py-1,  px+5,py-1, px+5,py, px+6,py};
+                px+3,py-2, px+4,py-2, px+4,py-1,  px+5,py-1, px+5,py, px+6,py];
     } else {
         int px = x + 4 + 5;
         int py = y + 4 + 4;
-        polyline1 = new int[] {
+        polyline1 = [
                 px,py, px+1,py, px+1,py+1, px+2,py+1, px+2,py+2, px+3,py+2, px+3,py+3,
-                px+3,py+2, px+4,py+2, px+4,py+1,  px+5,py+1, px+5,py, px+6,py};
+                px+3,py+2, px+4,py+2, px+4,py+1,  px+5,py+1, px+5,py, px+6,py];
         py += 4;
-        polyline2 = new int [] {
+        polyline2 = [
                 px,py, px+1,py, px+1,py+1, px+2,py+1, px+2,py+2, px+3,py+2, px+3,py+3,
-                px+3,py+2, px+4,py+2, px+4,py+1,  px+5,py+1, px+5,py, px+6,py};
+                px+3,py+2, px+4,py+2, px+4,py+1,  px+5,py+1, px+5,py, px+6,py];
     }
     gc.setForeground (display.getSystemColor (DWT.COLOR_TITLE_FOREGROUND));
     gc.drawPolyline (polyline1);