changeset 90:c7f7f4d7091a

All widgets are ported
author Jacob Carlborg <doob@me.com>
date Tue, 30 Dec 2008 18:54:31 +0100
parents 8e3c85e1733d
children a7e41c09df9e
files dwt/dwthelper/utils.d dwt/internal/cocoa/NSBox.d dwt/internal/cocoa/NSImageCell.d dwt/internal/cocoa/NSImageView.d dwt/internal/cocoa/OS.d dwt/internal/objc/cocoa/Cocoa.d dwt/widgets/Combo.d dwt/widgets/Composite.d dwt/widgets/CoolBar.d dwt/widgets/CoolItem.d dwt/widgets/DateTime.d dwt/widgets/Display.d dwt/widgets/ExpandBar.d dwt/widgets/FileDialog.d dwt/widgets/Label.d dwt/widgets/Link.d dwt/widgets/List.d dwt/widgets/Sash.d dwt/widgets/Slider.d dwt/widgets/Spinner.d dwt/widgets/TabFolder.d dwt/widgets/Table.d dwt/widgets/TableColumn.d dwt/widgets/Text.d dwt/widgets/ToolBar.d dwt/widgets/Tracker.d dwt/widgets/Tree.d dwt/widgets/TreeColumn.d
diffstat 28 files changed, 258 insertions(+), 205 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/dwthelper/utils.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/dwthelper/utils.d	Tue Dec 30 18:54:31 2008 +0100
@@ -530,6 +530,12 @@
     static alias CharacterIsLetterOrDigit isLetterOrDigit;
     static alias CharacterIsSpaceChar isSpaceChar;
     static alias CharacterIsWhitespace isWhitespace;
+    static alias CharacterIsDigit isDigit;
+    
+    static T toLowerCase (T)(T c)
+    {
+        return tango.text.Unicode.toLower([c])[0];
+    }
 }
 
 String new_String( String cont, int offset, int len ){
--- a/dwt/internal/cocoa/NSBox.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/internal/cocoa/NSBox.d	Tue Dec 30 18:54:31 2008 +0100
@@ -36,16 +36,6 @@
     NSBoxCustom = 4
 }
 
-enum NSTitlePosition {
-    NSNoTitle = 0,
-    NSAboveTop = 1,
-    NSAtTop = 2,
-    NSBelowTop = 3,
-    NSAboveBottom = 4,
-    NSAtBottom = 5,
-    NSBelowBottom = 6
-}
-
 public class NSBox : NSView {
     
 public this () {
--- a/dwt/internal/cocoa/NSImageCell.d	Tue Dec 30 17:01:10 2008 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-/**
- * Copyright: Copyright (c) 2008 Jacob Carlborg. All rights reserved.
- * Authors: Jacob Carlborg
- * Version: Initial created: Nov 28, 2008
- * License: $(LINK2 http://opensource.org/licenses/bsd-license.php, BSD Style)
- * 
- */
-module dwt.internal.cocoa.NSImageCell;
-
-enum NSImageAlignment
-{
-    NSImageAlignCenter = 0,
-    NSImageAlignTop,
-    NSImageAlignTopLeft,
-    NSImageAlignTopRight,
-    NSImageAlignLeft,
-    NSImageAlignBottom,
-    NSImageAlignBottomLeft,
-    NSImageAlignBottomRight,
-    NSImageAlignRight
-} 
\ No newline at end of file
--- a/dwt/internal/cocoa/NSImageView.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/internal/cocoa/NSImageView.d	Tue Dec 30 18:54:31 2008 +0100
@@ -18,7 +18,6 @@
 import dwt.internal.cocoa.NSCell;
 import dwt.internal.cocoa.NSControl;
 import dwt.internal.cocoa.NSImage;
-import dwt.internal.cocoa.NSImageCell;
 import dwt.internal.cocoa.OS;
 import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
--- a/dwt/internal/cocoa/OS.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/internal/cocoa/OS.d	Tue Dec 30 18:54:31 2008 +0100
@@ -57,6 +57,7 @@
 import dwt.internal.cocoa.NSGradient;
 import dwt.internal.cocoa.NSGraphicsContext;
 import dwt.internal.cocoa.NSImage;
+import dwt.internal.cocoa.NSNumberFormatter;
 import dwt.internal.cocoa.NSParagraphStyle;
 import dwt.internal.cocoa.NSPoint;
 import dwt.internal.cocoa.NSRange;
@@ -65,6 +66,7 @@
 import dwt.internal.cocoa.NSScroller;
 import dwt.internal.cocoa.NSSize;
 import dwt.internal.cocoa.NSString;
+import dwt.internal.cocoa.NSTabView;
 import dwt.internal.cocoa.NSTableView;
 import dwt.internal.cocoa.NSText;
 import dwt.internal.cocoa.NSView;
@@ -2739,7 +2741,7 @@
 public static const int NSApplicationDelegateReplySuccess = 0;
 public static const int NSAscendingPageOrder = 1;
 public static const int NSAtBottom = 5;
-alias NSTitlePosition.NSAtTop NSAtTop;
+alias Cocoa.NSTitlePosition.NSAtTop NSAtTop;
 public static const int NSAttachmentCharacter = 65532;
 public static const int NSAutoPagination = 0;
 public static const int NSAutosaveOperation = 3;
@@ -2763,7 +2765,7 @@
 public static const int NSBlueControlTint = 1;
 public static const int NSBoldFontMask = 2;
 alias Cocoa.NSBorderlessWindowMask NSBorderlessWindowMask;
-public static const int NSBottomTabsBezelBorder = 2;
+alias NSTabViewType.NSBottomTabsBezelBorder NSBottomTabsBezelBorder;
 public static const int NSBoxCustom = 4;
 public static const int NSBoxOldStyle = 3;
 public static const int NSBoxPrimary = 0;
@@ -2817,7 +2819,7 @@
 public static const int NSClearDisplayFunctionKey = 63290;
 public static const int NSClearLineFunctionKey = 63289;
 public static const int NSClipPagination = 2;
-public static const int NSClockAndCalendarDatePickerStyle = 1;
+alias NSDatePickerStyle.NSClockAndCalendarDatePickerStyle NSClockAndCalendarDatePickerStyle;
 public static const int NSClosableWindowMask = 2;
 alias Cocoa.NSBezierPathElement.NSClosePathBezierPathElement NSClosePathBezierPathElement;
 public static const int NSColorListModeColorPanel = 5;
@@ -3050,12 +3052,12 @@
 public static const int NSIdentityMappingCharacterCollection = 0;
 public static const int NSIllegalTextMovement = 0;
 alias Cocoa.NSCellImagePosition.NSImageAbove NSImageAbove;
-public static const int NSImageAlignBottom = 5;
-public static const int NSImageAlignBottomLeft = 6;
-public static const int NSImageAlignBottomRight = 7;
-public static const int NSImageAlignCenter = 0;
-public static const int NSImageAlignLeft = 4;
-public static const int NSImageAlignRight = 8;
+alias Cocoa.NSImageAlignment.NSImageAlignBottom NSImageAlignBottom;
+alias Cocoa.NSImageAlignment.NSImageAlignBottomLeft NSImageAlignBottomLeft;
+alias Cocoa.NSImageAlignment.NSImageAlignBottomRight NSImageAlignBottomRight;
+alias Cocoa.NSImageAlignment.NSImageAlignCenter NSImageAlignCenter;
+alias Cocoa.NSImageAlignment.NSImageAlignLeft NSImageAlignLeft;
+alias Cocoa.NSImageAlignment.NSImageAlignRight NSImageAlignRight;
 public static const int NSImageAlignTop = 1;
 public static const int NSImageAlignTopLeft = 2;
 public static const int NSImageAlignTopRight = 3;
@@ -3181,7 +3183,7 @@
 public static const int NSNoTabsBezelBorder = 4;
 public static const int NSNoTabsLineBorder = 5;
 public static const int NSNoTabsNoBorder = 6;
-alias NSTitlePosition.NSNoTitle NSNoTitle;
+alias Cocoa.NSTitlePosition.NSNoTitle NSNoTitle;
 public static const int NSNoUnderlineStyle = 0;
 public static const int NSNonStandardCharacterSetFontMask = 8;
 alias Cocoa.NSWindingRule.NSNonZeroWindingRule NSNonZeroWindingRule;
@@ -3351,7 +3353,7 @@
 public static const int NSSaveAsOperation = 1;
 public static const int NSSaveOperation = 0;
 public static const int NSSaveToOperation = 2;
-public static const int NSScaleNone = 2;
+alias Cocoa.NSImageScaling.NSImageScaleNone NSScaleNone;
 public static const int NSScaleProportionally = 0;
 public static const int NSScaleToFit = 1;
 public static const int NSScreenChangedEventType = 8;
@@ -3861,7 +3863,7 @@
 public static const int NSNumberFormatterBehavior10_4 = 1040;
 public static const int NSNumberFormatterBehaviorDefault = 0;
 public static const int NSNumberFormatterCurrencyStyle = 2;
-public static const int NSNumberFormatterDecimalStyle = 1;
+alias NSNumberFormatterStyle.NSNumberFormatterDecimalStyle NSNumberFormatterDecimalStyle;
 public static const int NSNumberFormatterNoStyle = 0;
 public static const int NSNumberFormatterPadAfterPrefix = 1;
 public static const int NSNumberFormatterPadAfterSuffix = 3;
--- a/dwt/internal/objc/cocoa/Cocoa.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/internal/objc/cocoa/Cocoa.d	Tue Dec 30 18:54:31 2008 +0100
@@ -214,6 +214,20 @@
 
 
 
+// NSBox.h
+enum NSTitlePosition
+{
+    NSNoTitle = 0,
+    NSAboveTop = 1,
+    NSAtTop = 2,
+    NSBelowTop = 3,
+    NSAboveBottom = 4,
+    NSAtBottom = 5,
+    NSBelowBottom = 6
+}
+
+
+
 // NSButtonCell.h
 enum NSBezelStyle : NSUInteger {
     NSRoundedBezelStyle = 1,
@@ -416,6 +430,22 @@
 
 
 
+// NSImageCell.h
+enum NSImageAlignment
+{
+    NSImageAlignCenter = 0,
+    NSImageAlignTop,
+    NSImageAlignTopLeft,
+    NSImageAlignTopRight,
+    NSImageAlignLeft,
+    NSImageAlignBottom,
+    NSImageAlignBottomLeft,
+    NSImageAlignBottomRight,
+    NSImageAlignRight
+}
+
+
+
 // NSBitmapImageRep.h
 enum NSTIFFCompression : NSUInteger {
     NSTIFFCompressionNone = 1,
--- a/dwt/widgets/Combo.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/Combo.d	Tue Dec 30 18:54:31 2008 +0100
@@ -44,9 +44,10 @@
 import dwt.internal.cocoa.SWTComboBox;
 import dwt.internal.cocoa.SWTPopUpButton;
 
-import dwt.internal.c.Carbon;
+import Carbon = dwt.internal.c.Carbon;
 import objc = dwt.internal.objc.runtime;
 import dwt.widgets.Composite;
+import dwt.widgets.Event;
 import dwt.widgets.TypedListener;
 
 /**
@@ -88,9 +89,10 @@
  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
  */
 public class Combo : Composite {
-    int textLimit = LIMIT;
+    int textLimit;
     bool receivingFocus;
-    NSRange selectionRange;
+    NSRange* selectionRange;
+    NSRange selectionRangeStruct;
 
     /**
      * the operating system limit for the number of characters
@@ -140,6 +142,7 @@
  */
 public this (Composite parent, int style) {
     super (parent, checkStyle (style));
+    textLimit = LIMIT;
 }
 
 /**
@@ -363,7 +366,7 @@
     }
 }
 
-void comboBoxSelectionDidChange(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) {
+void comboBoxSelectionDidChange(objc.id id, objc.SEL sel, objc.id notification) {
     sendSelection();
 }
 
@@ -458,7 +461,7 @@
     char [] buffer = new char [oldText.length ()];
     oldText.getChars (0, buffer.length, buffer, 0);
     copyToClipboard (buffer);
-    setText (leftText + newText + rightText, false);
+    setText (leftText ~ newText ~ rightText, false);
     start += newText.length ();
     setSelection (new Point (start, start));
     sendEvent (DWT.Modify);
@@ -717,14 +720,14 @@
     return new_String (getText(0, -1));
 }
 
-wchar [] getText (int start, int end) {
+char [] getText (int start, int end) {
     NSString str;
     if ((style & DWT.READ_ONLY) !is 0) {
         str = (cast(NSPopUpButton)view).titleOfSelectedItem();
     } else {
         str = (new NSCell((cast(NSComboBox)view).cell())).title();
     }
-    if (str is null) return new wchar[0];
+    if (str is null) return new char[0];
     NSRange range = NSRange ();
     range.location = start;
     if (end is -1) {
@@ -733,8 +736,8 @@
     } else {
         range.length = end - start;
     }
-    wchar [] buffer= new wchar [range.length];
-    str.getCharacters(buffer.ptr, range);
+    char [] buffer= new char [range.length];
+    str.getCharacters(buffer.toString16().ptr, range);
     return buffer;
 }
 
@@ -854,18 +857,18 @@
 }
 
 void insertEditText (String string) {
-    NSUInteger length = string.length ();
+    NSUInteger length_ = string.length ();
     Point selection = getSelection ();
     if (hasFocus ()) {
         if (textLimit !is LIMIT) {
             int charCount = getCharCount();
-            if (charCount - (selection.y - selection.x) + length > textLimit) {
-                length = textLimit - charCount + (selection.y - selection.x);
+            if (charCount - (selection.y - selection.x) + length_ > textLimit) {
+                length_ = textLimit - charCount + (selection.y - selection.x);
             }
         }
-        wchar [] buffer = new wchar [length];
+        char [] buffer = new char [length_];
         string.getChars (0, buffer.length, buffer, 0);
-        NSString nsstring = NSString.stringWithCharacters (buffer.ptr, buffer.length);
+        NSString nsstring = NSString.stringWithCharacters (buffer.toString16().ptr, buffer.length);
         NSText editor = (cast(NSTextField) view).currentEditor ();
         editor.replaceCharactersInRange (editor.selectedRange (), nsstring);
         selectionRange = null;
@@ -873,11 +876,11 @@
         String oldText = getText ();
         if (textLimit !is LIMIT) {
             int charCount = oldText.length ();
-            if (charCount - (selection.y - selection.x) + length > textLimit) {
+            if (charCount - (selection.y - selection.x) + length_ > textLimit) {
                 string = string.substring(0, textLimit - charCount + (selection.y - selection.x));
             }
         }
-        String newText = oldText.substring (0, selection.x) + string + oldText.substring (selection.y);
+        String newText = oldText.substring (0, selection.x) ~ string ~ oldText.substring (selection.y);
         NSString nsstring = NSString.stringWith(newText);
         (new NSCell ((cast(NSTextField) view).cell ())).setTitle (nsstring);
         selectionRange = null;
@@ -918,7 +921,7 @@
             newText = newText.substring(0, textLimit - charCount + (end - start));
         }
     }
-    setText (leftText + newText + rightText, false);
+    setText (leftText ~ newText ~ rightText, false);
     start += newText.length ();
     setSelection (new Point (start, start));
     sendEvent (DWT.Modify);
@@ -1263,7 +1266,7 @@
     return result;
 }
 
-void setBackground (CGFloat [] color) {
+void setBackground (Carbon.CGFloat [] color) {
     NSColor nsColor;
     if (color is null) {
         return; // TODO reset to OS default
@@ -1295,7 +1298,7 @@
     super.setBounds (x, y, width, height, move, resize);
 }
 
-void setForeground (CGFloat [] color) {
+void setForeground (Carbon.CGFloat [] color) {
     NSColor nsColor;
     if (color is null) {
         return; // TODO reset to OS default
@@ -1445,12 +1448,13 @@
         NSUInteger length = str.length();
         NSUInteger start = Math.min (Math.max (Math.min (selection.x, selection.y), 0), length);
         NSUInteger end = Math.min (Math.max (Math.max (selection.x, selection.y), 0), length);
-        selectionRange = NSRange();
+        selectionRangeStruct = NSRange();
+        selectionRange = &selectionRangeStruct;
         selectionRange.location = start;
         selectionRange.length = end - start;
         if (this is display.getFocusControl ()) {
             NSText editor = view.window().fieldEditor(false, view);
-            editor.setSelectedRange(selectionRange);
+            editor.setSelectedRange(selectionRangeStruct);
         }
     }
 }
@@ -1558,7 +1562,7 @@
 void textViewDidChangeSelection(objc.id id, objc.SEL sel, objc.id aNotification) {
     NSNotification notification = new NSNotification(aNotification);
     NSText editor = new NSText(notification.object().id);
-    selectionRange = editor.selectedRange();
+    selectionRangeStruct = editor.selectedRange();
 }
 
 void textDidChange (objc.id id, objc.SEL sel, objc.id aNotification) {
@@ -1571,7 +1575,7 @@
     * then return the receiver's last selection range, otherwise the full
     * text will be automatically selected.
     */
-    if (receivingFocus && selectionRange !is null) return selectionRange;
+    if (receivingFocus && selectionRange !is null) return selectionRangeStruct;
 
     /* allow the selection change to proceed */
     NSRange result = NSRange();
--- a/dwt/widgets/Composite.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/Composite.d	Tue Dec 30 18:54:31 2008 +0100
@@ -77,6 +77,14 @@
  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
  */
 public class Composite : Scrollable {
+    
+    alias Scrollable.computeSize computeSize;
+    alias Scrollable.forceFocus forceFocus;
+    alias Scrollable.moveAbove moveAbove;
+    alias Scrollable.moveBelow moveBelow;
+    alias Scrollable.setBounds setBounds;
+    alias Scrollable.translateTraversal translateTraversal;
+    
     Layout layout_;
     Control[] tabList;
     int layoutCount, backgroundMode;
--- a/dwt/widgets/CoolBar.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/CoolBar.d	Tue Dec 30 18:54:31 2008 +0100
@@ -59,7 +59,7 @@
  */
 public class CoolBar : Composite {
     CoolItem[][] items;
-    CoolItem[] originalItems = new CoolItem[0];
+    CoolItem[] originalItems;
     Cursor hoverCursor, dragCursor, cursor;
     CoolItem dragging = null;
     int mouseXOffset, itemXOffset;
@@ -136,6 +136,8 @@
     for (int i = 0; i < events.length; i++) {
         addListener(events[i], listener);   
     }
+    
+    originalItems = new CoolItem[0];
 }
 static int checkStyle (int style) {
     style |= DWT.NO_FOCUS;
@@ -259,7 +261,7 @@
 Point findItem (CoolItem item) {
     for (int row = 0; row < items.length; row++) {
         for (int i = 0; i < items[row].length; i++) {
-            if (items[row][i].equals(item)) return new Point(i, row);       
+            if (items[row][i].opEquals(item)) return new Point(i, row);       
         }
     }
     return new Point(-1, -1);
@@ -308,7 +310,7 @@
     int answer = 0;
     for (int row = 0; row < items.length; row++) {
         for (int i = 0; i < items[row].length; i++) {
-            if (items[row][i].equals(item)) {
+            if (items[row][i].opEquals(item)) {
                 return answer;      
             } else {
                 answer++;
@@ -386,7 +388,7 @@
     int itemCount = getItemCount(), row = 0;
     if (!(0 <= index && index <= itemCount)) error (DWT.ERROR_INVALID_RANGE);
     if (items.length is 0) {
-        items = new CoolItem[1][1];
+        items = new CoolItem[][](1, 1);
         items[0][0] = item; 
     } else {
         int i = index;
@@ -469,8 +471,8 @@
     internalRedraw(old.x, old.y, CoolItem.MINIMUM_WIDTH, old.height);
     if (newRowIndex is items.length) {
         /* Create a new bottom row for the item. */
-        CoolItem[][] newRows = new CoolItem[items.length + 1][];
-        System.arraycopy(items, 0, newRows, 0, items.length);
+        CoolItem[][] newRows = new CoolItem[][](items.length + 1);
+        SimpleType!(CoolItem[]).arraycopy(items, 0, newRows, 0, items.length);
         int row = items.length;
         newRows[row] = new CoolItem[1];
         newRows[row][0] = item;
@@ -569,8 +571,8 @@
     int newRowIndex = Math.max(0, oldRowIndex - 1);
     if (oldRowIndex is 0) {
         /* Create a new top row for the item. */
-        CoolItem[][] newRows = new CoolItem[items.length + 1][];
-        System.arraycopy(items, 0, newRows, 1, items.length);
+        CoolItem[][] newRows = new CoolItem[][](items.length + 1);
+        SimpleType!(CoolItem[]).arraycopy(items, 0, newRows, 1, items.length);
         newRows[0] = new CoolItem[1];
         newRows[0][0] = item;
         items = newRows;
@@ -805,9 +807,9 @@
         items[rowIndex] = newRow;
         items[rowIndex][0].wrap = true;
     } else {
-        CoolItem[][] newRows = new CoolItem[items.length - 1][];
-        System.arraycopy(items, 0, newRows, 0, rowIndex);
-        System.arraycopy(items, rowIndex + 1, newRows, rowIndex, newRows.length - rowIndex);
+        CoolItem[][] newRows = new CoolItem[][](items.length - 1);
+        SimpleType!(CoolItem[]).arraycopy(items, 0, newRows, 0, rowIndex);
+        SimpleType!(CoolItem[]).arraycopy(items, rowIndex + 1, newRows, rowIndex, newRows.length - rowIndex);
         items = newRows;
         return;
     }
@@ -968,7 +970,7 @@
     for (int i = 0; i < count; i++) {
         row[i] = originalItems[itemOrder[i]];
     }
-    items = new CoolItem[1][count];
+    items = new CoolItem[][](1, count);
     items[0] = row;
 }
 /**
@@ -1164,7 +1166,7 @@
         System.arraycopy(items[row], 0, itemsVisual, start, items[row].length);
         start += items[row].length;
     }
-    CoolItem[][] newItems = new CoolItem[itemCount][];
+    CoolItem[][] newItems = new CoolItem[][](itemCount);
     int rowCount = 0, rowWidth =  0;
     start = 0;
     for (int i = 0; i < itemCount; i++) {
@@ -1195,8 +1197,8 @@
         rowCount++;     
     }
     if (newItems.length !is rowCount) {
-        CoolItem[][] tmp = new CoolItem[rowCount][];
-        System.arraycopy(newItems, 0, tmp, 0, rowCount);
+        CoolItem[][] tmp = new CoolItem[][](rowCount);
+        SimpleType!(CoolItem[]).arraycopy(newItems, 0, tmp, 0, rowCount);
         items = tmp;
     } else {
         items = newItems;
--- a/dwt/widgets/CoolItem.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/CoolItem.d	Tue Dec 30 18:54:31 2008 +0100
@@ -33,6 +33,7 @@
 import dwt.widgets.CoolBar;
 import dwt.widgets.Event;
 import dwt.widgets.Item;
+import dwt.widgets.Listener;
 import dwt.widgets.ToolBar;
 import dwt.widgets.ToolItem;
 import dwt.widgets.TypedListener;
@@ -58,16 +59,16 @@
     CoolBar parent;
     bool ideal;
     int preferredWidth, preferredHeight, minimumWidth, minimumHeight, requestedWidth;
-    Rectangle itemBounds = new Rectangle(0, 0, 0, 0);
+    Rectangle itemBounds;
     
-    static final int MARGIN_WIDTH = 4;
-    static final int GRABBER_WIDTH = 2;
-    static final int MINIMUM_WIDTH = (2 * MARGIN_WIDTH) + GRABBER_WIDTH;
+    static const int MARGIN_WIDTH = 4;
+    static const int GRABBER_WIDTH = 2;
+    static const int MINIMUM_WIDTH = (2 * MARGIN_WIDTH) + GRABBER_WIDTH;
     
     private int CHEVRON_HORIZONTAL_TRIM = -1;           //platform dependent values
     private int CHEVRON_VERTICAL_TRIM = -1; 
-    private static final int CHEVRON_LEFT_MARGIN = 2;
-    private static final int CHEVRON_IMAGE_WIDTH = 8;   //Width to draw the double arrow
+    private static const int CHEVRON_LEFT_MARGIN = 2;
+    private static const int CHEVRON_IMAGE_WIDTH = 8;   //Width to draw the double arrow
     
     ToolBar chevron;
     bool wrap;
@@ -108,6 +109,8 @@
     this.parent = parent;
     parent.createItem (this, parent.getItemCount());
     calculateChevronTrim ();
+    
+    itemBounds = new Rectangle(0, 0, 0, 0);
 }
 /**
  * Constructs a new instance of this class given its parent
@@ -146,6 +149,8 @@
     this.parent = parent;
     parent.createItem (this, index);
     calculateChevronTrim ();
+    
+    itemBounds = new Rectangle(0, 0, 0, 0);
 }
 /**
  * Adds the listener to the collection of listeners that will
@@ -637,7 +642,7 @@
                 ToolItem toolItem = new ToolItem (chevron, DWT.PUSH);
                 toolItem.addListener (DWT.Selection, new class () Listener {
                     public void handleEvent (Event event) {
-                        CoolItem.outer.onSelection (event);
+                        this.outer.onSelection (event);
                     }
                 });
             }
--- a/dwt/widgets/DateTime.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/DateTime.d	Tue Dec 30 18:54:31 2008 +0100
@@ -31,7 +31,7 @@
 
 import tango.text.convert.Format;
 
-import dwt.internal.c.Carbon;
+import Carbon = dwt.internal.c.Carbon;
 import dwt.widgets.Composite;
 import dwt.widgets.TypedListener;
 
@@ -270,8 +270,8 @@
 }
 
 String getNameText() {
-    return (style & DWT.TIME) !is 0 ? Format("{}{}{}{}{}", getHours() , ":" + getMinutes() , ":" , getSeconds())
-            : Format("{}{}{}{}{}", (getMonth() + 1) + "/" + getDay() + "/" + getYear());
+    return (style & DWT.TIME) !is 0 ? Format("{}{}{}{}{}", getHours() , ":" , getMinutes() , ":" , getSeconds())
+            : Format("{}{}{}{}{}", (getMonth() + 1) , "/" , getDay() , "/" , getYear());
 }
 
 /**
@@ -339,7 +339,7 @@
     postEvent (DWT.Selection);
 }
 
-void setBackground (CGFloat [] color) {
+void setBackground (Carbon.CGFloat [] color) {
     NSColor nsColor;
     if (color is null) {
         return; // TODO reset to OS default
@@ -400,7 +400,7 @@
     }
 }
 
-void setForeground (CGFloat [] color) {
+void setForeground (Carbon.CGFloat [] color) {
     NSColor nsColor;
     if (color is null) {
         return; // TODO reset to OS default
--- a/dwt/widgets/Display.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/Display.d	Tue Dec 30 18:54:31 2008 +0100
@@ -96,8 +96,6 @@
 import dwt.widgets.Tray;
 import dwt.widgets.Widget;
 
-import mambo.io;
-
 /**
  * Instances of this class are responsible for managing the
  * connection between DWT and the underlying operating
--- a/dwt/widgets/ExpandBar.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/ExpandBar.d	Tue Dec 30 18:54:31 2008 +0100
@@ -28,6 +28,8 @@
 import dwt.graphics.Rectangle;
 
 import dwt.widgets.Composite;
+import dwt.widgets.Control;
+import dwt.widgets.Display;
 import dwt.widgets.Event;
 import dwt.widgets.ExpandItem;
 import dwt.widgets.Listener;
@@ -355,7 +357,7 @@
     return -1;
 }
 
-void layoutItems (int index, bool setScrollbar) {
+void layoutItems (int index, bool setScrollbar_) {
     if (index < itemCount) {
         int y = spacing - yCurrentScroll;
         for (int i = 0; i < index; i++) {
@@ -370,7 +372,7 @@
             y += item.getHeaderHeight() + spacing;
         }
     }
-    if (setScrollbar) setScrollbar ();
+    if (setScrollbar_) setScrollbar ();
 }
 
 /**
--- a/dwt/widgets/FileDialog.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/FileDialog.d	Tue Dec 30 18:54:31 2008 +0100
@@ -49,9 +49,9 @@
  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
  */
 public class FileDialog : Dialog {
-    String [] filterNames = new String [0];
-    String [] filterExtensions = new String [0];
-    String [] fileNames = new String [0];    
+    String [] filterNames;
+    String [] filterExtensions;
+    String [] fileNames;
     String filterPath = "", fileName = "";
     int filterIndex = -1;
     bool overwrite = true; //TODO: if setOverwrite(false) is implemented, change default to false for consistency
@@ -101,6 +101,10 @@
 public this (Shell parent, int style) {
     super (parent, checkStyle (parent, style));
     checkSubclass ();
+    
+    filterNames = new String [0];
+    filterExtensions = new String [0];
+    fileNames = new String [0];
 }
 
 /**
--- a/dwt/widgets/Label.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/Label.d	Tue Dec 30 18:54:31 2008 +0100
@@ -43,7 +43,7 @@
 import dwt.internal.cocoa.SWTTextField;
 import cocoa = dwt.internal.cocoa.id;
 
-import dwt.internal.c.Carbon;
+import Carbon = dwt.internal.c.Carbon;
 import objc = dwt.internal.objc.runtime;
 import dwt.widgets.Composite;
 import dwt.widgets.Control;
@@ -387,7 +387,7 @@
     _setAlignment();
 }
 
-void setBackground (CGFloat [] color) {
+void setBackground (Carbon.CGFloat [] color) {
     if ((style & DWT.SEPARATOR) !is 0) return;
     textView.setDrawsBackground(color !is null);
     if (color is null) return;
@@ -417,7 +417,7 @@
     }
 }
 
-void setForeground (CGFloat [] color) {
+void setForeground (Carbon.CGFloat [] color) {
     if ((style & DWT.SEPARATOR) !is 0) return;
     NSCell cell = new NSCell(textView.cell());
     cell.setAttributedStringValue(createString());
--- a/dwt/widgets/Link.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/Link.d	Tue Dec 30 18:54:31 2008 +0100
@@ -36,8 +36,10 @@
 static import tango.text.Text;
 
 import objc = dwt.internal.objc.runtime;
+import dwt.widgets.Event;
 import dwt.widgets.Composite;
 import dwt.widgets.Control;
+import dwt.widgets.TypedListener;
 
 
 /**
@@ -146,7 +148,7 @@
     if (hHint !is DWT.DEFAULT && hHint < 0) hHint = 0;
     int width, height;
     //TODO wrapping, wHint
-    int borderStyle = hasBorder() ? OS.NSBezelBorder : OS.NSNoBorder;
+    NSBorderType borderStyle = hasBorder() ? OS.NSBezelBorder : OS.NSNoBorder;
     NSSize borderSize = NSScrollView.frameSizeForContentSize(NSSize(), false, false, borderStyle);
     NSTextView widget = cast(NSTextView)view;
     NSSize size = widget.textStorage().size();
@@ -171,7 +173,7 @@
 
 void createHandle () {
     NSScrollView scrollWidget = cast(NSScrollView)(new SWTScrollView()).alloc();
-    scrollWidget.initWithFrame(new NSRect ());
+    scrollWidget.initWithFrame(NSRect ());
     scrollWidget.setDrawsBackground(false);
     scrollWidget.setBorderType(hasBorder() ? OS.NSBezelBorder : OS.NSNoBorder);
 
@@ -311,7 +313,7 @@
                     parseMnemonics (buffer, linkStart, endtagStart, result);
                     offsets [linkIndex] = new Point (offset, result.length () - 1);
                     if (ids [linkIndex] is null) {
-                        ids [linkIndex] = new String (buffer, linkStart, endtagStart - linkStart);
+                        ids [linkIndex] = new_String (buffer, linkStart, endtagStart - linkStart);
                     }
                     linkIndex++;
                     start = tagStart = linkStart = endtagStart = refStart = index + 1;
@@ -342,7 +344,7 @@
                 break;
             case 12:
                 if (c is '"') {
-                    ids[linkIndex] = new String (buffer, refStart, index - refStart);
+                    ids[linkIndex] = new_String (buffer, refStart, index - refStart);
                     state = 2;
                 }
                 break;
--- a/dwt/widgets/List.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/List.d	Tue Dec 30 18:54:31 2008 +0100
@@ -44,7 +44,7 @@
 import dwt.internal.cocoa.SWTTableView;
 import cocoa = dwt.internal.cocoa.id;
 
-import dwt.internal.c.Carbon;
+import Carbon = dwt.internal.c.Carbon;
 import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 import dwt.widgets.Composite;
@@ -542,7 +542,7 @@
     NSIndexSet selection = widget.selectedRowIndexes();
     NSUInteger count = selection.count();
     NSUInteger [] indexBuffer = new NSUInteger [count];
-    selection.getIndexes(indexBuffer.ptr, count, 0);
+    selection.getIndexes(indexBuffer.ptr, count, null);
     String [] result = new String  [count];
     for (NSUInteger i=0; i<count; i++) {
         result [i] = items [indexBuffer [i]];
@@ -584,9 +584,9 @@
     }
     NSIndexSet selection = widget.selectedRowIndexes();
     NSUInteger count = selection.count();
-    NSUInteger [] result = NSUInteger [count];
-    selection.getIndexes(result.ptr, count, 0);
-    return cast(int) NSUInteger [0];
+    NSUInteger [] result = new NSUInteger [count];
+    selection.getIndexes(result.ptr, count, null);
+    return cast(int) result [0];
 }
 
 /**
@@ -614,7 +614,7 @@
     NSIndexSet selection = widget.selectedRowIndexes();
     NSUInteger count = selection.count();
     NSUInteger [] indices = new NSUInteger [count];
-    selection.getIndexes(indices, count, 0);
+    selection.getIndexes(indices.ptr, count, null);
     NSUInteger [] result = new NSUInteger [count];
     for (NSUInteger i = 0; i < result.length; i++) {
         result [i] = indices [i];
@@ -1045,7 +1045,7 @@
     return result;
 }
 
-void setBackground (CGFloat [] color) {
+void setBackground (Carbon.CGFloat [] color) {
     super.setBackground (color);
     NSColor nsColor;
     if (color is null) {
@@ -1058,8 +1058,8 @@
 
 void setFont (NSFont font) {
     super.setFont (font);
-    CGFloat ascent = font.ascender ();
-    CGFloat descent = -font.descender () + font.leading ();
+    Carbon.CGFloat ascent = font.ascender ();
+    Carbon.CGFloat descent = -font.descender () + font.leading ();
     (cast(NSTableView)view).setRowHeight (cast(int)Math.ceil (ascent + descent) + 1);
 }
 
@@ -1204,12 +1204,12 @@
     checkWidget ();
     if (indices is null) error (DWT.ERROR_NULL_ARGUMENT);
     deselectAll ();
-    int length = indices.length;
-    if (length is 0 || ((style & DWT.SINGLE) !is 0 && length > 1)) return;
-    int [] ids = new int [length];
+    int length_ = indices.length;
+    if (length_ is 0 || ((style & DWT.SINGLE) !is 0 && length_ > 1)) return;
+    int [] ids = new int [length_];
     int count = 0;
-    for (int i=0; i<length; i++) {
-        int index = indices [length - i - 1];
+    for (int i=0; i<length_; i++) {
+        int index = indices [length_ - i - 1];
         if (index >= 0 && index < itemCount) {
             ids [count++] = index + 1;
         }
@@ -1246,12 +1246,12 @@
     checkWidget ();
     if (items is null) error (DWT.ERROR_NULL_ARGUMENT);
     deselectAll ();
-    int length = items.length;
-    if (length is 0 || ((style & DWT.SINGLE) !is 0 && length > 1)) return;
+    int length_ = items.length;
+    if (length_ is 0 || ((style & DWT.SINGLE) !is 0 && length_ > 1)) return;
     int count = 0;
-    int [] ids = new int [length];
-    for (int i=0; i<length; i++) {
-        String string = items [length - i - 1];
+    int [] ids = new int [length_];
+    for (int i=0; i<length_; i++) {
+        String string = items [length_ - i - 1];
         if ((style & DWT.SINGLE) !is 0) {
             int index = indexOf (string, 0);
             if (index !is -1) {
@@ -1338,9 +1338,9 @@
     String text = items[cast(size_t)rowIndex];
     int length_ = text.length();
     char[] chars = new char[length_];
-    text.getChars(0, length, chars, 0);
-    NSString str = NSString.stringWithCharacters(chars, length);
-    NSAttributedString attribStr = (cast(NSAttributedString)(new NSAttributedString()).alloc()).initWithString_(str, dict);
+    text.getChars(0, length_, chars, 0);
+    NSString str = NSString.stringWithCharacters(chars.toString16().ptr, length_);
+    NSAttributedString attribStr = (cast(NSAttributedString)(new NSAttributedString()).alloc()).initWithString(str, dict);
     return attribStr.id;
 }
 
--- a/dwt/widgets/Sash.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/Sash.d	Tue Dec 30 18:54:31 2008 +0100
@@ -40,6 +40,7 @@
 import objc = dwt.internal.objc.runtime;
 import dwt.widgets.Composite;
 import dwt.widgets.Control;
+import dwt.widgets.Event;
 import dwt.widgets.TypedListener;
 
 /**
--- a/dwt/widgets/Slider.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/Slider.d	Tue Dec 30 18:54:31 2008 +0100
@@ -26,6 +26,7 @@
 import dwt.internal.cocoa.OS;
 import dwt.internal.cocoa.SWTScroller;
 
+import Carbon = dwt.internal.c.Carbon;
 import dwt.widgets.Composite;
 import dwt.widgets.Control;
 import dwt.widgets.Event;
@@ -466,7 +467,7 @@
     selection = Math.max (minimum, Math.min (maximum - thumb, selection));
     int range = maximum - thumb - minimum;
     float fraction = range <= 0 ? 1 : cast(float)(selection - minimum) / range;
-    CGFloat knob = range <= 0 ? 1 : cast(CGFloat)thumb / (maximum - minimum);
+    Carbon.CGFloat knob = range <= 0 ? 1 : cast(Carbon.CGFloat)thumb / (maximum - minimum);
     widget.setFloatValue (fraction, knob);
 }
 
--- a/dwt/widgets/Spinner.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/Spinner.d	Tue Dec 30 18:54:31 2008 +0100
@@ -42,7 +42,7 @@
 import dwt.internal.cocoa.SWTTextField;
 import dwt.internal.cocoa.SWTView;
 
-import dwt.internal.c.Carbon;
+import Carbon = dwt.internal.c.Carbon;
 import objc = dwt.internal.objc.runtime;
 import dwt.widgets.Composite;
 import dwt.widgets.Event;
@@ -220,7 +220,7 @@
 
 public Point computeSize (int wHint, int hHint, bool changed) {
     checkWidget ();
-    CGFloat width = 0, height = 0;
+    Carbon.CGFloat width = 0, height = 0;
     String string = Double.toString (buttonView.maxValue ());
     NSMutableDictionary dict = NSMutableDictionary.dictionaryWithCapacity (1);
     dict.setObject(textView.font (), OS.NSFontAttributeName);
@@ -458,7 +458,7 @@
                 } else {
                     int i = digits - decimalPart.length ();
                     for (int j = 0; j < i; j++) {
-                        decimalPart = decimalPart + "0";
+                        decimalPart = decimalPart ~ "0";
                     }
                 }
                 int wholeValue = Integer.parseInt (wholePart);
@@ -664,7 +664,7 @@
     buttonFrame.y = 0;
     frame.x = 0;
     frame.y = 0;
-    frame.width -= buttonFrame.width + GAP;
+    frame.size.width -= buttonFrame.width + GAP;
     textView.setFrame(frame);
     buttonView.setFrame(buttonFrame);
 }
@@ -913,7 +913,7 @@
         String decimalSeparator = ".";//getDecimalSeparator ();
         index = string.indexOf (decimalSeparator);
         if (index !is -1) {
-            string = string.substring (0, index) + string.substring (index + 1);
+            string = string.substring (0, index) ~ string.substring (index + 1);
         }
         index = 0;
     }
--- a/dwt/widgets/TabFolder.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/TabFolder.d	Tue Dec 30 18:54:31 2008 +0100
@@ -35,6 +35,7 @@
 import objc = dwt.internal.objc.runtime;
 import dwt.widgets.Composite;
 import dwt.widgets.Control;
+import dwt.widgets.Event;
 import dwt.widgets.TabItem;
 import dwt.widgets.TypedListener;
 
@@ -594,7 +595,7 @@
 }
 
 void tabView_willSelectTabViewItem(objc.id id, objc.SEL sel, objc.id tabView, objc.id tabViewItem) {
-    if (tabViewItem is 0) return;
+    if (tabViewItem is null) return;
     for (int i = 0; i < itemCount; i++) {
         TabItem item = items [i];
         if (item.nsItem.id is tabViewItem) {
@@ -618,7 +619,7 @@
 }
 
 void tabView_didSelectTabViewItem(objc.id id, objc.SEL sel, objc.id tabView, objc.id tabViewItem) {
-    if (tabViewItem is 0) return;
+    if (tabViewItem is null) return;
     for (int i = 0; i < itemCount; i++) {
         TabItem item = items [i];
         /*
--- a/dwt/widgets/Table.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/Table.d	Tue Dec 30 18:54:31 2008 +0100
@@ -60,7 +60,7 @@
 import dwt.internal.cocoa.SWTTableView;
 import cocoa = dwt.internal.cocoa.id;
 
-import dwt.internal.c.Carbon;
+import Carbon = dwt.internal.c.Carbon;
 import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 import dwt.widgets.Composite;
@@ -810,7 +810,7 @@
 
 void drawInteriorWithFrame_inView (objc.id id, objc.SEL sel, objc.id cellFrame, objc.id view) {
     NSRect rect = NSRect ();
-    OS.memmove (rect, cellFrame, NSRect.sizeof);
+    OS.memmove (&rect, cellFrame, NSRect.sizeof);
 
     NSTableView tableView = cast(NSTableView)this.view;
     NSBrowserCell cell = new NSBrowserCell (id);
@@ -823,7 +823,7 @@
         NSIndexSet columnsSet = tableView.columnIndexesInRect (rect);
         nsColumnIndex = columnsSet.firstIndex ();
         NSArray nsColumns = tableView.tableColumns ();
-        id nsColumn = nsColumns.objectAtIndex (nsColumnIndex);
+        cocoa.id nsColumn = nsColumns.objectAtIndex (nsColumnIndex);
         for (int i = 0; i < columnCount; i++) {
             if (columns[i].nsColumn.id is nsColumn.id) {
                 columnIndex = indexOf (columns[i]);
@@ -867,7 +867,7 @@
     }
 
     if (hooks (DWT.EraseItem)) {
-        NSRect eraseItemRect = null;
+        NSRect eraseItemRect;
         // TODO how to handle rearranged columns?  The third clause below ensures that
         // there are either 0 columns or that column 0 is still the first physical column.
         if (columnIndex is 0 && (style & DWT.CHECK) !is 0 && (columnCount is 0 || tableView.columnWithIdentifier (columns[0].nsColumn) is 1)) {
@@ -879,16 +879,17 @@
             eraseItemRect = fullRect;
         }
         GCData data = new GCData ();
-        data.paintRect = eraseItemRect;
+        data.paintRectStruct = eraseItemRect;
+        data.paintRect = &data.paintRectStruct;
         GC gc = GC.cocoa_new (this, data);
         gc.setFont (item.getFont (columnIndex));
         if (isSelected) {
-            CGFloat[] components = [nsSelectionForeground.numberOfComponents ()];
-            nsSelectionForeground.getComponents (components);   
+            Carbon.CGFloat[] components = [nsSelectionForeground.numberOfComponents ()];
+            nsSelectionForeground.getComponents (components.ptr);   
             Color selectionForeground = Color.cocoa_new (display, components);
             gc.setForeground (selectionForeground);
             components = [nsSelectionBackground.numberOfComponents ()];
-            nsSelectionBackground.getComponents (components);   
+            nsSelectionBackground.getComponents (components.ptr);   
             Color selectionBackground = Color.cocoa_new (display, components);
             gc.setBackground (selectionBackground);
         } else {
@@ -928,7 +929,7 @@
                 NSRect rowRect = tableView.rectOfRow (rowIndex);
                 if ((style & DWT.CHECK) !is 0) {
                     /* highlighting at this stage draws over the checkbox, so don't include its column */
-                    CGFloat checkWidth = checkColumn.width ();
+                    Carbon.CGFloat checkWidth = checkColumn.width ();
                     selectionRect.x = checkWidth;
                     selectionRect.width = rowRect.width - checkWidth;
                 } else {
@@ -942,7 +943,7 @@
     if (drawBackground && !drawSelection) {
         NSGraphicsContext context = NSGraphicsContext.currentContext ();
         context.saveGraphicsState ();
-        CGFloat[] colorRGB = background.handle;
+        Carbon.CGFloat[] colorRGB = background.handle;
         NSColor color = NSColor.colorWithDeviceRed (colorRGB[0], colorRGB[1], colorRGB[2], 1f);
         color.setFill ();
         NSBezierPath.fillRect (fullRect);
@@ -966,19 +967,21 @@
             gcRect.y = fullRect.y;
             gcRect.width = fullRect.x + fullRect.width;
             gcRect.height = fullRect.height;
-            data.paintRect = gcRect;
+            data.paintRectStruct = gcRect;
+            data.paintRect = &data.paintRectStruct;
         } else {
-            data.paintRect = fullRect;
+            data.paintRectStruct = fullRect;
+            data.paintRect = &data.paintRectStruct;
         }
         GC gc = GC.cocoa_new (this, data);
         gc.setFont (item.getFont (columnIndex));
         if (isSelected) {
-            CGFloat[] components = [nsSelectionForeground.numberOfComponents ()];
-            nsSelectionForeground.getComponents (components);   
+            Carbon.CGFloat[] components = [nsSelectionForeground.numberOfComponents ()];
+            nsSelectionForeground.getComponents (components.ptr);   
             Color selectionForeground = Color.cocoa_new (display, components);
             gc.setForeground (selectionForeground);
             components = [nsSelectionBackground.numberOfComponents ()];
-            nsSelectionBackground.getComponents (components);   
+            nsSelectionBackground.getComponents (components.ptr);   
             Color selectionBackground = Color.cocoa_new (display, components);
             gc.setBackground (selectionBackground);
             gc.setBackground (display.getSystemColor (DWT.COLOR_GREEN));
@@ -1455,7 +1458,7 @@
     NSIndexSet selection = widget.selectedRowIndexes();
     NSUInteger count = selection.count();
     NSUInteger [] indices = new NSUInteger [count];
-    selection.getIndexes(indices, count, 0);
+    selection.getIndexes(indices.ptr, count, null);
     int [] result = new int [count];
     for (int i = 0; i < indices.length; i++) {
         result [i] = cast(int)/*64*/indices [i];
@@ -1954,7 +1957,7 @@
     ignoreSelect = false;
 }
 
-void setBackground (CGFloat [] color) {
+void setBackground (Carbon.CGFloat [] color) {
     super.setBackground (color);
     NSColor nsColor;
     if (color is null) {
@@ -2347,12 +2350,12 @@
     if (items is null) error (DWT.ERROR_NULL_ARGUMENT);
     //TODO - optimize to use expand flag
     deselectAll ();
-    int length = items.length;
-    if (length is 0 || ((style & DWT.SINGLE) !is 0 && length > 1)) return;
-    int [] indices = new int [length];
+    int length_ = items.length;
+    if (length_ is 0 || ((style & DWT.SINGLE) !is 0 && length_ > 1)) return;
+    int [] indices = new int [length_];
     int count = 0;
-    for (int i=0; i<length; i++) {
-        int index = indexOf (items [length - i - 1]);
+    for (int i=0; i<length_; i++) {
+        int index = indexOf (items [length_ - i - 1]);
         if (index !is -1) {
             indices [count++] = index;
         }
@@ -2551,8 +2554,8 @@
 void tableViewColumnDidMove (objc.id id, objc.SEL sel, objc.id aNotification) {
     NSNotification notification = new NSNotification (aNotification);
     NSDictionary userInfo = notification.userInfo ();
-    id nsOldIndex = userInfo.valueForKey (NSString.stringWith ("NSOldColumn")); //$NON-NLS-1$
-    id nsNewIndex = userInfo.valueForKey (NSString.stringWith ("NSNewColumn")); //$NON-NLS-1$
+    cocoa.id nsOldIndex = userInfo.valueForKey (NSString.stringWith ("NSOldColumn")); //$NON-NLS-1$
+    cocoa.id nsNewIndex = userInfo.valueForKey (NSString.stringWith ("NSNewColumn")); //$NON-NLS-1$
     int oldIndex = (new NSNumber (nsOldIndex)).intValue ();
     int newIndex = (new NSNumber (nsNewIndex)).intValue ();
     int startIndex = Math.min (oldIndex, newIndex);
@@ -2572,7 +2575,7 @@
 void tableViewColumnDidResize (objc.id id, objc.SEL sel, objc.id aNotification) {
     NSNotification notification = new NSNotification (aNotification);
     NSDictionary userInfo = notification.userInfo ();
-    id columnId = userInfo.valueForKey (NSString.stringWith ("NSTableColumn")); //$NON-NLS-1$
+    cocoa.id columnId = userInfo.valueForKey (NSString.stringWith ("NSTableColumn")); //$NON-NLS-1$
     TableColumn column = getColumn (columnId);
     if (column is null) return; /* either CHECK column or firstColumn in 0-column Table */
 
@@ -2611,7 +2614,7 @@
 }
 
 void tableView_didClickTableColumn (objc.id id, objc.SEL sel, objc.id tableView, objc.id tableColumn) {
-    TableColumn column = getColumn (new id (tableColumn));
+    TableColumn column = getColumn (new cocoa.id (tableColumn));
     column.postEvent (DWT.Selection);
 }
 
@@ -2644,7 +2647,7 @@
         event.index = cast(int)/*64*/rowIndex;
         postEvent (DWT.Selection, event);
         NSTableView tableView = cast(NSTableView)view;
-        NSRect rect = tableView.rectOfRow (rowIndex);
+        NSRect rect = tableView.rectOfRow (cast(NSInteger)rowIndex);
         tableView.setNeedsDisplayInRect (rect);
     }
 }
@@ -2672,12 +2675,13 @@
     if (hooks (DWT.MeasureItem)) {
         NSTableView tableView = cast(NSTableView)this.view;
         NSInteger nsColumnIndex = tableView.columnWithIdentifier (new cocoa.id (aTableColumn));
-        NSRect rect = tableView.frameOfCellAtColumn (nsColumnIndex, rowIndex);
+        NSRect rect = tableView.frameOfCellAtColumn (nsColumnIndex, cast(NSInteger) rowIndex);
         NSRect contentRect = cell.titleRectForBounds (rect);
         NSSize contentSize = cell.cellSizeForBounds (rect);
 
         GCData data = new GCData ();
-        data.paintRect = tableView.frame ();
+        data.paintRectStruct = tableView.frame ();
+        data.paintRect = &data.paintRectStruct;
         GC gc = GC.cocoa_new (this, data);
         gc.setFont (item.getFont (columnIndex));
         int rowHeight = cast(int)tableView.rowHeight ();
--- a/dwt/widgets/TableColumn.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/TableColumn.d	Tue Dec 30 18:54:31 2008 +0100
@@ -42,6 +42,7 @@
 import objc = dwt.internal.objc.runtime;
 import dwt.widgets.Item;
 import dwt.widgets.Table;
+import dwt.widgets.TableItem;
 import dwt.widgets.TypedListener;
 
 /**
@@ -589,7 +590,7 @@
     NSTableView tableView = (cast(NSTableView) parent.view);
     NSTableHeaderView headerView = tableView.headerView ();
     if (headerView is null) return;
-    NSInteger = tableView.columnWithIdentifier (nsColumn);
+    index = cast(int)/*64*/tableView.columnWithIdentifier (nsColumn);
     NSRect rect = headerView.headerRectOfColumn (index);
     headerView.setNeedsDisplayInRect (rect);
     rect = tableView.rectOfColumn (index);
--- a/dwt/widgets/Text.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/Text.d	Tue Dec 30 18:54:31 2008 +0100
@@ -50,10 +50,11 @@
 import dwt.internal.cocoa.SWTTextField;
 import dwt.internal.cocoa.SWTTextView;
 
-import dwt.internal.c.Carbon;
+import Carbon = dwt.internal.c.Carbon;
 import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 import dwt.widgets.Composite;
+import dwt.widgets.Event;
 import dwt.widgets.Scrollable;
 import dwt.widgets.TypedListener;
 
@@ -86,11 +87,12 @@
  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
  */
 public class Text : Scrollable {
-    int textLimit = LIMIT, tabs = 8;
+    int textLimit, tabs = 8;
     char echoCharacter;
     bool doubleClick, receivingFocus;
     String hiddenText, message;
-    NSRange selectionRange;
+    NSRange* selectionRange;
+    NSRange selectionRangeStruct;
     
     /**
     * The maximum number of characters that can be entered
@@ -152,6 +154,8 @@
  * @see Widget#getStyle
  */
 public this (Composite parent, int style) {
+    textLimit = LIMIT;
+    
     super (parent, checkStyle (style));
     if ((style & DWT.SEARCH) !is 0) {
 //      int inAttributesToSet = (style & DWT.CANCEL) !is 0 ? OS.kHISearchFieldAttributesCancel : 0;
@@ -1130,11 +1134,11 @@
         String oldText = getText ();
         if (textLimit !is LIMIT) {
             int charCount = oldText.length ();
-            if (charCount - (selection.y - selection.x) + length > textLimit) {
+            if (charCount - (selection.y - selection.x) + length_ > textLimit) {
                 string = string.substring(0, textLimit - charCount + (selection.y - selection.x));
             }
         }
-        String newText = oldText.substring (0, selection.x) + string + oldText.substring (selection.y);
+        String newText = oldText.substring (0, selection.x) ~ string ~ oldText.substring (selection.y);
         setEditText (newText);
         setSelection (selection.x + string.length ());
     }
@@ -1349,7 +1353,7 @@
             break;
         default:
             if (character !is '\t' && character < 0x20) return true;
-            oldText = new String ([character]);
+            oldText = new_String ([character]);
     }
     String newText = verifyText (oldText, start, end, nsEvent);
     if (newText is null) return false;
@@ -1371,7 +1375,7 @@
     return result;
 }
 
-void setBackground (CGFloat [] color) {
+void setBackground (Carbon.CGFloat [] color) {
     NSColor nsColor;
     if (color is null) {
         return; // TODO reset to OS default
@@ -1494,7 +1498,7 @@
     super.setFont (font);
 }
 
-void setForeground (CGFloat [] color) {
+void setForeground (Carbon.CGFloat [] color) {
     NSColor nsColor;
     if (color is null) {
         return; // TODO reset to OS default
@@ -1625,12 +1629,13 @@
         int length = cast(int)/*64*/str.length ();
         int selStart = Math.min (Math.max (Math.min (start, end), 0), length);
         int selEnd = Math.min (Math.max (Math.max (start, end), 0), length);
-        selectionRange = NSRange ();
+        selectionRangeStruct = NSRange ();
+        selectionRange = &selectionRangeStruct;
         selectionRange.location = selStart;
         selectionRange.length = selEnd - selStart;
         if (this is display.getFocusControl ()) {
             NSText editor = view.window ().fieldEditor (false, view);
-            editor.setSelectedRange (selectionRange);
+            editor.setSelectedRange (selectionRangeStruct);
         }
     } else {
         int length = cast(int)/*64*/(cast(NSTextView) view).textStorage ().length ();
@@ -1816,7 +1821,8 @@
 void textViewDidChangeSelection(objc.id id, objc.SEL sel, objc.id aNotification) {
     NSNotification notification = new NSNotification (aNotification);
     NSText editor = new NSText (notification.object ().id);
-    selectionRange = editor.selectedRange ();
+    selectionRangeStruct = editor.selectedRange ();
+    selectionRange = &selectionRangeStruct;
 }
 
 void textDidChange (objc.id id, objc.SEL sel, objc.id aNotification) {
@@ -1829,7 +1835,7 @@
     * then return the receiver's last selection range, otherwise the full
     * text will be automatically selected.
     */
-    if (receivingFocus && selectionRange !is null) return selectionRange;
+    if (receivingFocus && selectionRange !is null) return selectionRangeStruct;
 
     /* allow the selection change to proceed */
     NSRange result = NSRange ();
--- a/dwt/widgets/ToolBar.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/ToolBar.d	Tue Dec 30 18:54:31 2008 +0100
@@ -66,6 +66,13 @@
  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
  */
 public class ToolBar : Composite {
+    
+    alias Composite.computeSize computeSize;
+    alias Composite.createHandle createHandle;
+    alias Composite.forceFocus forceFocus;
+    alias Composite.setBounds setBounds;
+    alias Composite.setToolTipText setToolTipText;
+    
     int itemCount;
     ToolItem [] items;
     NSArray accessibilityAttributes = null;
--- a/dwt/widgets/Tracker.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/Tracker.d	Tue Dec 30 18:54:31 2008 +0100
@@ -37,7 +37,7 @@
 import dwt.internal.cocoa.NSWindow;
 import dwt.internal.cocoa.OS;
 
-import dwt.internal.c.Carbon;
+import Carbon = dwt.internal.c.Carbon;
 import dwt.internal.objc.cocoa.Cocoa;
 import dwt.widgets.Composite;
 import dwt.widgets.Control;
@@ -86,12 +86,6 @@
     const static int STEPSIZE_SMALL = 1;
     const static int STEPSIZE_LARGE = 9;
     
-    static this ()
-    {
-        rectangles = new Rectangle [0];
-        proportions = rectangles;
-    }
-
 /**
  * Constructs a new instance of this class given its parent
  * and a style value describing its behavior and appearance.
@@ -125,6 +119,9 @@
  * @see Widget#getStyle
  */
 public this (Composite parent, int style) {
+    rectangles = new Rectangle [0];
+    proportions = rectangles;
+    
     super (parent, checkStyle (style));
     this.parent = parent;
 }
@@ -164,6 +161,9 @@
  * @see DWT#DOWN
  */
 public this (Display display, int style) {
+    rectangles = new Rectangle [0];
+    proportions = rectangles;
+    
     if (display is null) display = Display.getCurrent ();
     if (display is null) display = Display.getDefault ();
     if (!display.isValidThread ()) {
@@ -742,14 +742,14 @@
     tracking = true;
     window = cast(NSWindow)(new NSWindow()).alloc();
     NSArray screens = NSScreen.screens();
-    CGFloat minX = Float.MAX_VALUE, maxX = Float.MIN_VALUE;
-    CGFloat minY = Float.MAX_VALUE, maxY = Float.MIN_VALUE;    
+    Carbon.CGFloat minX = Float.MAX_VALUE, maxX = Float.MIN_VALUE;
+    Carbon.CGFloat minY = Float.MAX_VALUE, maxY = Float.MIN_VALUE;    
     int count = cast(int)/*64*/screens.count();
     for (int i = 0; i < count; i++) {
         NSScreen screen = new NSScreen(screens.objectAtIndex(i));
         NSRect frame = screen.frame();
-        CGFloat x1 = frame.x, x2 = frame.x + frame.width;
-        CGFloat y1 = frame.y, y2 = frame.y + frame.height;
+        Carbon.CGFloat x1 = frame.x, x2 = frame.x + frame.width;
+        Carbon.CGFloat y1 = frame.y, y2 = frame.y + frame.height;
         if (x1 < minX) minX = x1;
         if (x2 < minX) minX = x2;
         if (x1 > maxX) maxX = x1;
--- a/dwt/widgets/Tree.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/Tree.d	Tue Dec 30 18:54:31 2008 +0100
@@ -63,7 +63,7 @@
 import dwt.internal.cocoa.SWTTreeItem;
 import cocoa = dwt.internal.cocoa.id;
 
-import dwt.internal.c.Carbon;
+import Carbon = dwt.internal.c.Carbon;
 import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 import dwt.widgets.Composite;
@@ -139,7 +139,7 @@
     TreeColumn sortColumn;
     int columnCount;
     int sortDirection;
-    CGFloat levelIndent;
+    Carbon.CGFloat levelIndent;
     bool ignoreExpand, ignoreSelect;
 
 /**
@@ -423,7 +423,7 @@
 //          GC gc = new GC (this);
 //          width = calculateWidth (childIds, gc, true, 0, levelIndent);
 //          gc.dispose ();
-//          width += getInsetWidth (column_id, true);
+//          width += getInsetWidth (columnid, true);
         }
         if ((style & DWT.CHECK) !is 0) width += getCheckColumnWidth ();
     } else {
@@ -930,11 +930,11 @@
         GC gc = GC.cocoa_new (this, data);
         gc.setFont (item.getFont (columnIndex));
         if (isSelected) {
-            CGFloat[] components = new CGFloat[nsSelectionForeground.numberOfComponents ()];
+            Carbon.CGFloat[] components = new Carbon.CGFloat[nsSelectionForeground.numberOfComponents ()];
             nsSelectionForeground.getComponents (components.ptr);   
             Color selectionForeground = Color.cocoa_new (display, components);
             gc.setForeground (selectionForeground);
-            components = new CGFloat[nsSelectionBackground.numberOfComponents ()];
+            components = new Carbon.CGFloat[nsSelectionBackground.numberOfComponents ()];
             nsSelectionBackground.getComponents (components.ptr);   
             Color selectionBackground = Color.cocoa_new (display, components);
             gc.setBackground (selectionBackground);
@@ -974,7 +974,7 @@
                 NSRect rowRect = outlineView.rectOfRow (rowIndex);
                 if ((style & DWT.CHECK) !is 0) {
                     /* highlighting at this stage draws over the checkbox, so don't include its column */
-                    CGFloat checkWidth = checkColumn.width ();
+                    Carbon.CGFloat checkWidth = checkColumn.width ();
                     selectionRect.x = checkWidth;
                     selectionRect.width = rowRect.width - checkWidth;
                 } else {
@@ -988,7 +988,7 @@
     if (drawBackground && !drawSelection) {
         NSGraphicsContext context = NSGraphicsContext.currentContext ();
         context.saveGraphicsState ();
-        CGFloat[] colorRGB = background.handle;
+        Carbon.CGFloat[] colorRGB = background.handle;
         NSColor color = NSColor.colorWithDeviceRed (colorRGB[0], colorRGB[1], colorRGB[2], 1f);
         color.setFill ();
         NSBezierPath.fillRect (fullRect);
@@ -1021,11 +1021,11 @@
         GC gc = GC.cocoa_new (this, data);
         gc.setFont (item.getFont (columnIndex));
         if (isSelected) {
-            CGFloat[] components = new CGFloat[nsSelectionForeground.numberOfComponents ()];
+            Carbon.CGFloat[] components = new Carbon.CGFloat[nsSelectionForeground.numberOfComponents ()];
             nsSelectionForeground.getComponents (components.ptr);   
             Color selectionForeground = Color.cocoa_new (display, components);
             gc.setForeground (selectionForeground);
-            components = new CGFloat[nsSelectionBackground.numberOfComponents ()];
+            components = new Carbon.CGFloat[nsSelectionBackground.numberOfComponents ()];
             nsSelectionBackground.getComponents (components.ptr);   
             Color selectionBackground = Color.cocoa_new (display, components);
             gc.setBackground (selectionBackground);
@@ -1560,7 +1560,7 @@
 //  for (int i=0; i<items.length; i++) {
 //      TreeItem item = items [i];
 //      if (item !is null) {
-//          int columnId = (columnCount is 0) ? column_id : columns [0].id;
+//          int columnId = (columnCount is 0) ? columnid : columns [0].id;
 //          if (OS.GetDataBrowserItemPartBounds (handle, item.id, columnId, OS.kDataBrowserPropertyEnclosingPart, rect) is OS.noErr) {
 //              if (rect.top <= y && y <= rect.bottom) return item;
 //          }
@@ -1748,7 +1748,7 @@
     NSOutlineView outlineView = cast(NSOutlineView)view;
     NSArray nsColumns = outlineView.tableColumns ();
     for (int i = startIndex; i <= endIndex; i++) {
-        id columnId = nsColumns.objectAtIndex (i);
+        cocoa.id columnId = nsColumns.objectAtIndex (i);
         TreeColumn column = getColumn (columnId);
         if (column !is null) {
             column.sendEvent (DWT.Move);
@@ -1799,7 +1799,7 @@
     if (row is -1)
         postEvent (DWT.Selection);
     else {
-        id _id = widget.itemAtRow (row);
+        cocoa.id _id = widget.itemAtRow (row);
         TreeItem item = cast(TreeItem) display.getWidget (_id.id);
         Event event = new Event ();
         event.item = item;
@@ -2054,7 +2054,7 @@
     return result;
 }
 
-void setBackground (CGFloat [] color) {
+void setBackground (Carbon.CGFloat [] color) {
     super.setBackground (color);
     NSColor nsColor;
     if (color is null) {
--- a/dwt/widgets/TreeColumn.d	Tue Dec 30 17:01:10 2008 +0100
+++ b/dwt/widgets/TreeColumn.d	Tue Dec 30 18:54:31 2008 +0100
@@ -42,6 +42,7 @@
 import objc = dwt.internal.objc.runtime;
 import dwt.widgets.Item;
 import dwt.widgets.Tree;
+import dwt.widgets.TreeItem;
 import dwt.widgets.TypedListener;
 
 /**
@@ -591,7 +592,7 @@
     NSOutlineView outlineView = (cast(NSOutlineView) parent.view);
     NSTableHeaderView headerView = outlineView.headerView ();
     if (headerView is null) return;
-    NSInteger = outlineView.columnWithIdentifier (nsColumn);
+    index = outlineView.columnWithIdentifier (nsColumn);
     NSRect rect = headerView.headerRectOfColumn (index);
     headerView.setNeedsDisplayInRect (rect);
     rect = outlineView.rectOfColumn (index);