changeset 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 83b0ad9d9238
children c74ba20de292
files dsss.conf dwt/accessibility/Accessible.d dwt/accessibility/SWTAccessibleDelegate.d dwt/dwthelper/FileInputStream.d dwt/dwthelper/array.d dwt/graphics/Cursor.d dwt/graphics/Device.d dwt/graphics/Font.d dwt/graphics/GC.d dwt/graphics/Path.d dwt/graphics/Pattern.d dwt/graphics/Region.d dwt/graphics/TextLayout.d dwt/internal/Platform.d dwt/internal/c/Carbon.d dwt/internal/c/bindings.d dwt/internal/cocoa/CGPoint.d dwt/internal/cocoa/CGSize.d dwt/internal/cocoa/NSActionCell.d dwt/internal/cocoa/NSAffineTransform.d dwt/internal/cocoa/NSAlert.d dwt/internal/cocoa/NSArray.d dwt/internal/cocoa/NSAttributedString.d dwt/internal/cocoa/NSBezierPath.d dwt/internal/cocoa/NSBitmapImageRep.d dwt/internal/cocoa/NSBox.d dwt/internal/cocoa/NSButton.d dwt/internal/cocoa/NSButtonCell.d dwt/internal/cocoa/NSCalendarDate.d dwt/internal/cocoa/NSCell.d dwt/internal/cocoa/NSColor.d dwt/internal/cocoa/NSControl.d dwt/internal/cocoa/NSData.d dwt/internal/cocoa/NSDictionary.d dwt/internal/cocoa/NSEvent.d dwt/internal/cocoa/NSFont.d dwt/internal/cocoa/NSGradient.d dwt/internal/cocoa/NSGraphicsContext.d dwt/internal/cocoa/NSImage.d dwt/internal/cocoa/NSImageView.d dwt/internal/cocoa/NSLayoutManager.d dwt/internal/cocoa/NSMutableParagraphStyle.d dwt/internal/cocoa/NSObject.d dwt/internal/cocoa/NSParagraphStyle.d dwt/internal/cocoa/NSPasteboard.d dwt/internal/cocoa/NSPoint.d dwt/internal/cocoa/NSPopUpButton.d dwt/internal/cocoa/NSPrintInfo.d dwt/internal/cocoa/NSRange.d dwt/internal/cocoa/NSScreen.d dwt/internal/cocoa/NSScrollView.d dwt/internal/cocoa/NSScroller.d dwt/internal/cocoa/NSSize.d dwt/internal/cocoa/NSTabView.d dwt/internal/cocoa/NSTableHeaderCell.d dwt/internal/cocoa/NSTableHeaderView.d dwt/internal/cocoa/NSTableView.d dwt/internal/cocoa/NSText.d dwt/internal/cocoa/NSTextContainer.d dwt/internal/cocoa/NSTextTab.d dwt/internal/cocoa/NSValue.d dwt/internal/cocoa/NSView.d dwt/internal/cocoa/NSWindow.d dwt/internal/cocoa/OS.d dwt/internal/objc/cocoa/Cocoa.d dwt/internal/objc/cocoa/bindings.d dwt/internal/objc/runtime.d dwt/widgets/Button.d dwt/widgets/Composite.d dwt/widgets/Control.d dwt/widgets/Display.d dwt/widgets/IME.d dwt/widgets/MessageBox.d dwt/widgets/ScrollBar.d dwt/widgets/Shell.d dwt/widgets/ToolTip.d dwt/widgets/Widget.d
diffstat 77 files changed, 1578 insertions(+), 1047 deletions(-) [+]
line wrap: on
line diff
--- a/dsss.conf	Tue Dec 09 21:52:21 2008 +0100
+++ b/dsss.conf	Mon Dec 22 15:10:19 2008 +0100
@@ -1,52 +1,2 @@
 [dwt]
-buildflags+=-framework Cocoa
-exclude+=dwt/accessibility
-exclude+=dwt/browser/
-exclude+=dwt/custom
-exclude+=dwt/dnd
-exclude+=dwt/effects
-exclude+=dwt/events
-exclude+=dwt/graphics/TextLayout.d
-exclude+=dwt/internal/cocoa/DOM*
-exclude+=dwt/internal/cocoa/MacGenerator.d
-exclude+=dwt/internal/cocoa/Web*
-exclude+=dwt/internal/theme
-exclude+=dwt/layout
-exclude+=dwt/opengl
-exclude+=dwt/printing
-exclude+=dwt/program
-exclude+=dwt/widgets/ColorDialog.d
-exclude+=dwt/widgets/Combo.d
-exclude+=dwt/widgets/CoolBar.d
-exclude+=dwt/widgets/CoolItem.d
-exclude+=dwt/widgets/DateTime.d
-exclude+=dwt/widgets/DirectoryDialog.d
-exclude+=dwt/widgets/ExpandBar.d
-exclude+=dwt/widgets/ExpandItem.d
-exclude+=dwt/widgets/FileDialog.d
-exclude+=dwt/widgets/FontDialog.d
-exclude+=dwt/widgets/Group.d
-exclude+=dwt/widgets/Label.d
-exclude+=dwt/widgets/Link.d
-exclude+=dwt/widgets/List.d
-exclude+=dwt/widgets/MessageBox.d
-exclude+=dwt/widgets/ProgressBar.d
-exclude+=dwt/widgets/Sash.d
-exclude+=dwt/widgets/Scale.d
-exclude+=dwt/widgets/Slider.d
-exclude+=dwt/widgets/Spinner.d
-exclude+=dwt/widgets/TabFolder.d
-exclude+=dwt/widgets/TabItem.d
-exclude+=dwt/widgets/Table.d
-exclude+=dwt/widgets/TableColumn.d
-exclude+=dwt/widgets/TableItem.d
-exclude+=dwt/widgets/Text.d
-exclude+=dwt/widgets/ToolBar.d
-exclude+=dwt/widgets/ToolItem.d
-exclude+=dwt/widgets/ToolTip.d
-exclude+=dwt/widgets/Tracker.d
-exclude+=dwt/widgets/Tray.d
-exclude+=dwt/widgets/TrayItem.d
-exclude+=dwt/widgets/Tree.d
-exclude+=dwt/widgets/TreeColumn.d
-exclude+=dwt/widgets/TreeItem.d
\ No newline at end of file
+buildflags+=-framework Cocoa -framework Carbon
\ No newline at end of file
--- a/dwt/accessibility/Accessible.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/accessibility/Accessible.d	Mon Dec 22 15:10:19 2008 +0100
@@ -36,10 +36,15 @@
 import dwt.widgets.Monitor;
 import dwt.widgets.Shell;
 
+import tango.core.Thread;
 import tango.util.container.HashMap;
 
+import dwt.accessibility.ACC;
+import dwt.accessibility.AccessibleControlEvent;
+import dwt.accessibility.AccessibleEvent;
 import dwt.accessibility.AccessibleListener;
 import dwt.accessibility.AccessibleControlListener;
+import dwt.accessibility.AccessibleTextEvent;
 import dwt.accessibility.AccessibleTextListener;
 import dwt.accessibility.SWTAccessibleDelegate;
 import dwt.dwthelper.array;
@@ -231,7 +236,7 @@
         event.childID = childID;
         event.detail = -1;
         for (int i = 0; i < accessibleControlListeners.size(); i++) {
-            AccessibleControlListener listener = accessibleControlListeners.elementAt(i);
+            AccessibleControlListener listener = elementAt(accessibleControlListeners, i);
             listener.getRole(event);
         }
 
@@ -361,7 +366,7 @@
         if (event.detail !is -1) {
             String osRole = roleToOs(event.detail);
             
-            if (osRole.indexOf(':') is -1)
+            if (dwt.dwthelper.utils.indexOf(osRole, ':') is -1)
                 returnValue.removeObject(OS.NSAccessibilitySubroleAttribute);
         }
 
@@ -453,7 +458,7 @@
     public cocoa.id internal_accessibilityHitTest(NSPoint point, int childID) {
         AccessibleControlEvent event = new AccessibleControlEvent(this);
         event.x = cast(int) point.x;
-        Monitor primaryMonitor = Display.getCurrent().getPrimaryMonitor();
+        dwt.widgets.Monitor.Monitor primaryMonitor = Display.getCurrent().getPrimaryMonitor();
         event.y = cast(int) (primaryMonitor.getBounds().height - point.y);
     
         // Set an impossible value to determine if anything responded to the event.
@@ -586,7 +591,7 @@
         }
         if (event.detail !is -1) {
             String appRole = roleToOs (event.detail);
-            int index = appRole.indexOf(':');
+            int index = dwt.dwthelper.utils.indexOf(appRole, ':');
             if (index !is -1) appRole = appRole.substring(0, index);
             returnValue = NSString.stringWith(appRole);
         }
@@ -605,7 +610,7 @@
         }
         if (event.detail !is -1) {
             String appRole = roleToOs (event.detail);
-            int index = appRole.indexOf(':');
+            int index = dwt.dwthelper.utils.indexOf(appRole, ':');
             if (index !is -1) {
                 appRole = appRole.substring(index + 1);
                 returnValue = NSString.stringWith(appRole);
@@ -626,7 +631,7 @@
         if (event.detail !is -1) {
             String appRole = roleToOs (event.detail);
             String appSubrole = null;
-            int index = appRole.indexOf(':');
+            int index = dwt.dwthelper.utils.indexOf(appRole, ':');
             if (index !is -1) {
                 appSubrole = appRole.substring(index + 1);
                 appRole = appRole.substring(0, index);
@@ -671,7 +676,7 @@
     }
     
     cocoa.id getValueAttribute (int childID) {
-        id returnValue = null;
+        cocoa.id returnValue = null;
         AccessibleControlEvent event = new AccessibleControlEvent(this);
         event.childID = childID;
         event.detail = -1;
@@ -717,7 +722,7 @@
                 if (role is ACC.ROLE_TABITEM) {
                     returnValue = NSNumber.numberWithBool(ace.childID is childID);
                 } else {
-                    returnValue = new id(OS.NSAccessibilityUnignoredAncestor(childIDToOs(ace.childID).id));
+                    returnValue = new cocoa.id(OS.NSAccessibilityUnignoredAncestor(childIDToOs(ace.childID).id));
                 }
             } else {
                 returnValue = NSNumber.numberWithBool(false);               
@@ -798,7 +803,7 @@
         if (childID is ACC.CHILDID_SELF)
             return null;
         else
-            return new id(OS.NSAccessibilityUnignoredAncestor(control.view.id));
+            return new cocoa.id(OS.NSAccessibilityUnignoredAncestor(control.view.id));
     }
     
     cocoa.id getChildrenAttribute (int childID) {
@@ -824,7 +829,7 @@
                     for (int i = 0; i < appChildren.length; i++) {
                         Object child = appChildren[i];
                         if (cast(Integer) child) {
-                            id accChild = childIDToOs((cast(Integer)child).intValue());                         
+                            cocoa.id accChild = childIDToOs((cast(Integer)child).intValue());                         
                             childArray.addObject(accChild);
                         } else {
                             childArray.addObject((cast(Accessible)child).control.view);
@@ -918,7 +923,7 @@
             listener.getLocation(event);
         }
 
-        Monitor primaryMonitor = Display.getCurrent().getPrimaryMonitor();
+        dwt.widgets.Monitor.Monitor primaryMonitor = Display.getCurrent().getPrimaryMonitor();
         
         NSPoint osPositionAttribute = NSPoint ();
         if (event.width !is -1) {
@@ -1036,7 +1041,7 @@
         // The parameter is an NSNumber with the line number.
         NSNumber lineNumberObj = new NSNumber(parameter.id);        
         int lineNumber = lineNumberObj.intValue();
-        System.Out.println("Line number = " ~ lineNumber);
+        System.Out.println("Line number = " ~ Integer.toString(lineNumber));
         AccessibleControlEvent event = new AccessibleControlEvent(this);
         event.childID = childID;
         event.result = null;
@@ -1389,11 +1394,11 @@
         }
 
         /* Check cache for childID, if found, return corresponding osChildID. */
-        SWTAccessibleDelegate childRef = children.get(childID);
+        SWTAccessibleDelegate childRef = children[childID];
         
         if (childRef is null) {
             childRef = new SWTAccessibleDelegate(this, childID);
-            children.put(childID, childRef);
+            children.add(childID, childRef);
         }
         
         return childRef;
@@ -1496,7 +1501,7 @@
 
     /* isValidThread was copied from Widget, and rewritten to work in this package */
     bool isValidThread () {
-        return control.getDisplay ().getThread () is Thread.currentThread ();
+        return control.getDisplay ().getThread () is Thread.getThis ();
     }
 
 }
--- a/dwt/accessibility/SWTAccessibleDelegate.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/accessibility/SWTAccessibleDelegate.d	Mon Dec 22 15:10:19 2008 +0100
@@ -171,12 +171,12 @@
     
     void accessibilitySetValue_forAttribute(cocoa.id value, NSString attribute) {
         // This shouldn't be called!
-        System.Out.println("Ignoring attribute: " + attribute.getString());
+        System.Out.println("Ignoring attribute: " ~ attribute.getString());
     }
     
     static NSArray retainedAutoreleased(NSArray inObject) {
         cocoa.id temp = inObject.retain();
-        cocoa.id temp2 = (NSObject(temp.id)).autorelease();
+        cocoa.id temp2 = (new NSObject(temp.id)).autorelease();
         return new NSArray(temp2.id);
     }
 extern (C){    
@@ -214,12 +214,12 @@
             return (retObject is null ? null : retObject.id);
         } else if (sel is OS.sel_accessibilityHitTest_) {
             NSPoint point= NSPoint();
-            OS.memmove(point, arg0, NSPoint.sizeof);
+            OS.memmove(&point, arg0, NSPoint.sizeof);
             cocoa.id retObject = swtAcc.accessibilityHitTest(point);
             return (retObject is null ? null : retObject.id);
         } else if (sel is OS.sel_accessibilityIsAttributeSettable_) {
             NSString attribute = new NSString(arg0);
-            return (swtAcc.accessibilityIsAttributeSettable(attribute) ? 1 : 0);
+            return (swtAcc.accessibilityIsAttributeSettable(attribute) ? cast(objc.id) 1 : null);
         } else if (sel is OS.sel_accessibilityActionDescription_) {
             NSString action = new NSString(arg0);
             cocoa.id retObject = swtAcc.accessibilityActionDescription(action);
--- a/dwt/dwthelper/FileInputStream.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/dwthelper/FileInputStream.d	Mon Dec 22 15:10:19 2008 +0100
@@ -7,7 +7,7 @@
 import dwt.dwthelper.File;
 import dwt.dwthelper.InputStream;
 
-import tango.io.FileConduit;
+import tango.io.device.FileConduit;
 import tango.io.protocol.Reader;
 import tango.core.Exception;
 import tango.text.convert.Format;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/dwthelper/array.d	Mon Dec 22 15:10:19 2008 +0100
@@ -0,0 +1,325 @@
+/**
+ * Copyright: Copyright (c) 2008 Jacob Carlborg. All rights reserved.
+ * Authors: Jacob Carlborg
+ * Version: Initial created: 2008
+ * License: $(LINK2 http://opensource.org/licenses/bsd-license.php, BSD Style)
+ * 
+ */
+module dwt.dwthelper.array;
+
+version (Tango)
+{
+    static import tango.text.Util;
+    static import tango.core.Array;
+}
+
+else
+    version = Phobos;
+
+/**
+ * Appends the specified element to the end of the array.
+ * 
+ * Params:
+ *     arr = the array to add the element to
+ *     element = element to be appended to this list
+ *     
+ * Returns: the modified array
+ * 
+ * Throws: AssertException if the length of the array is 0
+ * Throws: AssertException if the element is null
+ */
+T[] add (T) (ref T[] arr, T element)
+in
+{
+    assert(arr.length > 0);
+}
+body
+{
+    return arr ~= element;
+}
+
+/**
+ * Appends the specified element to the end of the array.
+ * 
+ * Params:
+ *     arr = the array to add the element to
+ *     element = element to be appended to this list
+ *     
+ * Returns: the modified array
+ * 
+ * Throws: AssertException if the length of the array is 0
+ * Throws: AssertException if the element is null
+ */
+alias add addElement;
+
+/**
+ * Gets the element at the specified index
+ * 
+ * Params:
+ *     arr = the array to get the element from
+ *     index = the index of the element to get
+ *     
+ * Returns: the element at the specified index
+ */
+T elementAt (T) (T[] arr, int index)
+in
+{
+    assert(arr.length > 0);
+    assert(index > -1 && index < arr.length);
+}
+body
+{
+    return arr[index];
+}
+
+/**
+ * Returns the number of elements in the specified array. 
+ * 
+ * Params:
+ *     arr = the array to get the number of elements from
+ *     
+ * Returns: the number of elements in this list
+ */
+size_t size (T) (T[] arr)
+{
+    return arr.length;
+}
+
+/**
+ * Removes the element at the specified position in the array
+ * if it could find it and returns it.
+ * Shifts any subsequent elements to the left.
+ * 
+ * Params:
+ *     arr = the array to remove the element from
+ *     index = the index of the element to be removed
+ *     
+ * Returns: the element that was removed or $(D_CODE null)
+ * 
+ * Throws: AssertException if the length of the array is 0
+ * Throws: AssertException if the $(D_CODE index) argument is
+ *         negative or not less than the length of this array.
+ */
+T remove (T) (ref T[] arr, int index)
+in
+{
+    assert(arr.length > 0);
+    assert(index > -1 && index < arr.length);
+}
+body
+{
+    T ret = arr[index];
+
+    // NOTE: Indexes are passed instead of references because DMD does
+    //       not inline the reference-based version.
+    void exch (size_t p1, size_t p2)
+    {
+        T t = arr[p1];
+        arr[p1] = arr[p2];
+        arr[p2] = t;
+    }
+
+    size_t cnt = 0;
+
+    for (size_t pos = 0, len = arr.length; pos < len; ++pos)
+    {
+        if (pos == index)
+            ++cnt;
+        else
+            exch(pos, pos - cnt);
+    }
+    
+    arr = arr[0 .. $ - cnt];
+    
+	return ret;
+}
+
+/**
+ * Removes the specified element from the array
+ * if it could find it and returns it.
+ * Shifts any subsequent elements to the left.
+ * 
+ * Params:
+ *     arr = the array to remove the element from
+ *     element = the element to be removed
+ *     
+ * Returns: the element that was removed or $(null null)
+ * 
+ * Throws: AssertException if the length of the array is 0
+ */
+T remove (T) (ref T[] arr, T element)
+in
+{
+    assert(arr.length > 0);
+}
+out (result)
+{
+    assert(result is element || result is null);
+}
+body
+{
+    int index = arr.indexOf(element);
+
+    if (index == -1)
+        return null;
+
+    return arr.remove(index);
+}
+
+/**
+ * Removes the specified element from the array
+ * if it could find it and returns it.
+ * Shifts any subsequent elements to the left.
+ * 
+ * Params:
+ *     arr = the array to remove the element from
+ *     element = the element to be removed
+ *     
+ * Returns: the element that was removed or $(null null)
+ * 
+ * Throws: AssertException if the length of the array is 0
+ */
+alias remove removeElement;
+
+/**
+ * Returns the index of the first occurrence of the specified element
+ * in the array, or -1 if the array does not contain the element. 
+ * 
+ * Params:
+ *     arr = the array to get the index of the element from
+ *     element = the element to find
+ *     
+ * Returns: the index of the element or -1 if it's not in the array
+ * 
+ * Throws: AssertException if the length of the array is 0
+ * Throws: AssertException if the return value is less than -1 or
+ *         greater than the length of the array - 1.
+ */
+size_t indexOf (T, U = uint) (T[] arr, T element, U start = 0)
+in
+{
+    assert(arr.length > 0);
+    assert(start >= 0);
+    assert(element !is null);
+}
+out (result)
+{
+    assert(result >= -1 && result < arr.length);
+}
+body
+{
+    uint index;
+
+    version (Tango)
+        index = tango.text.Util.locate(arr, element);
+
+    else
+    {
+        if (start > arr.length)
+            start = arr.length;
+
+        index = privateIndexOf(arr.ptr, element, arr.length - start) + start;
+    }
+
+    if (index == arr.length)
+        index = -1;
+
+    return index;
+
+    version (Phobos)
+    {
+        // tango.text.Util.locate
+        uint privateIndexOf (T* str, T match, uint length)
+        {
+            version (D_InlineAsm_X86)
+            {
+                static if (T.sizeof == 1)
+                {
+                    asm 
+                    {
+                            mov   EDI, str;
+                            mov   ECX, length;
+                            movzx EAX, match;
+                            mov   ESI, ECX;
+                            and   ESI, ESI;            
+                            jz    end;        
+                        
+                            cld;
+                            repnz;
+                            scasb;
+                            jnz   end;
+                            sub   ESI, ECX;
+                            dec   ESI;
+                        end:;
+                            mov   EAX, ESI;
+                    }
+                }
+                else static if (T.sizeof == 2)
+                {
+                    asm
+                    {
+                            mov   EDI, str;
+                            mov   ECX, length;
+                            movzx EAX, match;
+                            mov   ESI, ECX;
+                            and   ESI, ESI;            
+                            jz    end;        
+                        
+                            cld;
+                            repnz;
+                            scasw;
+                            jnz   end;
+                            sub   ESI, ECX;
+                            dec   ESI;
+                        end:;
+                            mov   EAX, ESI;
+                    }
+                }
+                
+                else static if (T.sizeof == 4)
+                {
+                    asm
+                    {
+                            mov   EDI, str;
+                            mov   ECX, length;
+                            mov   EAX, match;
+                            mov   ESI, ECX;
+                            and   ESI, ESI;            
+                            jz    end;        
+                        
+                            cld;
+                            repnz;
+                            scasd;
+                            jnz   end;
+                            sub   ESI, ECX;
+                            dec   ESI;
+                        end:;
+                            mov   EAX, ESI;
+                    }
+                }
+                
+                else
+                {
+                    auto len = length;
+                    
+                    for (auto p = str - 1; len--; )
+                        if (*++p is match)
+                            return p - str;
+                    
+                    return length;
+                }
+            }
+            
+            else
+            {
+                auto len = length;
+                
+                for (auto p = str - 1; len--; )
+                    if (*++p is match)
+                        return p - str;
+                
+                return length;
+            }
+        }
+    }
+}
\ No newline at end of file
--- a/dwt/graphics/Cursor.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/graphics/Cursor.d	Mon Dec 22 15:10:19 2008 +0100
@@ -34,7 +34,7 @@
 import dwt.graphics.PaletteData;
 import dwt.graphics.Resource;
 import dwt.graphics.RGB;
-import dwt.internal.cocoa.NSInteger;
+import dwt.internal.objc.cocoa.Cocoa;
 
 /**
  * Instances of this class manage operating system resources that
--- a/dwt/graphics/Device.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/graphics/Device.d	Mon Dec 22 15:10:19 2008 +0100
@@ -46,7 +46,6 @@
 import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
-
 /**
  * This class is the abstract superclass of all device objects,
  * such as the Display device and the Printer device. Devices
@@ -149,7 +148,7 @@
         NSAutoreleasePool pool = cast(NSAutoreleasePool) (new NSAutoreleasePool()).alloc().init();
         NSThread nsthread = NSThread.currentThread();
         NSMutableDictionary dictionary = nsthread.threadDictionary();
-        NSString key = NSString.stringWith("DWT_NSAutoreleasePool");
+        NSString key = NSString.stringWith("SWT_NSAutoreleasePool");
         cocoa.id obj = dictionary.objectForKey(key);
         if (obj is null) {
             NSNumber nsnumber = NSNumber.numberWithInteger(cast(NSInteger) pool.id);
@@ -546,8 +545,8 @@
     COLOR_WHITE = new Color (this, 0xFF,0xFF,0xFF);
     
     /* Initialize the system font slot */
-    bool smallFonts = System.getProperty("dwt.internal.carbon.smallFonts") !is null;
-    float systemFontSize = smallFonts ? NSFont.smallSystemFontSize() : NSFont.systemFontSize();     
+    bool smallFonts = System.getProperty("org.eclipse.swt.internal.carbon.smallFonts") !is null;
+    Carbon.CGFloat systemFontSize = smallFonts ? NSFont.smallSystemFontSize() : NSFont.systemFontSize();     
     Point dpi = this.dpi = getDPI(), screenDPI = getScreenDPI();
     NSFont font = NSFont.systemFontOfSize(systemFontSize * dpi.y / screenDPI.y);
     systemFont = Font.cocoa_new(this, font);
--- a/dwt/graphics/Font.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/graphics/Font.d	Mon Dec 22 15:10:19 2008 +0100
@@ -31,7 +31,7 @@
 import dwt.graphics.FontData;
 import dwt.graphics.Point;
 import dwt.graphics.Resource;
-import dwt.internal.cocoa.CGFloat;
+import Carbon = dwt.internal.c.Carbon;
 
 /**
  * Instances of this class manage operating system resources that
@@ -174,7 +174,7 @@
         if (pool !is null) pool.release();
     }
 }
-
+//FIXME: Jacob Carlborg
 /*public*/ this(Device device, String name, float height, int style) {
     super(device);
     init_(name, height, style, null);
--- a/dwt/graphics/GC.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/graphics/GC.d	Mon Dec 22 15:10:19 2008 +0100
@@ -38,6 +38,7 @@
 import dwt.internal.cocoa.NSView;
 import dwt.internal.cocoa.OS;
 
+import tango.core.Thread;
 import tango.text.convert.Format;
 
 import dwt.dwthelper.utils;
@@ -58,7 +59,7 @@
 import dwt.graphics.Resource;
 import dwt.graphics.RGB;
 import dwt.graphics.Transform;
-import dwt.internal.c.Carbon;
+import Carbon = dwt.internal.c.Carbon;
 import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
@@ -130,14 +131,14 @@
     const static int DRAW = CLIPPING | TRANSFORM | FOREGROUND | LINE_WIDTH | LINE_STYLE  | LINE_CAP  | LINE_JOIN | LINE_MITERLIMIT | DRAW_OFFSET;
     const static int FILL = CLIPPING | TRANSFORM | BACKGROUND;
 
-    static const CGFloat[] LINE_DOT = [1, 1];
-    static const CGFloat[] LINE_DASH = [3, 1];
-    static const CGFloat[] LINE_DASHDOT = [3, 1, 1, 1];
-    static const CGFloat[] LINE_DASHDOTDOT = [3, 1, 1, 1, 1, 1];
-    static const CGFloat[] LINE_DOT_ZERO = [3, 3];
-    static const CGFloat[] LINE_DASH_ZERO = [18, 6];
-    static const CGFloat[] LINE_DASHDOT_ZERO = [9, 6, 3, 6];
-    static const CGFloat[] LINE_DASHDOTDOT_ZERO = [9, 3, 3, 3, 3, 3];
+    static const Carbon.CGFloat[] LINE_DOT = [1, 1];
+    static const Carbon.CGFloat[] LINE_DASH = [3, 1];
+    static const Carbon.CGFloat[] LINE_DASHDOT = [3, 1, 1, 1];
+    static const Carbon.CGFloat[] LINE_DASHDOTDOT = [3, 1, 1, 1, 1, 1];
+    static const Carbon.CGFloat[] LINE_DOT_ZERO = [3, 3];
+    static const Carbon.CGFloat[] LINE_DASH_ZERO = [18, 6];
+    static const Carbon.CGFloat[] LINE_DASHDOT_ZERO = [9, 6, 3, 6];
+    static const Carbon.CGFloat[] LINE_DASHDOTDOT_ZERO = [9, 3, 3, 3, 3, 3];
 
 this() {
 }
@@ -288,7 +289,7 @@
         if (pattern !is null) {
             if (pattern.color !is null) pattern.color.setStroke();
         } else {
-            CGFloat[] color = data.foreground;
+            Carbon.CGFloat[] color = data.foreground;
             NSColor.colorWithDeviceRed(color[0], color[1], color[2], data.alpha / 255f).setStroke();
         }
     }
@@ -297,7 +298,7 @@
         if (pattern !is null) {
             if (pattern.color !is null) pattern.color.setFill();
         } else {
-            CGFloat[] color = data.foreground;
+            Carbon.CGFloat[] color = data.foreground;
             NSColor.colorWithDeviceRed(color[0], color[1], color[2], data.alpha / 255f).setFill();
         }
         data.state &= ~BACKGROUND;
@@ -307,7 +308,7 @@
         if (pattern !is null) {
             if (pattern.color !is null) pattern.color.setFill();
         } else {
-            CGFloat[] color = data.background;
+            Carbon.CGFloat[] color = data.background;
             NSColor.colorWithDeviceRed(color[0], color[1], color[2], data.alpha / 255f).setFill();
         }
         data.state &= ~FOREGROUND_FILL;
@@ -325,8 +326,8 @@
         }
     }
     if ((state & LINE_STYLE) !is 0) {
-        CGFloat[] dashes = null;
-        CGFloat width = data.lineWidth;
+        Carbon.CGFloat[] dashes = null;
+        Carbon.CGFloat width = data.lineWidth;
         switch (data.lineStyle) {
             case DWT.LINE_SOLID: break;
             case DWT.LINE_DASH: dashes = width !is 0 ? LINE_DASH : LINE_DASH_ZERO; break;
@@ -337,7 +338,7 @@
             default: assert(false);
         }
         if (dashes !is null) {
-            CGFloat[] lengths = new CGFloat[dashes.length];
+            Carbon.CGFloat[] lengths = new Carbon.CGFloat[dashes.length];
             for (int i = 0; i < lengths.length; i++) {
                 lengths[i] = width is 0 || data.lineStyle is DWT.LINE_CUSTOM ? dashes[i] : dashes[i] * width;
             }
@@ -376,9 +377,9 @@
         if (data.transform !is null) {
             size = data.transform.transformSize(size);
         }
-        CGFloat scaling = size.width;
+        Carbon.CGFloat scaling = size.width;
         if (scaling < 0) scaling = -scaling;
-        CGFloat strokeWidth = data.lineWidth * scaling;
+        Carbon.CGFloat strokeWidth = data.lineWidth * scaling;
         if (strokeWidth is 0 || (cast(size_t)strokeWidth % 2) is 1) {
             data.drawXOffset = 0.5f / scaling;
         }
@@ -664,12 +665,12 @@
 
 NSAttributedString createString(String string, int flags) {
     NSMutableDictionary dict = NSMutableDictionary.dictionaryWithCapacity(4);
-    CGFloat[] foreground = data.foreground;
+    Carbon.CGFloat[] foreground = data.foreground;
     NSColor color = NSColor.colorWithDeviceRed(foreground[0], foreground[1], foreground[2], data.alpha / 255f);
     dict.setObject(color, OS.NSForegroundColorAttributeName);
     dict.setObject(data.font.handle, OS.NSFontAttributeName);
     if ((flags & DWT.DRAW_TRANSPARENT) is 0) {
-        CGFloat[] background = data.background;
+        Carbon.CGFloat[] background = data.background;
         color = NSColor.colorWithDeviceRed(background[0], background[1], background[2], data.alpha / 255f);
         dict.setObject(color, OS.NSBackgroundColorAttributeName);
     }
@@ -738,7 +739,7 @@
     data.transform = data.inverseTransform = null;
     
     /* Dispose the GC */
-    if (drawable !is null) drawable.internal_dispose_GC(handle.id_, data);
+    if (drawable !is null) drawable.internal_dispose_GC(handle.id, data);
     handle.restoreGraphicsState();
     handle.release();
 
@@ -792,13 +793,13 @@
     try {
         handle.saveGraphicsState();
         NSAffineTransform transform = NSAffineTransform.transform();
-    CGFloat xOffset = data.drawXOffset, yOffset = data.drawYOffset;
+    Carbon.CGFloat xOffset = data.drawXOffset, yOffset = data.drawYOffset;
         transform.translateXBy(x + xOffset + width / 2f, y + yOffset + height / 2f);
         transform.scaleXBy(width / 2f, height / 2f);
         NSBezierPath path = data.path;
     NSPoint center = NSPoint();
-    CGFloat sAngle = -startAngle;
-    CGFloat eAngle = -(startAngle + arcAngle);
+    Carbon.CGFloat sAngle = -startAngle;
+    Carbon.CGFloat eAngle = -(startAngle + arcAngle);
         path.appendBezierPathWithArcWithCenter(center, 1, sAngle,  eAngle, arcAngle>0);
         path.transformUsingAffineTransform(transform);
         path.stroke();
@@ -948,7 +949,7 @@
         destRect.y = destY;
         destRect.width = destWidth;
         destRect.height = destHeight;
-    imageHandle.drawInRect(destRect, srcRect, NSCompositeSourceOver, 1);
+    imageHandle.drawInRect(destRect, srcRect, OS.NSCompositeSourceOver, 1);
         handle.restoreGraphicsState();
     } finally {
         uncheckGC(pool);
@@ -1522,14 +1523,14 @@
     try {
         handle.saveGraphicsState();
         NSAffineTransform transform = NSAffineTransform.transform();
-    CGFloat xOffset = data.drawXOffset, yOffset = data.drawYOffset;
+    Carbon.CGFloat xOffset = data.drawXOffset, yOffset = data.drawYOffset;
         transform.translateXBy(x + xOffset + width / 2f, y + yOffset + height / 2f);
         transform.scaleXBy(width / 2f, height / 2f);
         NSBezierPath path = data.path;
     NSPoint center = NSPoint();
         path.moveToPoint(center);
-    CGFloat sAngle = -startAngle;
-    CGFloat eAngle = -(startAngle + arcAngle);
+    Carbon.CGFloat sAngle = -startAngle;
+    Carbon.CGFloat eAngle = -(startAngle + arcAngle);
         path.appendBezierPathWithArcWithCenter(center, 1, sAngle,  eAngle, arcAngle>0);
         path.closePath();
         path.transformUsingAffineTransform(transform);
@@ -2104,29 +2105,29 @@
     }
     if (data.clipPath !is null) {
         NSBezierPath clip = data.clipPath.bezierPathByFlatteningPath();
-        int count = cast(int)/*64*/clip.elementCount();
+        NSInteger count = clip.elementCount();
         int pointCount = 0;
         Region clipRgn = new Region(device);
         int[] pointArray = new int[count * 2];
         NSPointArray points = cast(NSPointArray) OS.malloc(NSPoint.sizeof);
         if (points is null) DWT.error(DWT.ERROR_NO_HANDLES);
         NSPoint pt = NSPoint();
-        for (int  i = 0; i < count; i++) {
+        for (NSInteger  i = 0; i < count; i++) {
             NSBezierPathElement element = clip.elementAtIndex(i, points);
             switch (element) {
-                case NSMoveToBezierPathElement:
+                case OS.NSMoveToBezierPathElement:
                     if (pointCount !is 0) clipRgn.add(pointArray, pointCount);
                     pointCount = 0;
                     OS.memmove(&pt, points, NSPoint.sizeof);
                     pointArray[pointCount++] = cast(int)pt.x;
                     pointArray[pointCount++] = cast(int)pt.y;
                     break;
-                case NSLineToBezierPathElement:
+                case OS.NSLineToBezierPathElement:
                     OS.memmove(&pt, points, NSPoint.sizeof);
                     pointArray[pointCount++] = cast(int)pt.x;
                     pointArray[pointCount++] = cast(int)pt.y;
                     break;
-                case NSClosePathBezierPathElement:
+                case OS.NSClosePathBezierPathElement:
                     if (pointCount !is 0) clipRgn.add(pointArray, pointCount);
                     pointCount = 0;
                     break;
@@ -2296,9 +2297,9 @@
  */
 public LineAttributes getLineAttributes() {
     if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
-    CGFloat[] dashes = null;
+    Carbon.CGFloat[] dashes = null;
     if (data.lineDashes !is null) {
-        dashes = new CGFloat[data.lineDashes.length];
+        dashes = new Carbon.CGFloat[data.lineDashes.length];
         System.arraycopy(data.lineDashes, 0, dashes, 0, dashes.length);
     }
     return new LineAttributes(data.lineWidth, data.lineCap, data.lineJoin, data.lineStyle, dashes, data.lineDashesOffset, data.lineMiterLimit);
@@ -2505,7 +2506,7 @@
  * @see #equals
  */
 public hash_t toHash() {
-    return handle !is null ? cast(hash_t)handle.id_ : 0;
+    return handle !is null ? cast(hash_t)handle.id : 0;
 }
 
 alias toHash hashCode;
@@ -2524,7 +2525,7 @@
     handle.retain();
     handle.saveGraphicsState();
     data.path = NSBezierPath.bezierPath();
-    data.path.setWindingRule(data.fillRule is DWT.FILL_WINDING ? NSNonZeroWindingRule : NSEvenOddWindingRule);
+    data.path.setWindingRule(data.fillRule is DWT.FILL_WINDING ? OS.NSNonZeroWindingRule : OS.NSEvenOddWindingRule);
     data.path.retain();
 }
 
@@ -2814,7 +2815,7 @@
 public void setClipping(Path path) {
     if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
     if (path !is null && path.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT);
-    setClipping(new NSBezierPath(path.handle.copy().id_));
+    setClipping(new NSBezierPath(path.handle.copy().id));
 }
 
 /**
@@ -2900,7 +2901,7 @@
             DWT.error(DWT.ERROR_INVALID_ARGUMENT);
     }
     data.fillRule = rule;
-    data.path.setWindingRule(rule is DWT.FILL_WINDING ? NSNonZeroWindingRule : NSEvenOddWindingRule);
+    data.path.setWindingRule(rule is DWT.FILL_WINDING ? OS.NSNonZeroWindingRule : OS.NSEvenOddWindingRule);
 }
 
 /** 
@@ -3009,10 +3010,10 @@
     if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
     NSImageInterpolation quality;
     switch (interpolation) {
-        case DWT.DEFAULT: quality = NSImageInterpolationDefault; break;
-        case DWT.NONE: quality = NSImageInterpolationNone; break;
-        case DWT.LOW: quality = NSImageInterpolationLow; break;
-        case DWT.HIGH: quality = NSImageInterpolationHigh; break;
+        case DWT.DEFAULT: quality = OS.NSImageInterpolationDefault; break;
+        case DWT.NONE: quality = OS.NSImageInterpolationNone; break;
+        case DWT.LOW: quality = OS.NSImageInterpolationLow; break;
+        case DWT.HIGH: quality = OS.NSImageInterpolationHigh; break;
         default:
             DWT.error(DWT.ERROR_INVALID_ARGUMENT);
     }
@@ -3047,7 +3048,7 @@
     if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
     if (attributes is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
     int mask = 0;
-    CGFloat lineWidth = attributes.width;
+    Carbon.CGFloat lineWidth = attributes.width;
     if (lineWidth !is data.lineWidth) {
         mask |= LINE_WIDTH | DRAW_OFFSET;
     }
@@ -3092,8 +3093,8 @@
                 DWT.error(DWT.ERROR_INVALID_ARGUMENT);
         }
     }
-    CGFloat[] dashes = attributes.dash;
-    CGFloat[] lineDashes = data.lineDashes;
+    Carbon.CGFloat[] dashes = attributes.dash;
+    Carbon.CGFloat[] lineDashes = data.lineDashes;
     if (dashes !is null && dashes.length > 0) {
         bool changed = lineDashes is null || lineDashes.length !is dashes.length;
         for (int i = 0; i < dashes.length; i++) {
@@ -3102,7 +3103,7 @@
             if (!changed && lineDashes[i] !is dash) changed = true;
         }
         if (changed) {
-            CGFloat[] newDashes = new CGFloat[dashes.length];
+            Carbon.CGFloat[] newDashes = new Carbon.CGFloat[dashes.length];
             System.arraycopy(dashes, 0, newDashes, 0, dashes.length);
             dashes = newDashes;
             mask |= LINE_STYLE;
@@ -3116,7 +3117,7 @@
             dashes = lineDashes;
         }
     }
-    CGFloat dashOffset = attributes.dashOffset;
+    Carbon.CGFloat dashOffset = attributes.dashOffset;
     if (dashOffset !is data.lineDashesOffset) {
         mask |= LINE_STYLE;     
     }
@@ -3185,7 +3186,7 @@
  */
 public void setLineDash(int[] dashes) {
     if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
-    CGFloat[] lineDashes = data.lineDashes;
+    Carbon.CGFloat[] lineDashes = data.lineDashes;
     if (dashes !is null && dashes.length > 0) {
         bool changed = data.lineStyle !is DWT.LINE_CUSTOM || lineDashes is null || lineDashes.length !is dashes.length;
         for (int i = 0; i < dashes.length; i++) {
@@ -3194,7 +3195,7 @@
             if (!changed && lineDashes[i] !is dash) changed = true;
         }
         if (!changed) return;
-        data.lineDashes = new CGFloat[dashes.length];
+        data.lineDashes = new Carbon.CGFloat[dashes.length];
         for (int i = 0; i < dashes.length; i++) {
             data.lineDashes[i] = dashes[i];
         }
@@ -3513,7 +3514,7 @@
 void uncheckGC(NSAutoreleasePool pool) {
     NSView view = data.view;
     if (view !is null && data.paintRect is null) {
-        if (data.thread !is Thread.currentThread()) flush();
+        if (data.thread !is Thread.getThis()) flush();
     }
     if (pool !is null) pool.release();
 }
--- a/dwt/graphics/Path.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/graphics/Path.d	Mon Dec 22 15:10:19 2008 +0100
@@ -158,7 +158,7 @@
         if (path.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT);
         flatness = Math.max(0, flatness);
         if (flatness is 0) {
-        handle = new NSBezierPath(path.handle.copy().id_);
+        handle = new NSBezierPath(path.handle.copy().id);
         } else {
             CGFloat defaultFlatness = NSBezierPath.defaultFlatness();
             NSBezierPath.setDefaultFlatness(flatness);
@@ -564,19 +564,19 @@
     for (NSInteger i = 0; i < count; i++) {
         NSBezierPathElement element = handle.elementAtIndex(i, points);
             switch (element) {
-            case NSMoveToBezierPathElement:
+            case OS.NSMoveToBezierPathElement:
                     types[typeCount++] = DWT.PATH_MOVE_TO;
                 OS.memmove(&pt, points, NSPoint.sizeof);
                 pointArray[pointCount++] = cast(int)pt.x;
                 pointArray[pointCount++] = cast(int)pt.y;
                     break;
-            case NSLineToBezierPathElement:
+            case OS.NSLineToBezierPathElement:
                     types[typeCount++] = DWT.PATH_LINE_TO;
                 OS.memmove(&pt, points, NSPoint.sizeof);
                 pointArray[pointCount++] = cast(int)pt.x;
                 pointArray[pointCount++] = cast(int)pt.y;
                     break;
-            case NSCurveToBezierPathElement:
+            case OS.NSCurveToBezierPathElement:
                     types[typeCount++] = DWT.PATH_CUBIC_TO;
                 OS.memmove(&pt, points, NSPoint.sizeof);
                 pointArray[pointCount++] = cast(int)pt.x;
@@ -588,7 +588,7 @@
                 pointArray[pointCount++] = cast(int)pt.x;
                 pointArray[pointCount++] = cast(int)pt.y;
                     break;
-            case NSClosePathBezierPathElement:
+            case OS.NSClosePathBezierPathElement:
                     types[typeCount++] = DWT.PATH_CLOSE;
                     break;
             }
--- a/dwt/graphics/Pattern.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/graphics/Pattern.d	Mon Dec 22 15:10:19 2008 +0100
@@ -233,7 +233,7 @@
  */
 public String toString() {
     if (isDisposed()) return "Pattern {*DISPOSED*}";
-    return Format("Pattern {{}{}" , (color !is null ? color.id_ : gradient.id_) , "}");
+    return Format("Pattern {{}{}" , (color !is null ? color.id : gradient.id) , "}");
 }
     
 }
--- a/dwt/graphics/Region.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/graphics/Region.d	Mon Dec 22 15:10:19 2008 +0100
@@ -460,14 +460,14 @@
 NSBezierPath getPath() {
     NSBezierPath path = NSBezierPath.bezierPath();
     path.retain();
-    OS.QDRegionToRects(handle, OS.kQDParseRegionFromTopLeft, &Region.regionToRects, path.id);
+    OS.QDRegionToRects(handle, OS.kQDParseRegionFromTopLeft, cast(Carbon.RegionToRectsUPP) &Region.regionToRects, path.id);
     if (path.isEmpty()) path.appendBezierPathWithRect(NSRect());
     return path;
 }
 
 static NSPoint pt = NSPoint();
 static Carbon.Rect rect;
-extern(C) private static Carbon.OSStatus regionToRects(ushort message, Carbon.RgnHandle rgn, Carbon.Rect* r, void* path) {
+extern(C) private static Carbon.OSStatus regionToRects(ushort message, Carbon.RgnHandle rgn, Carbon.Rect* r, objc.id path) {
     if (message is OS.kQDRegionToRectsMsgParse) {
         OS.memmove(&rect, r, rect.sizeof);
         pt.x = rect.left;
--- a/dwt/graphics/TextLayout.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/graphics/TextLayout.d	Mon Dec 22 15:10:19 2008 +0100
@@ -50,7 +50,7 @@
 import dwt.graphics.Region;
 import dwt.graphics.Resource;
 import dwt.graphics.TextStyle;
-import dwt.internal.c.Carbon;
+import Carbon = dwt.internal.c.Carbon;
 import dwt.internal.cocoa.NSText;
 import dwt.internal.objc.cocoa.Cocoa;
 
@@ -94,7 +94,7 @@
     int[] lineOffsets;
     NSRect[] lineBounds;
     
-    static final int UNDERLINE_THICK = 1 << 16;
+    static const int UNDERLINE_THICK = 1 << 16;
 
     static class StyleItem {
         TextStyle style;
@@ -149,10 +149,10 @@
     if (peaks is 0 && right - left > 2) {
         peaks = 1;
     }
-    int length = ((2 * peaks) + 1) * 2;
-    if (length < 0) return new float[0];
+    int length_ = ((2 * peaks) + 1) * 2;
+    if (length_ < 0) return new float[0];
     
-    float[] coordinates = new float[length];
+    float[] coordinates = new float[length_];
     for (int i = 0; i < peaks; i++) {
         int index = 4 * i;
         coordinates[index] = left + (width * i);
@@ -160,8 +160,8 @@
         coordinates[index+2] = coordinates[index] + width / 2;
         coordinates[index+3] = top;
     }
-    coordinates[length-2] = left + (width * peaks);
-    coordinates[length-1] = bottom;
+    coordinates[length_-2] = left + (width * peaks);
+    coordinates[length_-1] = bottom;
     return coordinates;
 }
 
@@ -186,16 +186,16 @@
     textStorage.addAttribute(OS.NSFontAttributeName, defaultFont.handle, range);
     
     NSMutableParagraphStyle paragraph = cast(NSMutableParagraphStyle)(new NSMutableParagraphStyle()).alloc().init();
-    NSTextAlignment align_ = NSLeftTextAlignment;
+    NSTextAlignment align_ = OS.NSLeftTextAlignment;
     if (justify) {
-        align_ = NSJustifiedTextAlignment;
+        align_ = OS.NSJustifiedTextAlignment;
     } else {
         switch (alignment) {
             case DWT.CENTER:
-                align_ = NSCenterTextAlignment;
+                align_ = OS.NSCenterTextAlignment;
                 break;
             case DWT.RIGHT:
-                align_ = NSRightTextAlignment;
+                align_ = OS.NSRightTextAlignment;
         }
     }
     paragraph.setAlignment(align_);
@@ -287,6 +287,7 @@
     int numberOfLines;
     NSUInteger numberOfGlyphs = layoutManager.numberOfGlyphs(), index;
     NSRangePointer rangePtr = cast(NSRangePointer) OS.malloc(NSRange.sizeof);
+    NSRange lineRange = NSRange();
     for (numberOfLines = 0, index = 0; index < numberOfGlyphs; numberOfLines++){
         layoutManager.lineFragmentUsedRectForGlyphAtIndex(index, rangePtr, true);
         OS.memmove(&lineRange, rangePtr, NSRange.sizeof);
@@ -297,7 +298,7 @@
     NSRect[] bounds = new NSRect[numberOfLines];
     for (numberOfLines = 0, index = 0; index < numberOfGlyphs; numberOfLines++){
         bounds[numberOfLines] = layoutManager.lineFragmentUsedRectForGlyphAtIndex(index, rangePtr, true);
-        if (numberOfLines < bounds.length - 1) bounds[numberOfLines].height -= spacing;
+        if (numberOfLines < bounds.length - 1) bounds[numberOfLines].height = bounds[numberOfLines].height - spacing;
         OS.memmove(&lineRange, rangePtr, NSRange.sizeof);
         offsets[numberOfLines] = cast(int)/*64*/lineRange.location;
         index = lineRange.location + lineRange.length;
@@ -415,7 +416,7 @@
             selectionColor = NSColor.colorWithDeviceRed(selectionBackground.handle[0], selectionBackground.handle[1], selectionBackground.handle[2], selectionBackground.handle[3]);
         }
         if (hasSelection) {
-            selectionRange = NSRange();
+            selectionRange = &NSRange();
             selectionRange.location = selectionStart;
             selectionRange.length = selectionEnd - selectionStart + 1;
         layoutManager.addTemporaryAttribute(OS.NSBackgroundColorAttributeName, selectionColor, *selectionRange);
@@ -478,7 +479,7 @@
                                     path.setLineWidth(2f);
                                     path.setLineCapStyle(OS.NSRoundLineCapStyle);
                                     path.setLineJoinStyle(OS.NSRoundLineJoinStyle);
-                                    path.setLineDash([1, 3f], 2, 0);
+                                    path.setLineDash([1f, 3f].ptr, 2, cast(Carbon.CGFloat) 0);
                                     point.x = underlineX;
                                     point.y = underlineY + 0.5f;
                                     path.moveToPoint(point);
@@ -525,25 +526,25 @@
                             if (range.length > 0) {
                                 gc.handle.saveGraphicsState();
                                 NSRect rect = layoutManager.boundingRectForGlyphRange(range, textContainer);
-                                rect.x += pt.x + 0.5f;
-                                rect.y += pt.y + 0.5f;
-                                rect.width -= 0.5f;
-                                rect.height -= 0.5f;
-                                float[] color = null;
+                                rect.x = rect.x + pt.x + 0.5f;
+                                rect.y = rect.y + pt.y + 0.5f;
+                                rect.width = rect.width - 0.5f;
+                                rect.height = rect.height - 0.5f;
+                                Carbon.CGFloat[] color = null;
                                 if (style.borderColor !is null) color = style.borderColor.handle;
                                 if (color is null && style.foreground !is null) color = style.foreground.handle;
                                 if (color !is null) {
                                     NSColor.colorWithDeviceRed(color[0], color[1], color[2], color[3]).setStroke();
                                 }
                                 int width = 1;
-                                float[] dashes = null;
+                                Carbon.CGFloat[] dashes = null;
                                 switch (style.borderStyle) {
                                 case DWT.BORDER_SOLID:  break;
                                 case DWT.BORDER_DASH: dashes = width !is 0 ? GC.LINE_DASH : GC.LINE_DASH_ZERO; break;
                                 case DWT.BORDER_DOT: dashes = width !is 0 ? GC.LINE_DOT : GC.LINE_DOT_ZERO; break;
                                 }
                                 NSBezierPath path = NSBezierPath.bezierPath();
-                                path.setLineDash(dashes, dashes !is null ? dashes.length : 0, 0);
+                                path.setLineDash(dashes.ptr, dashes !is null ? dashes.length : 0, 0);
                                 path.appendBezierPathWithRect(rect);
                                 path.stroke();
                                 gc.handle.restoreGraphicsState();
@@ -970,7 +971,7 @@
         if (length is 0) return new Point(0, 0);
         offset = translateOffset(offset);
     NSUInteger glyphIndex = layoutManager.glyphIndexForCharacterAtIndex(offset);
-    NSRect rect = layoutManager.lineFragmentUsedRectForGlyphAtIndex_effectiveRange_(glyphIndex, null);
+    NSRect rect = layoutManager.lineFragmentUsedRectForGlyphAtIndex(glyphIndex, null);
         NSPoint point = layoutManager.locationForGlyphAtIndex(glyphIndex);
         if (trailing) {
         NSRange range = NSRange();
@@ -1119,7 +1120,7 @@
     NSPoint pt = NSPoint();
         pt.x = x;
         pt.y = y;
-    CGFloat partialFration;
+    Carbon.CGFloat partialFration;
     NSUInteger glyphIndex = layoutManager.glyphIndexForPoint(pt, textContainer, &partialFration);
         NSUInteger offset = layoutManager.characterIndexForGlyphAtIndex(glyphIndex);
     if (trailing !is null) trailing[0] = cast(int) Math.round(partialFration);
--- a/dwt/internal/Platform.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/Platform.d	Mon Dec 22 15:10:19 2008 +0100
@@ -19,5 +19,10 @@
 public class Platform {
     
 public static const String PLATFORM = "cocoa"; //$NON-NLS-1$
-public static final Lock lock = new Lock ();
+public static const Lock lock;
+    
+    static this ()
+    {
+        lock = new Lock ();
+    }
 }
--- a/dwt/internal/c/Carbon.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/c/Carbon.d	Mon Dec 22 15:10:19 2008 +0100
@@ -271,11 +271,7 @@
 alias bindings.GetCurrentProcess GetCurrentProcess;
 alias bindings.SetFrontProcess SetFrontProcess;
 alias bindings.TransformProcessType TransformProcessType;
-
-short CPSSetProcessName (CPSProcessSerNum* PSN, String processname)
-{
-	return bindings.CPSSetProcessName(PSN, processname.ptr);
-}
+alias bindings.CPSSetProcessName CPSSetProcessName;
 
 
 
--- a/dwt/internal/c/bindings.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/c/bindings.d	Mon Dec 22 15:10:19 2008 +0100
@@ -43,7 +43,7 @@
 
 
 // Processes.h
-short CPSSetProcessName (CPSProcessSerNum* PSN, char* processname);
+short CPSSetProcessName (ProcessSerialNumber* PSN, char* processname);
 short GetCurrentProcess (ProcessSerialNumber* PSN);
 short SetFrontProcess (/*const*/ ProcessSerialNumber* PSN);
 int TransformProcessType (/*const*/ ProcessSerialNumber* psn, ProcessApplicationTransformState transformState);
--- a/dwt/internal/cocoa/CGPoint.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/CGPoint.d	Mon Dec 22 15:10:19 2008 +0100
@@ -15,7 +15,14 @@
 
 import dwt.internal.c.Carbon;
 
+/* this shouldn't be needed but CGFloat is not recognized*/
+static if ((void*).sizeof > int.sizeof) // 64bit target
+    alias double CGFloat;
+    
+else
+    alias float CGFloat;
+
 struct CGPoint {
-    CGFloat x;
-    CGFloat y;
+    CGFloat x = 0.0;
+    CGFloat y = 0.0;
 }
\ No newline at end of file
--- a/dwt/internal/cocoa/CGSize.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/CGSize.d	Mon Dec 22 15:10:19 2008 +0100
@@ -13,7 +13,7 @@
  *******************************************************************************/
 module dwt.internal.cocoa.CGSize;
 
-import dwt.internal.cocoa.CGFloat;
+import dwt.internal.c.Carbon;
 
 extern (C):
 
--- a/dwt/internal/cocoa/NSActionCell.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSActionCell.d	Mon Dec 22 15:10:19 2008 +0100
@@ -18,8 +18,8 @@
 import cocoa = dwt.internal.cocoa.id;
 import dwt.internal.cocoa.NSCell;
 import dwt.internal.cocoa.NSImage;
-import dwt.internal.cocoa.NSText;
 import dwt.internal.cocoa.OS;
+import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
 public class NSActionCell : NSCell {
--- a/dwt/internal/cocoa/NSAffineTransform.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSAffineTransform.d	Mon Dec 22 15:10:19 2008 +0100
@@ -45,7 +45,7 @@
 
 public NSAffineTransform initWithTransform (NSAffineTransform transform)
 {
-    objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithTransform_1, transform !is null ? transform.id : null);
+    objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithTransform_, transform !is null ? transform.id : null);
     return result !is null ? this : null;
 }
 
@@ -57,15 +57,15 @@
 
 public void prependTransform (NSAffineTransform transform)
 {
-    OS.objc_msgSend(this.id, OS.sel_prependTransform_1, transform !is null ? transform.id : null);
+    OS.objc_msgSend(this.id, OS.sel_prependTransform_, transform !is null ? transform.id : null);
 }
 
 
-public void rotateByDegrees(float /*double*/ angle) {
+public void rotateByDegrees(CGFloat angle) {
     OS.objc_msgSend(this.id, OS.sel_rotateByDegrees_, angle);
 }
 
-public void scaleXBy(float /*double*/ scaleX, float /*double*/ scaleY) {
+public void scaleXBy(CGFloat scaleX, CGFloat scaleY) {
     OS.objc_msgSend(this.id, OS.sel_scaleXBy_yBy_, scaleX, scaleY);
 }
 
@@ -75,7 +75,7 @@
 
 public void setTransformStruct (NSAffineTransformStruct transformStruct)
 {
-    OS.objc_msgSend(this.id, OS.sel_setTransformStruct_1, transformStruct);
+    OS.objc_msgSend(this.id, OS.sel_setTransformStruct_, transformStruct);
 }
 
 public static NSAffineTransform transform ()
@@ -87,27 +87,27 @@
 public NSPoint transformPoint (NSPoint aPoint)
 {
     NSPoint result;
-    OS.objc_msgSend_stret(result, this.id, OS.sel_transformPoint_1, aPoint);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_transformPoint_, aPoint);
     return result;
 }
 
 public NSSize transformSize (NSSize aSize)
 {
     NSSize result;
-    OS.objc_msgSend_stret(result, this.id, OS.sel_transformSize_1, aSize);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_transformSize_, aSize);
     return result;
 }
 
 public NSAffineTransformStruct transformStruct ()
 {
     NSAffineTransformStruct result;
-    OS.objc_msgSend_stret(result, this.id, OS.sel_transformStruct);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_transformStruct);
     return result;
 }
 
 public void translateXBy (CGFloat deltaX, CGFloat deltaY)
 {
-    OS.objc_msgSend(this.id, OS.sel_translateXBy_1yBy_1, deltaX, deltaY);
+    OS.objc_msgSend(this.id, OS.sel_translateXBy_yBy_, deltaX, deltaY);
 }
 
 }
--- a/dwt/internal/cocoa/NSAlert.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSAlert.d	Mon Dec 22 15:10:19 2008 +0100
@@ -26,13 +26,6 @@
 import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
-enum NSAlertStyle : NSUInteger
-{
-    NSWarningAlertStyle = 0,
-    NSInformationalAlertStyle = 1,
-    NSCriticalAlertStyle = 2
-}
-
 public class NSAlert : NSObject {
 
 public this () {
--- a/dwt/internal/cocoa/NSArray.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSArray.d	Mon Dec 22 15:10:19 2008 +0100
@@ -49,7 +49,7 @@
 }
 
 public NSUInteger count() {
-    return OS.objc_msgSend(this.id, OS.sel_count);
+    return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_count);
 }
 
 public cocoa.id objectAtIndex(NSUInteger index) {
--- a/dwt/internal/cocoa/NSAttributedString.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSAttributedString.d	Mon Dec 22 15:10:19 2008 +0100
@@ -47,7 +47,7 @@
 
 public NSRange doubleClickAtIndex(int /*long*/ location) {
     NSRange result = NSRange();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_doubleClickAtIndex_, location);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_doubleClickAtIndex_, location);
     return result;
 }
 
@@ -64,13 +64,13 @@
     return result is this.id ? this : (result !is null ? new NSAttributedString(result) : null);
 }
 
-public int /*long*/ nextWordFromIndex(int /*long*/ location, bool isForward) {
-    return OS.objc_msgSend(this.id, OS.sel_nextWordFromIndex_forward_, location, isForward);
+public NSUInteger nextWordFromIndex(NSUInteger location, bool isForward) {
+    return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_nextWordFromIndex_forward_, location, isForward);
 }
 
 public NSSize size() {
     NSSize result = NSSize();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_size);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_size);
     return result;
 }
 
@@ -85,7 +85,7 @@
 }
 
 public NSUInteger length() {
-    return OS.objc_msgSend(this.id, OS.sel_length);
+    return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_length);
 }
 
 public NSString string() {
--- a/dwt/internal/cocoa/NSBezierPath.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSBezierPath.d	Mon Dec 22 15:10:19 2008 +0100
@@ -25,34 +25,6 @@
 import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
-enum NSBezierPathElement
-{
-    NSMoveToBezierPathElement,
-    NSLineToBezierPathElement,
-    NSCurveToBezierPathElement,
-    NSClosePathBezierPathElement
-}
-
-enum NSLineCapStyle
-{
-    NSButtLineCapStyle = 0,
-    NSRoundLineCapStyle = 1,
-    NSSquareLineCapStyle = 2
-}
-
-enum NSLineJoinStyle
-{
-    NSMiterLineJoinStyle = 0,
-    NSRoundLineJoinStyle = 1,
-    NSBevelLineJoinStyle = 2
-}
-
-enum NSWindingRule
-{
-    NSNonZeroWindingRule = 0,
-    NSEvenOddWindingRule = 1
-}
-
 public class NSBezierPath : NSObject {
 
 public this() {
@@ -116,7 +88,7 @@
 
 public NSRect bounds() {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_bounds);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_bounds);
     return result;
 }
 
@@ -130,13 +102,13 @@
 
 public NSRect controlPointBounds() {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_controlPointBounds);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_controlPointBounds);
     return result;
 }
 
 public NSPoint currentPoint() {
     NSPoint result = NSPoint();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_currentPoint);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_currentPoint);
     return result;
 }
 
--- a/dwt/internal/cocoa/NSBitmapImageRep.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSBitmapImageRep.d	Mon Dec 22 15:10:19 2008 +0100
@@ -26,23 +26,6 @@
 import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
-enum NSTIFFCompression : NSUInteger {
-    NSTIFFCompressionNone = 1,
-    NSTIFFCompressionCCITTFAX3 = 3,
-    NSTIFFCompressionCCITTFAX4 = 4,
-    NSTIFFCompressionLZW = 5,
-    NSTIFFCompressionJPEG = 6,
-    NSTIFFCompressionNEXT = 32766,
-    NSTIFFCompressionPackBits = 32773,
-    NSTIFFCompressionOldJPEG = 32865
-}
-
-enum NSBitmapFormat : NSUInteger {
-    NSAlphaFirstBitmapFormat = 1 << 0,
-    NSAlphaNonpremultipliedBitmapFormat = 1 << 1,
-    NSFloatingPointSamplesBitmapFormat = 1 << 2
-}
-
 public class NSBitmapImageRep : NSImageRep {
     
 public this () {
--- a/dwt/internal/cocoa/NSBox.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSBox.d	Mon Dec 22 15:10:19 2008 +0100
@@ -66,7 +66,7 @@
 
 public NSSize contentViewMargins () {
     NSSize result;
-    OS.objc_msgSend_stret(result, this.id, OS.sel_contentViewMargins);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_contentViewMargins);
     return result;
 }
 
--- a/dwt/internal/cocoa/NSButton.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSButton.d	Mon Dec 22 15:10:19 2008 +0100
@@ -76,7 +76,7 @@
 }
 
 public NSInteger state() {
-    return OS.objc_msgSend(this.id, OS.sel_state);
+    return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_state);
 }
 
 public static objc.Class cellClass() {
--- a/dwt/internal/cocoa/NSButtonCell.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSButtonCell.d	Mon Dec 22 15:10:19 2008 +0100
@@ -22,36 +22,6 @@
 import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
-enum NSBezelStyle : NSUInteger {
-    NSRoundedBezelStyle = 1,
-    NSRegularSquareBezelStyle = 2,
-    NSThickSquareBezelStyle = 3,
-    NSThickerSquareBezelStyle = 4,
-    NSDisclosureBezelStyle = 5,
-    NSShadowlessSquareBezelStyle = 6,
-    NSCircularBezelStyle = 7,
-    NSTexturedSquareBezelStyle = 8,
-    NSHelpButtonBezelStyle = 9,
-    NSSmallSquareBezelStyle = 10,
-    NSTexturedRoundedBezelStyle = 11,
-    NSRoundRectBezelStyle = 12,
-    NSRecessedBezelStyle = 13,
-    NSRoundedDisclosureBezelStyle = 14,
-}
-
-enum NSButtonType : NSUInteger {
-    NSMomentaryLightButton = 0,
-    NSPushOnPushOffButton = 1,
-    NSToggleButton = 2,
-    NSSwitchButton = 3,
-    NSRadioButton = 4,
-    NSMomentaryChangeButton = 5,
-    NSOnOffButton = 6,
-    NSMomentaryPushInButton = 7,
-    NSMomentaryPushButton = 0,
-    NSMomentaryLight = 7
-}
-
 public class NSButtonCell : NSActionCell {
 
 public this() {
--- a/dwt/internal/cocoa/NSCalendarDate.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSCalendarDate.d	Mon Dec 22 15:10:19 2008 +0100
@@ -70,8 +70,8 @@
     return result !is null ? new NSTimeZone(result) : null;
 }
 
-public int /*long*/yearOfCommonEra() {
-    return OS.objc_msgSend(this.id, OS.sel_yearOfCommonEra);
+public NSInteger yearOfCommonEra() {
+    return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_yearOfCommonEra);
 }
 
 public static NSDate dateWithTimeIntervalSinceNow(double secs) {
--- a/dwt/internal/cocoa/NSCell.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSCell.d	Mon Dec 22 15:10:19 2008 +0100
@@ -28,32 +28,6 @@
 import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
-enum NSControlSize : NSUInteger
-{
-    NSRegularControlSize,
-    NSSmallControlSize,
-    NSMiniControlSize
-}
-
-enum NSImageScaling : NSUInteger
-{
-    NSImageScaleProportionallyDown = 0,
-    NSImageScaleAxesIndependently,
-    NSImageScaleNone,
-    NSImageScaleProportionallyUpOrDown
-}
-
-enum NSCellImagePosition : NSUInteger
-{
-    NSNoImage       = 0,
-    NSImageOnly     = 1,
-    NSImageLeft     = 2,
-    NSImageRight    = 3,
-    NSImageBelow    = 4,
-    NSImageAbove    = 5,
-    NSImageOverlaps = 6
-}
-
 public class NSCell : NSObject {
 
 public this() {
@@ -70,7 +44,7 @@
 
 public NSSize cellSizeForBounds(NSRect aRect) {
     NSSize result = NSSize();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_cellSizeForBounds_, aRect);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_cellSizeForBounds_, aRect);
     return result;
 }
 
@@ -80,7 +54,7 @@
 
 public NSRect drawingRectForBounds(NSRect theRect) {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_drawingRectForBounds_, theRect);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_drawingRectForBounds_, theRect);
     return result;
 }
 
@@ -128,7 +102,7 @@
 
 public NSRect titleRectForBounds(NSRect theRect) {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_titleRectForBounds_, theRect);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_titleRectForBounds_, theRect);
     return result;
 }
 
--- a/dwt/internal/cocoa/NSColor.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSColor.d	Mon Dec 22 15:10:19 2008 +0100
@@ -72,7 +72,7 @@
 }
 
 public static NSColor colorWithDeviceRed(CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha) {
-    objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_colorWithDeviceRed_green_blue_alpha_, red, green, blue, alpha);
+    objc.id result = objc.objc_msgSend(OS.class_NSColor, OS.sel_colorWithDeviceRed_green_blue_alpha_, red, green, blue, alpha);
     return result !is null ? new NSColor(result) : null;
 }
 
@@ -111,7 +111,7 @@
     return result !is null ? new NSColor(result) : null;
 }
 
-public void getComponents(float[] /*double[]*/ components) {
+public void getComponents(CGFloat* components) {
     OS.objc_msgSend(this.id, OS.sel_getComponents_, components);
 }
 
--- a/dwt/internal/cocoa/NSControl.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSControl.d	Mon Dec 22 15:10:19 2008 +0100
@@ -22,6 +22,7 @@
 import dwt.internal.cocoa.NSText;
 import dwt.internal.cocoa.NSView;
 import dwt.internal.cocoa.OS;
+import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
 public class NSControl : NSView {
@@ -116,7 +117,7 @@
 
 public cocoa.id target() {
     objc.id result = OS.objc_msgSend(this.id, OS.sel_target);
-    return result !is null ? new id(result) : null;
+    return result !is null ? new cocoa.id(result) : null;
 }
 
 }
--- a/dwt/internal/cocoa/NSData.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSData.d	Mon Dec 22 15:10:19 2008 +0100
@@ -38,7 +38,7 @@
     return cast(/*const*/void*) OS.objc_msgSend(this.id, OS.sel_bytes);
 }
 
-public static NSData dataWithBytes(/*const*/void*, NSUInteger length) {
+public static NSData dataWithBytes(/*const*/void* bytes, NSUInteger length) {
     objc.id result = OS.objc_msgSend(OS.class_NSData, OS.sel_dataWithBytes_length_, bytes, length);
     return result !is null ? new NSData(result) : null;
 }
@@ -52,7 +52,7 @@
 }
 
 public NSUInteger length() {
-    return OS.objc_msgSend(this.id, OS.sel_length);
+    return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_length);
 }
 
 }
--- a/dwt/internal/cocoa/NSDictionary.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSDictionary.d	Mon Dec 22 15:10:19 2008 +0100
@@ -63,7 +63,7 @@
 
 public cocoa.id valueForKey(NSString key) {
     objc.id result = OS.objc_msgSend(this.id, OS.sel_valueForKey_, key !is null ? key.id : null);
-    return result !is null ? new id(result) : null;
+    return result !is null ? new cocoa.id(result) : null;
 }
 
 }
--- a/dwt/internal/cocoa/NSEvent.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSEvent.d	Mon Dec 22 15:10:19 2008 +0100
@@ -26,33 +26,6 @@
 import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
-enum NSEventType
-{
-    NSLeftMouseDown      = 1,
-    NSLeftMouseUp        = 2,
-    NSRightMouseDown     = 3,
-    NSRightMouseUp       = 4,
-    NSMouseMoved         = 5,
-    NSLeftMouseDragged   = 6,
-    NSRightMouseDragged  = 7,
-    NSMouseEntered       = 8,
-    NSMouseExited        = 9,
-    NSKeyDown            = 10,
-    NSKeyUp              = 11,
-    NSFlagsChanged       = 12,
-    NSAppKitDefined      = 13,
-    NSSystemDefined      = 14,
-    NSApplicationDefined = 15,
-    NSPeriodic           = 16,
-    NSCursorUpdate       = 17,
-    NSScrollWheel        = 22,
-    NSTabletPoint        = 23,
-    NSTabletProximity    = 24,
-    NSOtherMouseDown     = 25,
-    NSOtherMouseUp       = 26,
-    NSOtherMouseDragged  = 27
-}
-
 public class NSEvent : NSObject {
 
 public this() {
@@ -68,7 +41,7 @@
 }
 
 public NSInteger buttonNumber() {
-    return OS.objc_msgSend(this.id, OS.sel_buttonNumber);
+    return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_buttonNumber);
 }
 
 public NSString characters() {
@@ -99,7 +72,7 @@
 
 public NSPoint locationInWindow() {
     NSPoint result = NSPoint();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_locationInWindow);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_locationInWindow);
     return result;
 }
 
@@ -109,7 +82,7 @@
 
 public static NSPoint mouseLocation() {
     NSPoint result = NSPoint();
-    OS.objc_msgSend_stret(result, OS.class_NSEvent, OS.sel_mouseLocation);
+    OS.objc_msgSend_stret(&result, OS.class_NSEvent, OS.sel_mouseLocation);
     return result;
 }
 
@@ -119,7 +92,7 @@
 }
 
 public NSEventType type() {
-    return OS.objc_msgSend(this.id, OS.sel_type);
+    return cast(NSEventType) OS.objc_msgSend(this.id, OS.sel_type);
 }
 
 public NSWindow window() {
--- a/dwt/internal/cocoa/NSFont.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSFont.d	Mon Dec 22 15:10:19 2008 +0100
@@ -20,6 +20,7 @@
 import dwt.internal.cocoa.NSObject;
 import dwt.internal.cocoa.NSString;
 import dwt.internal.cocoa.OS;
+import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
 alias uint NSGlyph;
--- a/dwt/internal/cocoa/NSGradient.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSGradient.d	Mon Dec 22 15:10:19 2008 +0100
@@ -24,12 +24,6 @@
 import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
-enum NSGradientDrawingOptions : NSUInteger
-{
-    NSGradientDrawsBeforeStartingLocation = (1 << 0),
-    NSGradientDrawsAfterEndingLocation = (1 << 1),
-}
-
 public class NSGradient : NSObject {
 
 public this() {
--- a/dwt/internal/cocoa/NSGraphicsContext.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSGraphicsContext.d	Mon Dec 22 15:10:19 2008 +0100
@@ -23,14 +23,6 @@
 import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
-enum NSImageInterpolation
-{
-    NSImageInterpolationDefault,
-    NSImageInterpolationNone,
-    NSImageInterpolationLow,
-    NSImageInterpolationHigh
-} 
-
 public class NSGraphicsContext : NSObject {
 
 public this() {
--- a/dwt/internal/cocoa/NSImage.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSImage.d	Mon Dec 22 15:10:19 2008 +0100
@@ -28,14 +28,6 @@
 import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
-enum NSImageCacheMode
-{
-    NSImageCacheDefault,
-    NSImageCacheAlways,
-    NSImageCacheBySize,
-    NSImageCacheNever
-} 
-
 public class NSImage : NSObject {
 
 public this() {
@@ -79,7 +71,7 @@
 
 public cocoa.id initWithData(NSData data) {
     objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithData_, data !is null ? data.id : null);
-    return result !is null ? new id(result) : null;
+    return result !is null ? new cocoa.id(result) : null;
 }
 
 public NSImage initWithSize(NSSize aSize) {
@@ -97,7 +89,7 @@
 
 public NSSize size() {
     NSSize result = NSSize();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_size);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_size);
     return result;
 }
 
--- a/dwt/internal/cocoa/NSImageView.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSImageView.d	Mon Dec 22 15:10:19 2008 +0100
@@ -20,6 +20,7 @@
 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;
 
 public class NSImageView : NSControl {
@@ -49,7 +50,7 @@
 }
 
 public static objc.Class cellClass() {
-    return OS.objc_msgSend(OS.class_NSImageView, OS.sel_cellClass);
+    return cast(objc.Class) OS.objc_msgSend(OS.class_NSImageView, OS.sel_cellClass);
 }
 
 public static void setCellClass(objc.Class factoryId) {
--- a/dwt/internal/cocoa/NSLayoutManager.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSLayoutManager.d	Mon Dec 22 15:10:19 2008 +0100
@@ -52,7 +52,7 @@
 
 public NSRect boundingRectForGlyphRange(NSRange glyphRange, NSTextContainer container) {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_boundingRectForGlyphRange_inTextContainer_, glyphRange, container !is null ? container.id : null);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_boundingRectForGlyphRange_inTextContainer_, glyphRange, container !is null ? container.id : null);
     return result;
 }
 
@@ -73,7 +73,7 @@
 }
 
 public NSUInteger getGlyphs(NSGlyph* glyphArray, NSRange glyphRange) {
-    return OS.objc_msgSend(this.id, OS.sel_getGlyphs_range_, glyphArray, glyphRange);
+    return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_getGlyphs_range_, glyphArray, glyphRange);
 }
 
 public NSUInteger glyphIndexForCharacterAtIndex(NSUInteger charIndex) {
@@ -81,30 +81,30 @@
 }
 
 public NSUInteger glyphIndexForPoint(NSPoint point, NSTextContainer container, CGFloat* partialFraction) {
-    return OS.objc_msgSend(this.id, OS.sel_glyphIndexForPoint_inTextContainer_fractionOfDistanceThroughGlyph_, point, container !is null ? container.id : null, partialFraction);
+    return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_glyphIndexForPoint_inTextContainer_fractionOfDistanceThroughGlyph_, point, container !is null ? container.id : null, partialFraction);
 }
 
 public NSRange glyphRangeForTextContainer(NSTextContainer container) {
     NSRange result = NSRange();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_glyphRangeForTextContainer_, container !is null ? container.id : null);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_glyphRangeForTextContainer_, container !is null ? container.id : null);
     return result;
 }
 
 public NSRect lineFragmentUsedRectForGlyphAtIndex(NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange) {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_lineFragmentUsedRectForGlyphAtIndex_effectiveRange_, glyphIndex, effectiveGlyphRange);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_lineFragmentUsedRectForGlyphAtIndex_effectiveRange_, glyphIndex, effectiveGlyphRange);
     return result;
 }
 
 public NSRect lineFragmentUsedRectForGlyphAtIndex(NSUInteger glyphIndex, NSRangePointer effectiveGlyphRange, bool flag) {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_lineFragmentUsedRectForGlyphAtIndex_effectiveRange_withoutAdditionalLayout_, glyphIndex, effectiveGlyphRange, flag);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_lineFragmentUsedRectForGlyphAtIndex_effectiveRange_withoutAdditionalLayout_, glyphIndex, effectiveGlyphRange, flag);
     return result;
 }
 
 public NSPoint locationForGlyphAtIndex(NSUInteger glyphIndex) {
     NSPoint result = NSPoint();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_locationForGlyphAtIndex_, glyphIndex);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_locationForGlyphAtIndex_, glyphIndex);
     return result;
 }
 
@@ -127,7 +127,7 @@
 
 public NSRect usedRectForTextContainer(NSTextContainer container) {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_usedRectForTextContainer_, container !is null ? container.id : null);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_usedRectForTextContainer_, container !is null ? container.id : null);
     return result;
 }
 
--- a/dwt/internal/cocoa/NSMutableParagraphStyle.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSMutableParagraphStyle.d	Mon Dec 22 15:10:19 2008 +0100
@@ -21,6 +21,7 @@
 import dwt.internal.cocoa.NSText;
 import dwt.internal.cocoa.NSTextTab;
 import dwt.internal.cocoa.OS;
+import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
 public class NSMutableParagraphStyle : NSParagraphStyle {
--- a/dwt/internal/cocoa/NSObject.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSObject.d	Mon Dec 22 15:10:19 2008 +0100
@@ -18,7 +18,6 @@
 import cocoa = dwt.internal.cocoa.id;
 import dwt.internal.cocoa.NSArray;
 import dwt.internal.cocoa.NSImage;
-import dwt.internal.cocoa.NSInteger;
 import dwt.internal.cocoa.NSNotification;
 import dwt.internal.cocoa.NSOutlineView;
 import dwt.internal.cocoa.NSPasteboard;
@@ -63,7 +62,7 @@
 
 public NSPoint draggedImageLocation() {
     NSPoint result = NSPoint();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_draggedImageLocation);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_draggedImageLocation);
     return result;
 }
 
@@ -77,7 +76,7 @@
 }
 
 public NSDragOperation draggingEntered(cocoa.id  sender) {
-    return OS.objc_msgSend(this.id, OS.sel_draggingEntered_, sender !is null ? sender.id : null);
+    return cast(NSDragOperation) OS.objc_msgSend(this.id, OS.sel_draggingEntered_, sender !is null ? sender.id : null);
 }
 
 public void draggingExited(dwt.internal.cocoa.id.id  sender) {
@@ -86,7 +85,7 @@
 
 public NSPoint draggingLocation() {
     NSPoint result = NSPoint();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_draggingLocation);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_draggingLocation);
     return result;
 }
 
@@ -101,7 +100,7 @@
 
 public cocoa.id draggingSource() {
     objc.id result = OS.objc_msgSend(this.id, OS.sel_draggingSource);
-    return result !is null ? new id(result) : null;
+    return result !is null ? new cocoa.id(result) : null;
 }
 
 public NSDragOperation draggingSourceOperationMask() {
@@ -153,7 +152,7 @@
 
 public cocoa.id copy() {
     objc.id result = OS.objc_msgSend(this.id, OS.sel_copy);
-    return result !is null ? new id(result) : null;
+    return result !is null ? new cocoa.id(result) : null;
 }
 
 public NSString description() {
@@ -192,11 +191,11 @@
 
 public cocoa.id retain() {
     objc.id result = OS.objc_msgSend(this.id, OS.sel_retain);
-    return result !is null ? new id(result) : null;
+    return result !is null ? new cocoa.id(result) : null;
 }
 
 public NSUInteger retainCount() {
-    return OS.objc_msgSend(this.id, OS.sel_retainCount);
+    return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_retainCount);
 }
 
 public objc.Class superclass() {
--- a/dwt/internal/cocoa/NSParagraphStyle.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSParagraphStyle.d	Mon Dec 22 15:10:19 2008 +0100
@@ -19,26 +19,9 @@
 import dwt.internal.cocoa.NSObject;
 import dwt.internal.cocoa.NSText;
 import dwt.internal.cocoa.OS;
+import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
-enum NSLineBreakMode 
-{
-    NSLineBreakByWordWrapping = 0,
-    NSLineBreakByCharWrapping,
-    NSLineBreakByClipping,
-    NSLineBreakByTruncatingHead,
-    NSLineBreakByTruncatingTail,
-    NSLineBreakByTruncatingMiddle
-}
-
-enum NSTextTabType
-{
-    NSLeftTabStopType = 0,
-    NSRightTabStopType,
-    NSCenterTabStopType,
-    NSDecimalTabStopType
-}
-
 public class NSParagraphStyle : NSObject {
 
 public this() {
--- a/dwt/internal/cocoa/NSPasteboard.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSPasteboard.d	Mon Dec 22 15:10:19 2008 +0100
@@ -67,7 +67,7 @@
 
 public cocoa.id propertyListForType(NSString dataType) {
     objc.id result = OS.objc_msgSend(this.id, OS.sel_propertyListForType_, dataType !is null ? dataType.id : null);
-    return result !is null ? new id(result) : null;
+    return result !is null ? new cocoa.id(result) : null;
 }
 
 public bool setData(NSData data, NSString dataType) {
--- a/dwt/internal/cocoa/NSPoint.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSPoint.d	Mon Dec 22 15:10:19 2008 +0100
@@ -19,6 +19,6 @@
 alias NSPoint* NSPointArray;
 
 public struct NSPoint {
-    public CGFloat x;
-    public CGFloat y;
+    public CGFloat x = 0.0;
+    public CGFloat y = 0.0;
 }
--- a/dwt/internal/cocoa/NSPopUpButton.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSPopUpButton.d	Mon Dec 22 15:10:19 2008 +0100
@@ -96,7 +96,7 @@
 }
 
 public static objc.Class cellClass() {
-    return cast(objc.Calss) OS.objc_msgSend(OS.class_NSPopUpButton, OS.sel_cellClass);
+    return cast(objc.Class) OS.objc_msgSend(OS.class_NSPopUpButton, OS.sel_cellClass);
 }
 
 public static void setCellClass(objc.Class factoryId) {
--- a/dwt/internal/cocoa/NSPrintInfo.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSPrintInfo.d	Mon Dec 22 15:10:19 2008 +0100
@@ -51,7 +51,7 @@
 
 public NSRect imageablePageBounds() {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_imageablePageBounds);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_imageablePageBounds);
     return result;
 }
 
@@ -67,7 +67,7 @@
 
 public NSSize paperSize() {
     NSSize result = NSSize();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_paperSize);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_paperSize);
     return result;
 }
 
--- a/dwt/internal/cocoa/NSRange.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSRange.d	Mon Dec 22 15:10:19 2008 +0100
@@ -13,9 +13,12 @@
  *******************************************************************************/
 module dwt.internal.cocoa.NSRange;
 
+import tango.stdc.config;
+
 import dwt.dwthelper.utils;
 import dwt.internal.objc.cocoa.Cocoa;
 
+alias c_ulong NSUInteger;
 alias NSRange* NSRangePointer;
  
 public struct NSRange {
--- a/dwt/internal/cocoa/NSScreen.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSScreen.d	Mon Dec 22 15:10:19 2008 +0100
@@ -48,7 +48,7 @@
 
 public NSRect frame() {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_frame);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_frame);
     return result;
 }
 
@@ -64,7 +64,7 @@
 
 public NSRect visibleFrame() {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_visibleFrame);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_visibleFrame);
     return result;
 }
 
--- a/dwt/internal/cocoa/NSScrollView.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSScrollView.d	Mon Dec 22 15:10:19 2008 +0100
@@ -39,13 +39,13 @@
 
 public NSSize contentSize() {
     NSSize result = NSSize();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_contentSize);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_contentSize);
     return result;
 }
 
 public static NSSize contentSizeForFrameSize(NSSize fSize, bool hFlag, bool vFlag, NSBorderType aType) {
     NSSize result = NSSize();
-    OS.objc_msgSend_stret(result, OS.class_NSScrollView, OS.sel_contentSizeForFrameSize_hasHorizontalScroller_hasVerticalScroller_borderType_, fSize, hFlag, vFlag, aType);
+    OS.objc_msgSend_stret(&result, OS.class_NSScrollView, OS.sel_contentSizeForFrameSize_hasHorizontalScroller_hasVerticalScroller_borderType_, fSize, hFlag, vFlag, aType);
     return result;
 }
 
@@ -61,13 +61,13 @@
 
 public NSRect documentVisibleRect() {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_documentVisibleRect);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_documentVisibleRect);
     return result;
 }
 
 public static NSSize frameSizeForContentSize(NSSize cSize, bool hFlag, bool vFlag, NSBorderType aType) {
     NSSize result = NSSize();
-    OS.objc_msgSend_stret(result, OS.class_NSScrollView, OS.sel_frameSizeForContentSize_hasHorizontalScroller_hasVerticalScroller_borderType_, cSize, hFlag, vFlag, aType);
+    OS.objc_msgSend_stret(&result, OS.class_NSScrollView, OS.sel_frameSizeForContentSize_hasHorizontalScroller_hasVerticalScroller_borderType_, cSize, hFlag, vFlag, aType);
     return result;
 }
 
--- a/dwt/internal/cocoa/NSScroller.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSScroller.d	Mon Dec 22 15:10:19 2008 +0100
@@ -20,16 +20,7 @@
 import dwt.internal.cocoa.OS;
 import objc = dwt.internal.objc.runtime;
 
-enum NSScrollerPart
-{
-    NSScrollerNoPart = 0,
-    NSScrollerDecrementPage = 1,
-    NSScrollerKnob = 2,
-    NSScrollerIncrementPage = 3,
-    NSScrollerDecrementLine = 4,
-    NSScrollerIncrementLine = 5,
-    NSScrollerKnobSlot = 6
-} 
+
 
 public class NSScroller : NSControl {
 
--- a/dwt/internal/cocoa/NSSize.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSSize.d	Mon Dec 22 15:10:19 2008 +0100
@@ -11,7 +11,6 @@
  * Port to the D programming language:
  *    Jacob Carlborg <doob@me.com>
  *******************************************************************************/
-
 module dwt.internal.cocoa.NSSize;
 
 import dwt.dwthelper.utils;
@@ -19,7 +18,7 @@
 
 
 public struct NSSize {
-    public CGFloat width;
-    public CGFloat height;
+    public CGFloat width = 0;
+    public CGFloat height = 0;
     //public static final int sizeof = OS.NSSize_sizeof();
 }
--- a/dwt/internal/cocoa/NSTabView.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSTabView.d	Mon Dec 22 15:10:19 2008 +0100
@@ -56,7 +56,7 @@
 
 public NSRect contentRect() {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_contentRect);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_contentRect);
     return result;
 }
 
@@ -66,7 +66,7 @@
 
 public NSSize minimumSize() {
     NSSize result = NSSize();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_minimumSize);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_minimumSize);
     return result;
 }
 
--- a/dwt/internal/cocoa/NSTableHeaderCell.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSTableHeaderCell.d	Mon Dec 22 15:10:19 2008 +0100
@@ -42,7 +42,7 @@
 
 public NSRect sortIndicatorRectForBounds(NSRect theRect) {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_sortIndicatorRectForBounds_, theRect);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_sortIndicatorRectForBounds_, theRect);
     return result;
 }
 
--- a/dwt/internal/cocoa/NSTableHeaderView.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSTableHeaderView.d	Mon Dec 22 15:10:19 2008 +0100
@@ -42,7 +42,7 @@
 
 public NSRect headerRectOfColumn(NSInteger column) {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_headerRectOfColumn_, column);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_headerRectOfColumn_, column);
     return result;
 }
 
--- a/dwt/internal/cocoa/NSTableView.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSTableView.d	Mon Dec 22 15:10:19 2008 +0100
@@ -81,7 +81,7 @@
 
 public NSRect frameOfCellAtColumn(NSInteger column, NSInteger row) {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_frameOfCellAtColumn_row_, column, row);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_frameOfCellAtColumn_row_, column, row);
     return result;
 }
 
@@ -96,7 +96,7 @@
 
 public NSSize intercellSpacing() {
     NSSize result = NSSize();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_intercellSpacing);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_intercellSpacing);
     return result;
 }
 
@@ -113,26 +113,26 @@
 }
 
 public NSInteger numberOfColumns() {
-    return OS.objc_msgSend(this.id, OS.sel_numberOfColumns);
+    return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_numberOfColumns);
 }
 
 public NSInteger numberOfRows() {
-    return OS.objc_msgSend(this.id, OS.sel_numberOfRows);
+    return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_numberOfRows);
 }
 
 public NSInteger numberOfSelectedRows() {
-    return OS.objc_msgSend(this.id, OS.sel_numberOfSelectedRows);
+    return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_numberOfSelectedRows);
 }
 
 public NSRect rectOfColumn(NSInteger column) {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_rectOfColumn_, column);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_rectOfColumn_, column);
     return result;
 }
 
 public NSRect rectOfRow(NSInteger row) {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_rectOfRow_, row);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_rectOfRow_, row);
     return result;
 }
 
@@ -154,7 +154,7 @@
 
 public NSRange rowsInRect(NSRect rect) {
     NSRange result = NSRange();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_rowsInRect_, rect);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_rowsInRect_, rect);
     return result;
 }
 
--- a/dwt/internal/cocoa/NSText.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSText.d	Mon Dec 22 15:10:19 2008 +0100
@@ -22,17 +22,9 @@
 import dwt.internal.cocoa.NSString;
 import dwt.internal.cocoa.NSView;
 import dwt.internal.cocoa.OS;
+import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
-enum NSTextAlignment
-{
-    NSLeftTextAlignment = 0,
-    NSRightTextAlignment = 1,
-    NSCenterTextAlignment = 2,
-    NSJustifiedTextAlignment = 3,
-    NSNaturalTextAlignment = 4
-}
-
 public class NSText : NSView {
     
 public this() {
@@ -73,7 +65,7 @@
 
 public NSRange selectedRange() {
     NSRange result = NSRange();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_selectedRange);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_selectedRange);
     return result;
 }
 
--- a/dwt/internal/cocoa/NSTextContainer.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSTextContainer.d	Mon Dec 22 15:10:19 2008 +0100
@@ -37,7 +37,7 @@
 
 public NSSize containerSize() {
     NSSize result = NSSize();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_containerSize);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_containerSize);
     return result;
 }
 
--- a/dwt/internal/cocoa/NSTextTab.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSTextTab.d	Mon Dec 22 15:10:19 2008 +0100
@@ -19,6 +19,7 @@
 import dwt.internal.cocoa.NSObject;
 import dwt.internal.cocoa.NSParagraphStyle;
 import dwt.internal.cocoa.OS;
+import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
 public class NSTextTab : NSObject {
--- a/dwt/internal/cocoa/NSValue.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSValue.d	Mon Dec 22 15:10:19 2008 +0100
@@ -22,6 +22,7 @@
 import dwt.internal.cocoa.NSSize;
 import dwt.internal.cocoa.OS;
 import objc = dwt.internal.objc.runtime;
+import bindings = dwt.internal.objc.bindings;
 
 public class NSValue : NSObject {
 
@@ -39,19 +40,19 @@
 
 public NSPoint pointValue() {
     NSPoint result = NSPoint();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_pointValue);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_pointValue);
     return result;
 }
 
 public NSRange rangeValue() {
     NSRange result = NSRange();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_rangeValue);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_rangeValue);
     return result;
 }
 
 public NSSize sizeValue() {
     NSSize result = NSSize();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_sizeValue);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_sizeValue);
     return result;
 }
 
@@ -74,5 +75,5 @@
     objc.id result = OS.objc_msgSend(OS.class_NSValue, OS.sel_valueWithSize_, size);
     return result !is null ? new NSValue(result) : null;
 }
-
+    
 }
--- a/dwt/internal/cocoa/NSView.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSView.d	Mon Dec 22 15:10:19 2008 +0100
@@ -30,14 +30,6 @@
 import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
-enum NSBorderType
-{
-    NSNoBorder = 0,
-    NSLineBorder = 1,
-    NSBezelBorder = 2,
-    NSGrooveBorder = 3
-}
-
 public class NSView : NSResponder {
 
 public this() {
@@ -70,79 +62,79 @@
 
 public NSRect bounds() {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_bounds);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_bounds);
     return result;
 }
 
 public NSPoint convertPoint_fromView_(NSPoint aPoint, NSView aView) {
     NSPoint result = NSPoint();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_convertPoint_fromView_, aPoint, aView !is null ? aView.id : null);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertPoint_fromView_, aPoint, aView !is null ? aView.id : null);
     return result;
 }
 
 public NSPoint convertPoint_toView_(NSPoint aPoint, NSView aView) {
     NSPoint result = NSPoint();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_convertPoint_toView_, aPoint, aView !is null ? aView.id : null);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertPoint_toView_, aPoint, aView !is null ? aView.id : null);
     return result;
 }
 
 public NSPoint convertPointFromBase(NSPoint aPoint) {
     NSPoint result = NSPoint();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_convertPointFromBase_, aPoint);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertPointFromBase_, aPoint);
     return result;
 }
 
 public NSPoint convertPointToBase(NSPoint aPoint) {
     NSPoint result = NSPoint();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_convertPointToBase_, aPoint);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertPointToBase_, aPoint);
     return result;
 }
 
 public NSRect convertRect_fromView_(NSRect aRect, NSView aView) {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_convertRect_fromView_, aRect, aView !is null ? aView.id : null);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertRect_fromView_, aRect, aView !is null ? aView.id : null);
     return result;
 }
 
 public NSRect convertRect_toView_(NSRect aRect, NSView aView) {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_convertRect_toView_, aRect, aView !is null ? aView.id : null);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertRect_toView_, aRect, aView !is null ? aView.id : null);
     return result;
 }
 
 public NSRect convertRectFromBase(NSRect aRect) {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_convertRectFromBase_, aRect);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertRectFromBase_, aRect);
     return result;
 }
 
 public NSRect convertRectToBase(NSRect aRect) {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_convertRectToBase_, aRect);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertRectToBase_, aRect);
     return result;
 }
 
 public NSSize convertSize_fromView_(NSSize aSize, NSView aView) {
     NSSize result = NSSize();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_convertSize_fromView_, aSize, aView !is null ? aView.id : null);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertSize_fromView_, aSize, aView !is null ? aView.id : null);
     return result;
 }
 
 public NSSize convertSize_toView_(NSSize aSize, NSView aView) {
     NSSize result = NSSize();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_convertSize_toView_, aSize, aView !is null ? aView.id : null);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertSize_toView_, aSize, aView !is null ? aView.id : null);
     return result;
 }
 
 public NSSize convertSizeFromBase(NSSize aSize) {
     NSSize result = NSSize();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_convertSizeFromBase_, aSize);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertSizeFromBase_, aSize);
     return result;
 }
 
 public NSSize convertSizeToBase(NSSize aSize) {
     NSSize result = NSSize();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_convertSizeToBase_, aSize);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertSizeToBase_, aSize);
     return result;
 }
 
@@ -168,7 +160,7 @@
 
 public NSRect frame() {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_frame);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_frame);
     return result;
 }
 
@@ -263,7 +255,7 @@
 
 public NSRect visibleRect() {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_visibleRect);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_visibleRect);
     return result;
 }
 
--- a/dwt/internal/cocoa/NSWindow.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/NSWindow.d	Mon Dec 22 15:10:19 2008 +0100
@@ -53,7 +53,7 @@
 
 public NSPoint cascadeTopLeftFromPoint(NSPoint topLeftPoint) {
     NSPoint result = NSPoint();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_cascadeTopLeftFromPoint_, topLeftPoint);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_cascadeTopLeftFromPoint_, topLeftPoint);
     return result;
 }
 
@@ -63,7 +63,7 @@
 
 public NSRect contentRectForFrameRect(NSRect frameRect) {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_contentRectForFrameRect_, frameRect);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_contentRectForFrameRect_, frameRect);
     return result;
 }
 
@@ -74,13 +74,13 @@
 
 public NSPoint convertBaseToScreen(NSPoint aPoint) {
     NSPoint result = NSPoint();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_convertBaseToScreen_, aPoint);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertBaseToScreen_, aPoint);
     return result;
 }
 
 public NSPoint convertScreenToBase(NSPoint aPoint) {
     NSPoint result = NSPoint();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_convertScreenToBase_, aPoint);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertScreenToBase_, aPoint);
     return result;
 }
 
@@ -100,13 +100,13 @@
 
 public NSRect frame() {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_frame);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_frame);
     return result;
 }
 
 public NSRect frameRectForContentRect(NSRect contentRect) {
     NSRect result = NSRect();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_frameRectForContentRect_, contentRect);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_frameRectForContentRect_, contentRect);
     return result;
 }
 
@@ -143,7 +143,7 @@
 
 public NSPoint mouseLocationOutsideOfEventStream() {
     NSPoint result = NSPoint();
-    OS.objc_msgSend_stret(result, this.id, OS.sel_mouseLocationOutsideOfEventStream);
+    OS.objc_msgSend_stret(&result, this.id, OS.sel_mouseLocationOutsideOfEventStream);
     return result;
 }
 
--- a/dwt/internal/cocoa/OS.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/cocoa/OS.d	Mon Dec 22 15:10:19 2008 +0100
@@ -10,6 +10,27 @@
  *******************************************************************************/
 module dwt.internal.cocoa.OS;
 
+// NSScroller.h
+enum NSScrollerPart
+{
+    NSScrollerNoPart = 0,
+    NSScrollerDecrementPage = 1,
+    NSScrollerKnob = 2,
+    NSScrollerIncrementPage = 3,
+    NSScrollerDecrementLine = 4,
+    NSScrollerIncrementLine = 5,
+    NSScrollerKnobSlot = 6
+}
+
+// NSView.h
+enum NSBorderType
+{
+    NSNoBorder = 0,
+    NSLineBorder = 1,
+    NSBezelBorder = 2,
+    NSGrooveBorder = 3
+}
+
 import dwt.dwthelper.utils;
 
 import dwt.internal.C;
@@ -24,10 +45,15 @@
 import dwt.internal.cocoa.CGRect;
 import dwt.internal.cocoa.CGSize;
 import dwt.internal.cocoa.NSAffineTransformStruct;
+import dwt.internal.cocoa.NSAlert;
+import dwt.internal.cocoa.NSApplication;
+import dwt.internal.cocoa.NSBezierPath;
 import dwt.internal.cocoa.NSBitmapImageRep;
 import dwt.internal.cocoa.NSButtonCell;
 import dwt.internal.cocoa.NSCell;
 import dwt.internal.cocoa.NSEvent;
+import dwt.internal.cocoa.NSGradient;
+import dwt.internal.cocoa.NSGraphicsContext;
 import dwt.internal.cocoa.NSImage;
 import dwt.internal.cocoa.NSParagraphStyle;
 import dwt.internal.cocoa.NSPoint;
@@ -39,6 +65,7 @@
 import dwt.internal.cocoa.NSString;
 import dwt.internal.cocoa.NSText;
 import dwt.internal.cocoa.NSView;
+import NSWindowTypes = dwt.internal.cocoa.NSWindow;
 import Cocoa = dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
@@ -220,7 +247,7 @@
         protocol_WebPolicyDecisionListener = objc_getProtocol("WebPolicyDecisionListener");
         protocol_WebPolicyDelegate = objc_getProtocol("WebPolicyDelegate");
         protocol_WebResourceLoadDelegate = objc_getProtocol("WebResourceLoadDelegate");
-        protocol_WebUIDelegate = objc_getProtocol("WebUIDelegate");
+        protocol_WebUIDelegate = objc_getProtocol("WebUIDelegate");        
         
         sel_DOMDocument = sel_registerName("DOMDocument");
         sel_IBeamCursor = sel_registerName("IBeamCursor");
@@ -1181,11 +1208,140 @@
         sel_wraps = sel_registerName("wraps");
         sel_writeToPasteboard_ = sel_registerName("writeToPasteboard:");
         sel_yearOfCommonEra = sel_registerName("yearOfCommonEra");
+        
+        NSAccessibilityButtonRole = new NSString (NSAccessibilityButtonRole_);
+        NSAccessibilityCheckBoxRole = new NSString (NSAccessibilityCheckBoxRole_);
+        NSAccessibilityChildrenAttribute = new NSString (NSAccessibilityChildrenAttribute_);
+        NSAccessibilityColumnRole = new NSString (NSAccessibilityColumnRole_);
+        NSAccessibilityComboBoxRole = new NSString (NSAccessibilityComboBoxRole_);
+        NSAccessibilityConfirmAction = new NSString (NSAccessibilityConfirmAction_);
+        NSAccessibilityContentsAttribute = new NSString (NSAccessibilityContentsAttribute_);
+        NSAccessibilityDescriptionAttribute = new NSString (NSAccessibilityDescriptionAttribute_);
+        NSAccessibilityDialogSubrole = new NSString (NSAccessibilityDialogSubrole_);
+        NSAccessibilityEnabledAttribute = new NSString (NSAccessibilityEnabledAttribute_);
+        NSAccessibilityExpandedAttribute = new NSString (NSAccessibilityExpandedAttribute_);
+        NSAccessibilityFloatingWindowSubrole = new NSString (NSAccessibilityFloatingWindowSubrole_);
+        NSAccessibilityFocusedAttribute = new NSString (NSAccessibilityFocusedAttribute_);
+        NSAccessibilityFocusedUIElementChangedNotification = new NSString (NSAccessibilityFocusedUIElementChangedNotification_);
+        NSAccessibilityGridRole = new NSString (NSAccessibilityGridRole_);
+        NSAccessibilityGroupRole = new NSString (NSAccessibilityGroupRole_);
+        NSAccessibilityHelpAttribute = new NSString (NSAccessibilityHelpAttribute_);
+        NSAccessibilityHelpTagRole = new NSString (NSAccessibilityHelpTagRole_);
+        NSAccessibilityHorizontalOrientationValue = new NSString (NSAccessibilityHorizontalOrientationValue_);
+        NSAccessibilityHorizontalScrollBarAttribute = new NSString (NSAccessibilityHorizontalScrollBarAttribute_);
+        NSAccessibilityImageRole = new NSString (NSAccessibilityImageRole_);
+        NSAccessibilityIncrementorRole = new NSString (NSAccessibilityIncrementorRole_);
+        NSAccessibilityInsertionPointLineNumberAttribute = new NSString (NSAccessibilityInsertionPointLineNumberAttribute_);
+        NSAccessibilityLabelValueAttribute = new NSString (NSAccessibilityLabelValueAttribute_);
+        NSAccessibilityLineForIndexParameterizedAttribute = new NSString (NSAccessibilityLineForIndexParameterizedAttribute_);
+        NSAccessibilityLinkRole = new NSString (NSAccessibilityLinkRole_);
+        NSAccessibilityLinkTextAttribute = new NSString (NSAccessibilityLinkTextAttribute_);
+        NSAccessibilityListRole = new NSString (NSAccessibilityListRole_);
+        NSAccessibilityMaxValueAttribute = new NSString (NSAccessibilityMaxValueAttribute_);
+        NSAccessibilityMenuBarRole = new NSString (NSAccessibilityMenuBarRole_);
+        NSAccessibilityMenuButtonRole = new NSString (NSAccessibilityMenuButtonRole_);
+        NSAccessibilityMenuItemRole = new NSString (NSAccessibilityMenuItemRole_);
+        NSAccessibilityMenuRole = new NSString (NSAccessibilityMenuRole_);
+        NSAccessibilityMinValueAttribute = new NSString (NSAccessibilityMinValueAttribute_);
+        NSAccessibilityNextContentsAttribute = new NSString (NSAccessibilityNextContentsAttribute_);
+        NSAccessibilityNumberOfCharactersAttribute = new NSString (NSAccessibilityNumberOfCharactersAttribute_);
+        NSAccessibilityOrientationAttribute = new NSString (NSAccessibilityOrientationAttribute_);
+        NSAccessibilityOutlineRole = new NSString (NSAccessibilityOutlineRole_);
+        NSAccessibilityOutlineRowSubrole = new NSString (NSAccessibilityOutlineRowSubrole_);
+        NSAccessibilityParentAttribute = new NSString (NSAccessibilityParentAttribute_);
+        NSAccessibilityPopUpButtonRole = new NSString (NSAccessibilityPopUpButtonRole_);
+        NSAccessibilityPositionAttribute = new NSString (NSAccessibilityPositionAttribute_);
+        NSAccessibilityPressAction = new NSString (NSAccessibilityPressAction_);
+        NSAccessibilityPreviousContentsAttribute = new NSString (NSAccessibilityPreviousContentsAttribute_);
+        NSAccessibilityProgressIndicatorRole = new NSString (NSAccessibilityProgressIndicatorRole_);
+        NSAccessibilityRTFForRangeParameterizedAttribute = new NSString (NSAccessibilityRTFForRangeParameterizedAttribute_);
+        NSAccessibilityRadioButtonRole = new NSString (NSAccessibilityRadioButtonRole_);
+        NSAccessibilityRadioGroupRole = new NSString (NSAccessibilityRadioGroupRole_);
+        NSAccessibilityRangeForIndexParameterizedAttribute = new NSString (NSAccessibilityRangeForIndexParameterizedAttribute_);
+        NSAccessibilityRangeForLineParameterizedAttribute = new NSString (NSAccessibilityRangeForLineParameterizedAttribute_);
+        NSAccessibilityRangeForPositionParameterizedAttribute = new NSString (NSAccessibilityRangeForPositionParameterizedAttribute_);
+        NSAccessibilityRoleAttribute = new NSString (NSAccessibilityRoleAttribute_);
+        NSAccessibilityRoleDescriptionAttribute = new NSString (NSAccessibilityRoleDescriptionAttribute_);
+        NSAccessibilityRowRole = new NSString (NSAccessibilityRowRole_);
+        NSAccessibilityScrollAreaRole = new NSString (NSAccessibilityScrollAreaRole_);
+        NSAccessibilityScrollBarRole = new NSString (NSAccessibilityScrollBarRole_);
+        NSAccessibilitySelectedAttribute = new NSString (NSAccessibilitySelectedAttribute_);
+        NSAccessibilitySelectedChildrenAttribute = new NSString (NSAccessibilitySelectedChildrenAttribute_);
+        NSAccessibilitySelectedChildrenChangedNotification = new NSString (NSAccessibilitySelectedChildrenChangedNotification_);
+        NSAccessibilitySelectedTextAttribute = new NSString (NSAccessibilitySelectedTextAttribute_);
+        NSAccessibilitySelectedTextChangedNotification = new NSString (NSAccessibilitySelectedTextChangedNotification_);
+        NSAccessibilitySelectedTextRangeAttribute = new NSString (NSAccessibilitySelectedTextRangeAttribute_);
+        NSAccessibilitySelectedTextRangesAttribute = new NSString (NSAccessibilitySelectedTextRangesAttribute_);
+        NSAccessibilitySizeAttribute = new NSString (NSAccessibilitySizeAttribute_);
+        NSAccessibilitySliderRole = new NSString (NSAccessibilitySliderRole_);
+        NSAccessibilitySortButtonRole = new NSString (NSAccessibilitySortButtonRole_);
+        NSAccessibilitySplitterRole = new NSString (NSAccessibilitySplitterRole_);
+        NSAccessibilityStandardWindowSubrole = new NSString (NSAccessibilityStandardWindowSubrole_);
+        NSAccessibilityStaticTextRole = new NSString (NSAccessibilityStaticTextRole_);
+        NSAccessibilityStringForRangeParameterizedAttribute = new NSString (NSAccessibilityStringForRangeParameterizedAttribute_);
+        NSAccessibilityStyleRangeForIndexParameterizedAttribute = new NSString (NSAccessibilityStyleRangeForIndexParameterizedAttribute_);
+        NSAccessibilitySubroleAttribute = new NSString (NSAccessibilitySubroleAttribute_);
+        NSAccessibilitySystemDialogSubrole = new NSString (NSAccessibilitySystemDialogSubrole_);
+        NSAccessibilityTabGroupRole = new NSString (NSAccessibilityTabGroupRole_);
+        NSAccessibilityTableRole = new NSString (NSAccessibilityTableRole_);
+        NSAccessibilityTableRowSubrole = new NSString (NSAccessibilityTableRowSubrole_);
+        NSAccessibilityTabsAttribute = new NSString (NSAccessibilityTabsAttribute_);
+        NSAccessibilityTextAreaRole = new NSString (NSAccessibilityTextAreaRole_);
+        NSAccessibilityTextFieldRole = new NSString (NSAccessibilityTextFieldRole_);
+        NSAccessibilityTextLinkSubrole = new NSString (NSAccessibilityTextLinkSubrole_);
+        NSAccessibilityTitleAttribute = new NSString (NSAccessibilityTitleAttribute_);
+        NSAccessibilityTitleUIElementAttribute = new NSString (NSAccessibilityTitleUIElementAttribute_);
+        NSAccessibilityToolbarRole = new NSString (NSAccessibilityToolbarRole_);
+        NSAccessibilityTopLevelUIElementAttribute = new NSString (NSAccessibilityTopLevelUIElementAttribute_);
+        NSAccessibilityUnknownRole = new NSString (NSAccessibilityUnknownRole_);
+        NSAccessibilityUnknownSubrole = new NSString (NSAccessibilityUnknownSubrole_);
+        NSAccessibilityValueAttribute = new NSString (NSAccessibilityValueAttribute_);
+        NSAccessibilityValueChangedNotification = new NSString (NSAccessibilityValueChangedNotification_);
+        NSAccessibilityValueDescriptionAttribute = new NSString (NSAccessibilityValueDescriptionAttribute_);
+        NSAccessibilityValueIndicatorRole = new NSString (NSAccessibilityValueIndicatorRole_);
+        NSAccessibilityVerticalOrientationValue = new NSString (NSAccessibilityVerticalOrientationValue_);
+        NSAccessibilityVerticalScrollBarAttribute = new NSString (NSAccessibilityVerticalScrollBarAttribute_);
+        NSAccessibilityVisibleCharacterRangeAttribute = new NSString (NSAccessibilityVisibleCharacterRangeAttribute_);
+        NSAccessibilityVisibleChildrenAttribute = new NSString (NSAccessibilityVisibleChildrenAttribute_);
+        NSAccessibilityWindowAttribute = new NSString (NSAccessibilityWindowAttribute_);
+        NSAccessibilityWindowRole = new NSString (NSAccessibilityWindowRole_);
+        NSBackgroundColorAttributeName = new NSString (NSBackgroundColorAttributeName_);
+        NSBaselineOffsetAttributeName = new NSString (NSBaselineOffsetAttributeName_);
+        NSCalibratedRGBColorSpace = new NSString (NSCalibratedRGBColorSpace_);
+        NSDeviceRGBColorSpace = new NSString (NSDeviceRGBColorSpace_);
+        NSDeviceResolution = new NSString (NSDeviceResolution_);
+        NSDragPboard = new NSString (NSDragPboard_);
+        NSFilenamesPboardType = new NSString (NSFilenamesPboardType_);
+        NSFontAttributeName = new NSString (NSFontAttributeName_);
+        NSForegroundColorAttributeName = new NSString (NSForegroundColorAttributeName_);
+        NSHTMLPboardType = new NSString (NSHTMLPboardType_);
+        NSLinkAttributeName = new NSString (NSLinkAttributeName_);
+        NSParagraphStyleAttributeName = new NSString (NSParagraphStyleAttributeName_);
+        NSPrintAllPages = new NSString (NSPrintAllPages_);
+        NSPrintCopies = new NSString (NSPrintCopies_);
+        NSPrintFirstPage = new NSString (NSPrintFirstPage_);
+        NSPrintJobDisposition = new NSString (NSPrintJobDisposition_);
+        NSPrintLastPage = new NSString (NSPrintLastPage_);
+        NSPrintMustCollate = new NSString (NSPrintMustCollate_);
+        NSPrintPreviewJob = new NSString (NSPrintPreviewJob_);
+        NSPrintSaveJob = new NSString (NSPrintSaveJob_);
+        NSPrintSavePath = new NSString (NSPrintSavePath_);
+        NSPrintSpoolJob = new NSString (NSPrintSpoolJob_);
+        NSRTFPboardType = new NSString (NSRTFPboardType_);
+        NSStrikethroughColorAttributeName = new NSString (NSStrikethroughColorAttributeName_);
+        NSStrikethroughStyleAttributeName = new NSString (NSStrikethroughStyleAttributeName_);
+        NSStringPboardType = new NSString (NSStringPboardType_);
+        NSTIFFPboardType = new NSString (NSTIFFPboardType_);
+        NSURLPboardType = new NSString (NSURLPboardType_);
+        NSUnderlineColorAttributeName = new NSString (NSUnderlineColorAttributeName_);
+        NSUnderlineStyleAttributeName = new NSString (NSUnderlineStyleAttributeName_);
+        NSDefaultRunLoopMode = new NSString (NSDefaultRunLoopMode_);
+        NSErrorFailingURLStringKey = new NSString (NSErrorFailingURLStringKey_);
     }
     
 	public static const int gestaltSystemVersion = ('s'<<24) + ('y'<<16) + ('s'<<8) + 'v';
 	public static const int noErr = 0;
-	public static const int kProcessTransformToForegroundApplication = 1;
+	alias Carbon.ProcessApplicationTransformState.kProcessTransformToForegroundApplication kProcessTransformToForegroundApplication;
 	public static const int kAlertCautionIcon = ('c'<<24) + ('a'<<16) + ('u'<<8) + 't';
 	public static const int kAlertNoteIcon = ('n'<<24) + ('o'<<16) + ('t'<<8) + 'e';
 	public static const int kAlertStopIcon = ('s'<<24) + ('t'<<16) + ('o'<<8) + 'p';
@@ -1196,11 +1352,6 @@
     public static const objc.SEL sel_sendHorizontalSelection;
     public static const objc.SEL sel_timerProc_;
     public static const objc.SEL sel_handleNotification_;
-    
-    static this ()
-    {
-        
-    }
 
 /** JNI natives */
 
@@ -1563,7 +1714,7 @@
 public static const objc.Protocol* protocol_WebResourceLoadDelegate;
 public static const objc.Protocol* protocol_WebUIDelegate;
 
-/** Selectors */
+/** Selectors */    
 public static const objc.SEL sel_DOMDocument;
 public static const objc.SEL sel_IBeamCursor;
 public static const objc.SEL sel_TIFFRepresentation;
@@ -2534,16 +2685,16 @@
 public static const int NSAdobeJapan1CharacterCollection = 3;
 public static const int NSAdobeJapan2CharacterCollection = 4;
 public static const int NSAdobeKorea1CharacterCollection = 5;
-public static const int NSAlertAlternateReturn = 0;
-public static const int NSAlertDefaultReturn = 1;
-public static const int NSAlertErrorReturn = -2;
-public static const int NSAlertFirstButtonReturn = 1000;
-public static const int NSAlertOtherReturn = -1;
-public static const int NSAlertSecondButtonReturn = 1001;
-public static const int NSAlertThirdButtonReturn = 1002;
+public static const Cocoa.NSInteger NSAlertAlternateReturn = 0;
+public static const Cocoa.NSInteger NSAlertDefaultReturn = 1;
+public static const Cocoa.NSInteger NSAlertErrorReturn = -2;
+public static const Cocoa.NSInteger NSAlertFirstButtonReturn = 1000;
+public static const Cocoa.NSInteger NSAlertOtherReturn = -1;
+public static const Cocoa.NSInteger NSAlertSecondButtonReturn = 1001;
+public static const Cocoa.NSInteger NSAlertThirdButtonReturn = 1002;
 public static const int NSAllScrollerParts = 2;
-alias NSBitmapFormat.NSAlphaFirstBitmapFormat NSAlphaFirstBitmapFormat;
-alias NSBitmapFormat.NSAlphaNonpremultipliedBitmapFormat NSAlphaNonpremultipliedBitmapFormat;
+alias Cocoa.NSBitmapFormat.NSAlphaFirstBitmapFormat NSAlphaFirstBitmapFormat;
+alias Cocoa.NSBitmapFormat.NSAlphaNonpremultipliedBitmapFormat NSAlphaNonpremultipliedBitmapFormat;
 public static const int NSAlphaShiftKeyMask = 65536;
 public static const int NSAlternateKeyMask = 524288;
 public static const int NSAnimationBlocking = 0;
@@ -2578,7 +2729,7 @@
 public static const double NSAppKitVersionNumberWithPatternColorLeakFix = 641.00000000000000;
 public static const int NSApplicationActivatedEventType = 1;
 public static const int NSApplicationDeactivatedEventType = 2;
-alias NSEventType.NSApplicationDefined NSApplicationDefined;
+alias Cocoa.NSEventType.NSApplicationDefined NSApplicationDefined;
 public static const int NSApplicationDefinedMask = 32768;
 public static const int NSApplicationDelegateReplyCancel = 1;
 public static const int NSApplicationDelegateReplyFailure = 2;
@@ -2596,7 +2747,7 @@
 public static const int NSBackgroundStyleLowered = 3;
 public static const int NSBackgroundStyleRaised = 2;
 public static const int NSBackgroundTab = 1;
-public static const int NSBackingStoreBuffered = 2;
+alias Cocoa.NSBackingStoreType.NSBackingStoreBuffered NSBackingStoreBuffered;
 public static const int NSBackingStoreNonretained = 1;
 public static const int NSBackingStoreRetained = 0;
 public static const int NSBackspaceCharacter = 8;
@@ -2604,11 +2755,11 @@
 public static const int NSBeginFunctionKey = 63274;
 public static const int NSBelowBottom = 6;
 public static const int NSBelowTop = 3;
-public static const int NSBevelLineJoinStyle = 2;
+alias Cocoa.NSLineJoinStyle.NSBevelLineJoinStyle NSBevelLineJoinStyle;
 alias NSBorderType.NSBezelBorder NSBezelBorder;
 public static const int NSBlueControlTint = 1;
 public static const int NSBoldFontMask = 2;
-public static const int NSBorderlessWindowMask = 0;
+alias Cocoa.NSBorderlessWindowMask NSBorderlessWindowMask;
 public static const int NSBottomTabsBezelBorder = 2;
 public static const int NSBoxCustom = 4;
 public static const int NSBoxOldStyle = 3;
@@ -2621,7 +2772,7 @@
 public static const int NSBrowserDropOn = 0;
 public static const int NSBrowserNoColumnResizing = 0;
 public static const int NSBrowserUserColumnResizing = 2;
-public static const int NSButtLineCapStyle = 0;
+alias Cocoa.NSLineCapStyle.NSButtLineCapStyle NSButtLineCapStyle;
 public static const int NSCMYKColorSpaceModel = 2;
 public static const int NSCMYKModeColorPanel = 2;
 public static const int NSCancelButton = 0;
@@ -2646,7 +2797,7 @@
 public static const int NSCellLightsByGray = 7;
 public static const int NSCellState = 1;
 public static const int NSCenterTabStopType = 2;
-alias NSTextAlignment.NSCenterTextAlignment NSCenterTextAlignment;
+alias Cocoa.NSTextAlignment.NSCenterTextAlignment NSCenterTextAlignment;
 public static const int NSChangeAutosaved = 4;
 public static const int NSChangeBackgroundCell = 8;
 public static const int NSChangeBackgroundCellMask = 8;
@@ -2665,7 +2816,7 @@
 public static const int NSClipPagination = 2;
 public static const int NSClockAndCalendarDatePickerStyle = 1;
 public static const int NSClosableWindowMask = 2;
-public static const int NSClosePathBezierPathElement = 3;
+alias Cocoa.NSBezierPathElement.NSClosePathBezierPathElement NSClosePathBezierPathElement;
 public static const int NSColorListModeColorPanel = 5;
 public static const int NSColorPanelAllModesMask = 65535;
 public static const int NSColorPanelCMYKModeMask = 4;
@@ -2694,7 +2845,7 @@
 public static const int NSCompositeSourceAtop = 5;
 public static const int NSCompositeSourceIn = 3;
 public static const int NSCompositeSourceOut = 4;
-public static const int NSCompositeSourceOver = 2;
+alias Cocoa.NSCompositingOperation.NSCompositeSourceOver NSCompositeSourceOver;
 alias Cocoa.NSCompositingOperation.NSCompositeXOR NSCompositeXOR;
 public static const int NSCompressedFontMask = 512;
 public static const int NSCondensedFontMask = 64;
@@ -2703,12 +2854,12 @@
 public static const int NSControlGlyph = 16777215;
 public static const int NSControlKeyMask = 262144;
 public static const int NSCrayonModeColorPanel = 7;
-public static const int NSCriticalAlertStyle = 2;
+alias Cocoa.NSAlertStyle.NSCriticalAlertStyle NSCriticalAlertStyle;
 public static const int NSCriticalRequest = 0;
 public static const int NSCursorPointingDevice = 2;
 public static const int NSCursorUpdate = 17;
 public static const int NSCursorUpdateMask = 131072;
-public static const int NSCurveToBezierPathElement = 2;
+alias Cocoa.NSBezierPathElement.NSCurveToBezierPathElement NSCurveToBezierPathElement;
 public static const int NSCustomPaletteModeColorPanel = 4;
 public static const int NSDecimalTabStopType = 3;
 public static const int NSDefaultControlTint = 0;
@@ -2747,7 +2898,7 @@
 public static const int NSEnterCharacter = 3;
 public static const int NSEraDatePickerElementFlag = 256;
 public static const int NSEraserPointingDevice = 3;
-public static const int NSEvenOddWindingRule = 1;
+alias Cocoa.NSWindingRule.NSEvenOddWindingRule NSEvenOddWindingRule;
 public static const int NSExclude10_4ElementsIconCreationOption = 4;
 public static const int NSExcludeQuickDrawElementsIconCreationOption = 2;
 public static const int NSExecuteFunctionKey = 63298;
@@ -2875,8 +3026,8 @@
 public static const int NSGradientConcaveWeak = 1;
 public static const int NSGradientConvexStrong = 4;
 public static const int NSGradientConvexWeak = 3;
-public static const int NSGradientDrawsAfterEndingLocation = 2;
-public static const int NSGradientDrawsBeforeStartingLocation = 1;
+alias Cocoa.NSGradientDrawingOptions.NSGradientDrawsAfterEndingLocation NSGradientDrawsAfterEndingLocation;
+alias Cocoa.NSGradientDrawingOptions.NSGradientDrawsBeforeStartingLocation NSGradientDrawsBeforeStartingLocation;
 public static const int NSGradientNone = 0;
 public static const int NSGraphiteControlTint = 6;
 public static const int NSGrayColorSpaceModel = 0;
@@ -2909,18 +3060,18 @@
 public static const int NSImageCacheAlways = 1;
 public static const int NSImageCacheBySize = 2;
 public static const int NSImageCacheDefault = 0;
-alias NSImageCacheMode.NSImageCacheNever NSImageCacheNever;
+alias Cocoa.NSImageCacheMode.NSImageCacheNever NSImageCacheNever;
 public static const int NSImageCellType = 2;
 public static const int NSImageFrameButton = 4;
 public static const int NSImageFrameGrayBezel = 2;
 public static const int NSImageFrameGroove = 3;
 public static const int NSImageFrameNone = 0;
 public static const int NSImageFramePhoto = 1;
-public static const int NSImageInterpolationDefault = 0;
-public static const int NSImageInterpolationHigh = 3;
-public static const int NSImageInterpolationLow = 2;
-public static const int NSImageInterpolationNone = 1;
-alias NSCellImagePosition.NSImageLeft NSImageLeft;
+alias Cocoa.NSImageInterpolation.NSImageInterpolationDefault NSImageInterpolationDefault;
+alias Cocoa.NSImageInterpolation.NSImageInterpolationHigh NSImageInterpolationHigh;
+alias Cocoa.NSImageInterpolation.NSImageInterpolationLow NSImageInterpolationLow;
+alias Cocoa.NSImageInterpolation.NSImageInterpolationNone NSImageInterpolationNone;
+alias Cocoa.NSCellImagePosition.NSImageLeft NSImageLeft;
 public static const int NSImageLoadStatusCancelled = 1;
 public static const int NSImageLoadStatusCompleted = 0;
 public static const int NSImageLoadStatusInvalidData = 2;
@@ -2941,7 +3092,7 @@
 public static const int NSImageScaleProportionallyDown = 0;
 public static const int NSImageScaleProportionallyUpOrDown = 3;
 public static const int NSIndexedColorSpaceModel = 5;
-public static const int NSInformationalAlertStyle = 1;
+alias Cocoa.NSAlertStyle.NSInformationalAlertStyle NSInformationalAlertStyle;
 public static const int NSInformationalRequest = 10;
 public static const int NSInsertCharFunctionKey = 63293;
 public static const int NSInsertFunctionKey = 63271;
@@ -2950,7 +3101,7 @@
 public static const int NSItalicFontMask = 1;
 public static const int NSJPEG2000FileType = 5;
 public static const int NSJPEGFileType = 3;
-public static const int NSJustifiedTextAlignment = 3;
+alias Cocoa.NSTextAlignment.NSJustifiedTextAlignment NSJustifiedTextAlignment;
 public static const int NSKeyDown = 10;
 public static const int NSKeyDownMask = 1024;
 public static const int NSKeyUp = 11;
@@ -2964,18 +3115,18 @@
 public static const int NSLeftMouseDraggedMask = 64;
 public static const int NSLeftMouseUp = 2;
 public static const int NSLeftMouseUpMask = 4;
-public static const int NSLeftTabStopType = 0;
+alias Cocoa.NSTextTabType.NSLeftTabStopType NSLeftTabStopType;
 public static const int NSLeftTabsBezelBorder = 1;
-alias NSTextAlignment.NSLeftTextAlignment NSLeftTextAlignment;
+alias Cocoa.NSTextAlignment.NSLeftTextAlignment NSLeftTextAlignment;
 public static const int NSLeftTextMovement = 19;
 public static const int NSLighterFontAction = 6;
 public static const int NSLineBorder = 1;
 public static const int NSLineBreakByCharWrapping = 1;
-alias NSLineBreakMode.NSLineBreakByClipping NSLineBreakByClipping;
+alias Cocoa.NSLineBreakMode.NSLineBreakByClipping NSLineBreakByClipping;
 public static const int NSLineBreakByTruncatingHead = 3;
 public static const int NSLineBreakByTruncatingMiddle = 5;
 public static const int NSLineBreakByTruncatingTail = 4;
-public static const int NSLineBreakByWordWrapping = 0;
+alias Cocoa.NSLineBreakMode.NSLineBreakByWordWrapping NSLineBreakByWordWrapping;
 public static const int NSLineDoesntMove = 0;
 public static const int NSLineMovesDown = 3;
 public static const int NSLineMovesLeft = 1;
@@ -2986,7 +3137,7 @@
 public static const int NSLineSweepLeft = 0;
 public static const int NSLineSweepRight = 1;
 public static const int NSLineSweepUp = 3;
-public static const int NSLineToBezierPathElement = 1;
+alias Cocoa.NSBezierPathElement.NSLineToBezierPathElement NSLineToBezierPathElement;
 public static const int NSLinearSlider = 0;
 public static const int NSListModeMatrix = 2;
 public static const int NSMacintoshInterfaceStyle = 3;
@@ -2994,13 +3145,13 @@
 public static const int NSMenuFunctionKey = 63285;
 public static const int NSMiniControlSize = 2;
 public static const int NSMiniaturizableWindowMask = 4;
-public static const int NSMiterLineJoinStyle = 0;
+alias Cocoa.NSLineJoinStyle.NSMiterLineJoinStyle NSMiterLineJoinStyle;
 public static const int NSMixedState = -1;
 public static const int NSModalPanelWindowLevel = 8;
 public static const int NSModeSwitchFunctionKey = 63303;
 public static const int NSMomentaryChangeButton = 5;
 public static const int NSMomentaryLight = 7;
-alias NSButtonType.NSMomentaryLightButton NSMomentaryLightButton;
+alias Cocoa.NSButtonType.NSMomentaryLightButton NSMomentaryLightButton;
 public static const int NSMomentaryPushButton = 0;
 public static const int NSMomentaryPushInButton = 7;
 public static const int NSMouseEntered = 8;
@@ -3010,7 +3161,7 @@
 public static const int NSMouseExitedMask = 512;
 public static const int NSMouseMoved = 5;
 public static const int NSMouseMovedMask = 32;
-public static const int NSMoveToBezierPathElement = 0;
+alias Cocoa.NSBezierPathElement.NSMoveToBezierPathElement NSMoveToBezierPathElement;
 public static const int NSNarrowFontMask = 16;
 public static const int NSNativeShortGlyphPacking = 5;
 public static const int NSNaturalTextAlignment = 4;
@@ -3030,7 +3181,7 @@
 public static const int NSNoTitle = 0;
 public static const int NSNoUnderlineStyle = 0;
 public static const int NSNonStandardCharacterSetFontMask = 8;
-public static const int NSNonZeroWindingRule = 0;
+alias Cocoa.NSWindingRule.NSNonZeroWindingRule NSNonZeroWindingRule;
 public static const int NSNonactivatingPanelMask = 128;
 public static const int NSNormalWindowLevel = 0;
 public static const int NSNullCellType = 0;
@@ -3148,20 +3299,20 @@
 public static const int NSProgressIndicatorSpinningStyle = 1;
 public static const int NSPushInCell = 2;
 public static const int NSPushInCellMask = 2;
-alias NSButtonType.NSPushOnPushOffButton NSPushOnPushOffButton;
+alias Cocoa.NSButtonType.NSPushOnPushOffButton NSPushOnPushOffButton;
 public static const int NSQTMovieLoopingBackAndForthPlayback = 2;
 public static const int NSQTMovieLoopingPlayback = 1;
 public static const int NSQTMovieNormalPlayback = 0;
 public static const int NSRGBColorSpaceModel = 1;
 public static const int NSRGBModeColorPanel = 1;
-alias NSButtonType.NSRadioButton NSRadioButton; 
+alias Cocoa.NSButtonType.NSRadioButton NSRadioButton; 
 public static const int NSRadioModeMatrix = 0;
 public static const int NSRangeDateMode = 1;
 public static const int NSRatingLevelIndicatorStyle = 3;
 public static const int NSRecessedBezelStyle = 13;
 public static const int NSRedoFunctionKey = 63300;
 public static const int NSRegularControlSize = 0;
-alias NSBezelStyle.NSRegularSquareBezelStyle NSRegularSquareBezelStyle;
+alias Cocoa.NSBezelStyle.NSRegularSquareBezelStyle NSRegularSquareBezelStyle;
 public static const int NSRelevancyLevelIndicatorStyle = 0;
 public static const int NSRemoveTraitFontAction = 7;
 public static const int NSResetCursorRectsRunLoopOrdering = 700000;
@@ -3177,12 +3328,12 @@
 public static const int NSRightMouseUpMask = 16;
 public static const int NSRightTabStopType = 1;
 public static const int NSRightTabsBezelBorder = 3;
-alias NSTextAlignment.NSRightTextAlignment NSRightTextAlignment;
+alias Cocoa.NSTextAlignment.NSRightTextAlignment NSRightTextAlignment;
 public static const int NSRightTextMovement = 20;
-public static const int NSRoundLineCapStyle = 1;
-public static const int NSRoundLineJoinStyle = 1;
+alias Cocoa.NSLineCapStyle.NSRoundLineCapStyle NSRoundLineCapStyle;
+alias Cocoa.NSLineJoinStyle.NSRoundLineJoinStyle NSRoundLineJoinStyle;
 public static const int NSRoundRectBezelStyle = 12;
-alias NSBezelStyle.NSRoundedBezelStyle NSRoundedBezelStyle;
+alias Cocoa.NSBezelStyle.NSRoundedBezelStyle NSRoundedBezelStyle;
 public static const int NSRoundedDisclosureBezelStyle = 14;
 public static const int NSRoundedTokenStyle = 2;
 public static const int NSRuleEditorNestingModeCompound = 2;
@@ -3249,7 +3400,7 @@
 public static const int NSServiceMalformedServiceDictionaryError = 66564;
 public static const int NSServiceMiscellaneousError = 66800;
 public static const int NSServiceRequestTimedOutError = 66562;
-alias NSBezelStyle.NSShadowlessSquareBezelStyle NSShadowlessSquareBezelStyle;
+alias Cocoa.NSBezelStyle.NSShadowlessSquareBezelStyle NSShadowlessSquareBezelStyle;
 public static const int NSShiftKeyMask = 131072;
 public static const int NSShowControlGlyphs = 1;
 public static const int NSShowInvisibleGlyphs = 2;
@@ -3269,7 +3420,7 @@
 public static const int NSSpellingStateSpellingFlag = 1;
 public static const int NSSplitViewDividerStyleThick = 1;
 public static const int NSSplitViewDividerStyleThin = 2;
-public static const int NSSquareLineCapStyle = 2;
+alias Cocoa.NSLineCapStyle.NSSquareLineCapStyle NSSquareLineCapStyle;
 public static const int NSSquareStatusItemLength = -2;
 public static const int NSStatusWindowLevel = 25;
 public static const int NSStopFunctionKey = 63284;
@@ -3280,7 +3431,7 @@
 public static const int NSStringDrawingUsesFontLeading = 2;
 public static const int NSStringDrawingUsesLineFragmentOrigin = 1;
 public static const int NSSubmenuWindowLevel = 3;
-alias NSButtonType.NSSwitchButton NSSwitchButton;
+alias Cocoa.NSButtonType.NSSwitchButton NSSwitchButton;
 public static const int NSSysReqFunctionKey = 63281;
 public static const int NSSystemDefined = 14;
 public static const int NSSystemDefinedMask = 16384;
@@ -3318,9 +3469,9 @@
 public static const int NSTabletProximity = 24;
 public static const int NSTabletProximityEventSubtype = 2;
 public static const int NSTabletProximityMask = 16777216;
-public static const int NSTerminateCancel = 0;
-public static const int NSTerminateLater = 2;
-public static const int NSTerminateNow = 1;
+alias Cocoa.NSApplicationTerminateReply.NSTerminateCancel NSTerminateCancel;
+alias Cocoa.NSApplicationTerminateReply.NSTerminateLater NSTerminateLater;
+alias Cocoa.NSApplicationTerminateReply.NSTerminateNow NSTerminateNow;
 public static const int NSTextBlockAbsoluteValueType = 0;
 public static const int NSTextBlockBaselineAlignment = 3;
 public static const int NSTextBlockBorder = 0;
@@ -3431,13 +3582,13 @@
 public static const int NSViewNotSizable = 0;
 public static const int NSViewWidthSizable = 2;
 public static const int NSWantsBidiLevels = 4;
-public static const int NSWarningAlertStyle = 0;
+alias Cocoa.NSAlertStyle.NSWarningAlertStyle NSWarningAlertStyle;
 public static const int NSWheelModeColorPanel = 6;
-public static const int NSWindowAbove = 1;
+alias Cocoa.NSWindowOrderingMode.NSWindowAbove NSWindowAbove;
 public static const int NSWindowBackingLocationDefault = 0;
 public static const int NSWindowBackingLocationMainMemory = 2;
 public static const int NSWindowBackingLocationVideoMemory = 1;
-public static const int NSWindowBelow = -1;
+alias Cocoa.NSWindowOrderingMode.NSWindowBelow NSWindowBelow;
 public static const int NSWindowCloseButton = 0;
 public static const int NSWindowCollectionBehaviorCanJoinAllSpaces = 1;
 public static const int NSWindowCollectionBehaviorDefault = 0;
@@ -4267,389 +4418,388 @@
 /** Globals */
 /** @method flags=const */
 alias Cocoa.NSAccessibilityButtonRole NSAccessibilityButtonRole_;
-public static const NSString NSAccessibilityButtonRole = new NSString(NSAccessibilityButtonRole_);
+public static const NSString NSAccessibilityButtonRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityCheckBoxRole NSAccessibilityCheckBoxRole_;
-public static const NSString NSAccessibilityCheckBoxRole = new NSString(NSAccessibilityCheckBoxRole_);
+public static const NSString NSAccessibilityCheckBoxRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityChildrenAttribute NSAccessibilityChildrenAttribute_;
-public static const NSString NSAccessibilityChildrenAttribute = new NSString(NSAccessibilityChildrenAttribute_);
+public static const NSString NSAccessibilityChildrenAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityColumnRole NSAccessibilityColumnRole_;
-public static const NSString NSAccessibilityColumnRole = new NSString(NSAccessibilityColumnRole_);
+public static const NSString NSAccessibilityColumnRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityComboBoxRole NSAccessibilityComboBoxRole_;
-public static const NSString NSAccessibilityComboBoxRole = new NSString(NSAccessibilityComboBoxRole_);
+public static const NSString NSAccessibilityComboBoxRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityConfirmAction NSAccessibilityConfirmAction_;
-public static const NSString NSAccessibilityConfirmAction = new NSString(NSAccessibilityConfirmAction_);
+public static const NSString NSAccessibilityConfirmAction;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityContentsAttribute NSAccessibilityContentsAttribute_;
-public static const NSString NSAccessibilityContentsAttribute = new NSString(NSAccessibilityContentsAttribute_);
+public static const NSString NSAccessibilityContentsAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityDescriptionAttribute NSAccessibilityDescriptionAttribute_;
-public static const NSString NSAccessibilityDescriptionAttribute = new NSString(NSAccessibilityDescriptionAttribute_);
+public static const NSString NSAccessibilityDescriptionAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityDialogSubrole NSAccessibilityDialogSubrole_;
-public static const NSString NSAccessibilityDialogSubrole = new NSString(NSAccessibilityDialogSubrole_);
+public static const NSString NSAccessibilityDialogSubrole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityEnabledAttribute NSAccessibilityEnabledAttribute_;
-public static const NSString NSAccessibilityEnabledAttribute = new NSString(NSAccessibilityEnabledAttribute_);
+public static const NSString NSAccessibilityEnabledAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityExpandedAttribute NSAccessibilityExpandedAttribute_;
-public static const NSString NSAccessibilityExpandedAttribute = new NSString(NSAccessibilityExpandedAttribute_);
+public static const NSString NSAccessibilityExpandedAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityFloatingWindowSubrole NSAccessibilityFloatingWindowSubrole_;
-public static const NSString NSAccessibilityFloatingWindowSubrole = new NSString(NSAccessibilityFloatingWindowSubrole_);
+public static const NSString NSAccessibilityFloatingWindowSubrole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityFocusedAttribute NSAccessibilityFocusedAttribute_;
-public static const NSString NSAccessibilityFocusedAttribute = new NSString(NSAccessibilityFocusedAttribute_);
+public static const NSString NSAccessibilityFocusedAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityFocusedUIElementChangedNotification NSAccessibilityFocusedUIElementChangedNotification_;
-public static const NSString NSAccessibilityFocusedUIElementChangedNotification = new NSString(NSAccessibilityFocusedUIElementChangedNotification_);
+public static const NSString NSAccessibilityFocusedUIElementChangedNotification;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityGridRole NSAccessibilityGridRole_;
-public static const NSString NSAccessibilityGridRole = new NSString(NSAccessibilityGridRole_);
+public static const NSString NSAccessibilityGridRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityGroupRole NSAccessibilityGroupRole_;
-public static const NSString NSAccessibilityGroupRole = new NSString(NSAccessibilityGroupRole_);
+public static const NSString NSAccessibilityGroupRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityHelpAttribute NSAccessibilityHelpAttribute_;
-public static const NSString NSAccessibilityHelpAttribute = new NSString(NSAccessibilityHelpAttribute_);
+public static const NSString NSAccessibilityHelpAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityHelpTagRole NSAccessibilityHelpTagRole_;
-public static const NSString NSAccessibilityHelpTagRole = new NSString(NSAccessibilityHelpTagRole_);
+public static const NSString NSAccessibilityHelpTagRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityHorizontalOrientationValue NSAccessibilityHorizontalOrientationValue_;
-public static const NSString NSAccessibilityHorizontalOrientationValue = new NSString(NSAccessibilityHorizontalOrientationValue_);
+public static const NSString NSAccessibilityHorizontalOrientationValue;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityHorizontalScrollBarAttribute NSAccessibilityHorizontalScrollBarAttribute_;
-public static const NSString NSAccessibilityHorizontalScrollBarAttribute = new NSString(NSAccessibilityHorizontalScrollBarAttribute_);
+public static const NSString NSAccessibilityHorizontalScrollBarAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityImageRole NSAccessibilityImageRole_;
-public static const NSString NSAccessibilityImageRole = new NSString(NSAccessibilityImageRole_);
+public static const NSString NSAccessibilityImageRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityIncrementorRole NSAccessibilityIncrementorRole_;
-public static const NSString NSAccessibilityIncrementorRole = new NSString(NSAccessibilityIncrementorRole_);
+public static const NSString NSAccessibilityIncrementorRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityInsertionPointLineNumberAttribute NSAccessibilityInsertionPointLineNumberAttribute_;
-public static const NSString NSAccessibilityInsertionPointLineNumberAttribute = new NSString(NSAccessibilityInsertionPointLineNumberAttribute_);
+public static const NSString NSAccessibilityInsertionPointLineNumberAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityLabelValueAttribute NSAccessibilityLabelValueAttribute_;
-public static const NSString NSAccessibilityLabelValueAttribute = new NSString(NSAccessibilityLabelValueAttribute_);
+public static const NSString NSAccessibilityLabelValueAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityLineForIndexParameterizedAttribute NSAccessibilityLineForIndexParameterizedAttribute_;
-public static const NSString NSAccessibilityLineForIndexParameterizedAttribute = new NSString(NSAccessibilityLineForIndexParameterizedAttribute_);
+public static const NSString NSAccessibilityLineForIndexParameterizedAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityLinkRole NSAccessibilityLinkRole_;
-public static const NSString NSAccessibilityLinkRole = new NSString(NSAccessibilityLinkRole_);
+public static const NSString NSAccessibilityLinkRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityLinkTextAttribute NSAccessibilityLinkTextAttribute_;
-public static const NSString NSAccessibilityLinkTextAttribute = new NSString(NSAccessibilityLinkTextAttribute_);
+public static const NSString NSAccessibilityLinkTextAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityListRole NSAccessibilityListRole_;
-public static const NSString NSAccessibilityListRole = new NSString(NSAccessibilityListRole_);
+public static const NSString NSAccessibilityListRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityMaxValueAttribute NSAccessibilityMaxValueAttribute_;
-public static const NSString NSAccessibilityMaxValueAttribute = new NSString(NSAccessibilityMaxValueAttribute_);
+public static const NSString NSAccessibilityMaxValueAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityMenuBarRole NSAccessibilityMenuBarRole_;
-public static const NSString NSAccessibilityMenuBarRole = new NSString(NSAccessibilityMenuBarRole_);
+public static const NSString NSAccessibilityMenuBarRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityMenuButtonRole NSAccessibilityMenuButtonRole_;
-public static const NSString NSAccessibilityMenuButtonRole = new NSString(NSAccessibilityMenuButtonRole_);
+public static const NSString NSAccessibilityMenuButtonRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityMenuItemRole NSAccessibilityMenuItemRole_;
-public static const NSString NSAccessibilityMenuItemRole = new NSString(NSAccessibilityMenuItemRole_);
+public static const NSString NSAccessibilityMenuItemRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityMenuRole NSAccessibilityMenuRole_;
-public static const NSString NSAccessibilityMenuRole = new NSString(NSAccessibilityMenuRole_);
+public static const NSString NSAccessibilityMenuRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityMinValueAttribute NSAccessibilityMinValueAttribute_;
-public static const NSString NSAccessibilityMinValueAttribute = new NSString(NSAccessibilityMinValueAttribute_);
+public static const NSString NSAccessibilityMinValueAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityNextContentsAttribute NSAccessibilityNextContentsAttribute_;
-public static const NSString NSAccessibilityNextContentsAttribute = new NSString(NSAccessibilityNextContentsAttribute_);
+public static const NSString NSAccessibilityNextContentsAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityNumberOfCharactersAttribute NSAccessibilityNumberOfCharactersAttribute_;
-public static const NSString NSAccessibilityNumberOfCharactersAttribute = new NSString(NSAccessibilityNumberOfCharactersAttribute_);
+public static const NSString NSAccessibilityNumberOfCharactersAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityOrientationAttribute NSAccessibilityOrientationAttribute_;
-public static const NSString NSAccessibilityOrientationAttribute = new NSString(NSAccessibilityOrientationAttribute_);
+public static const NSString NSAccessibilityOrientationAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityOutlineRole NSAccessibilityOutlineRole_;
-public static const NSString NSAccessibilityOutlineRole = new NSString(NSAccessibilityOutlineRole_);
+public static const NSString NSAccessibilityOutlineRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityOutlineRowSubrole NSAccessibilityOutlineRowSubrole_;
-public static const NSString NSAccessibilityOutlineRowSubrole = new NSString(NSAccessibilityOutlineRowSubrole_);
+public static const NSString NSAccessibilityOutlineRowSubrole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityParentAttribute NSAccessibilityParentAttribute_;
-public static const NSString NSAccessibilityParentAttribute = new NSString(NSAccessibilityParentAttribute_);
+public static const NSString NSAccessibilityParentAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityPopUpButtonRole NSAccessibilityPopUpButtonRole_;
-public static const NSString NSAccessibilityPopUpButtonRole = new NSString(NSAccessibilityPopUpButtonRole_);
+public static const NSString NSAccessibilityPopUpButtonRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityPositionAttribute NSAccessibilityPositionAttribute_;
-public static const NSString NSAccessibilityPositionAttribute = new NSString(NSAccessibilityPositionAttribute_);
+public static const NSString NSAccessibilityPositionAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityPressAction NSAccessibilityPressAction_;
-public static const NSString NSAccessibilityPressAction = new NSString(NSAccessibilityPressAction_);
+public static const NSString NSAccessibilityPressAction;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityPreviousContentsAttribute NSAccessibilityPreviousContentsAttribute_;
-public static const NSString NSAccessibilityPreviousContentsAttribute = new NSString(NSAccessibilityPreviousContentsAttribute_);
+public static const NSString NSAccessibilityPreviousContentsAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityProgressIndicatorRole NSAccessibilityProgressIndicatorRole_;
-public static const NSString NSAccessibilityProgressIndicatorRole = new NSString(NSAccessibilityProgressIndicatorRole_);
+public static const NSString NSAccessibilityProgressIndicatorRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityRTFForRangeParameterizedAttribute NSAccessibilityRTFForRangeParameterizedAttribute_;
-public static const NSString NSAccessibilityRTFForRangeParameterizedAttribute = new NSString(NSAccessibilityRTFForRangeParameterizedAttribute_);
+public static const NSString NSAccessibilityRTFForRangeParameterizedAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityRadioButtonRole NSAccessibilityRadioButtonRole_;
-public static const NSString NSAccessibilityRadioButtonRole = new NSString(NSAccessibilityRadioButtonRole_);
+public static const NSString NSAccessibilityRadioButtonRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityRadioGroupRole NSAccessibilityRadioGroupRole_;
-public static const NSString NSAccessibilityRadioGroupRole = new NSString(NSAccessibilityRadioGroupRole_);
+public static const NSString NSAccessibilityRadioGroupRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityRangeForIndexParameterizedAttribute NSAccessibilityRangeForIndexParameterizedAttribute_;
-public static const NSString NSAccessibilityRangeForIndexParameterizedAttribute = new NSString(NSAccessibilityRangeForIndexParameterizedAttribute_);
+public static const NSString NSAccessibilityRangeForIndexParameterizedAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityRangeForLineParameterizedAttribute NSAccessibilityRangeForLineParameterizedAttribute_;
-public static const NSString NSAccessibilityRangeForLineParameterizedAttribute = new NSString(NSAccessibilityRangeForLineParameterizedAttribute_);
+public static const NSString NSAccessibilityRangeForLineParameterizedAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityRangeForPositionParameterizedAttribute NSAccessibilityRangeForPositionParameterizedAttribute_;
-public static const NSString NSAccessibilityRangeForPositionParameterizedAttribute = new NSString(NSAccessibilityRangeForPositionParameterizedAttribute_);
+public static const NSString NSAccessibilityRangeForPositionParameterizedAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityRoleAttribute NSAccessibilityRoleAttribute_;
-public static const NSString NSAccessibilityRoleAttribute = new NSString(NSAccessibilityRoleAttribute_);
+public static const NSString NSAccessibilityRoleAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityRoleDescriptionAttribute NSAccessibilityRoleDescriptionAttribute_;
-public static const NSString NSAccessibilityRoleDescriptionAttribute = new NSString(NSAccessibilityRoleDescriptionAttribute_);
+public static const NSString NSAccessibilityRoleDescriptionAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityRowRole NSAccessibilityRowRole_;
-public static const NSString NSAccessibilityRowRole = new NSString(NSAccessibilityRowRole_);
+public static const NSString NSAccessibilityRowRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityScrollAreaRole NSAccessibilityScrollAreaRole_;
-public static const NSString NSAccessibilityScrollAreaRole = new NSString(NSAccessibilityScrollAreaRole_);
+public static const NSString NSAccessibilityScrollAreaRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityScrollBarRole NSAccessibilityScrollBarRole_;
-public static const NSString NSAccessibilityScrollBarRole = new NSString(NSAccessibilityScrollBarRole_);
+public static const NSString NSAccessibilityScrollBarRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilitySelectedAttribute NSAccessibilitySelectedAttribute_;
-public static const NSString NSAccessibilitySelectedAttribute = new NSString(NSAccessibilitySelectedAttribute_);
+public static const NSString NSAccessibilitySelectedAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilitySelectedChildrenAttribute NSAccessibilitySelectedChildrenAttribute_;
-public static const NSString NSAccessibilitySelectedChildrenAttribute = new NSString(NSAccessibilitySelectedChildrenAttribute_);
+public static const NSString NSAccessibilitySelectedChildrenAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilitySelectedChildrenChangedNotification NSAccessibilitySelectedChildrenChangedNotification_;
-public static const NSString NSAccessibilitySelectedChildrenChangedNotification = new NSString(NSAccessibilitySelectedChildrenChangedNotification_);
+public static const NSString NSAccessibilitySelectedChildrenChangedNotification;
 /** @method flags=const */
 alias Cocoa.NSAccessibilitySelectedTextAttribute NSAccessibilitySelectedTextAttribute_;
-public static const NSString NSAccessibilitySelectedTextAttribute = new NSString(NSAccessibilitySelectedTextAttribute_);
+public static const NSString NSAccessibilitySelectedTextAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilitySelectedTextChangedNotification NSAccessibilitySelectedTextChangedNotification_;
-public static const NSString NSAccessibilitySelectedTextChangedNotification = new NSString(NSAccessibilitySelectedTextChangedNotification_);
+public static const NSString NSAccessibilitySelectedTextChangedNotification;
 /** @method flags=const */
 alias Cocoa.NSAccessibilitySelectedTextRangeAttribute NSAccessibilitySelectedTextRangeAttribute_;
-public static const NSString NSAccessibilitySelectedTextRangeAttribute = new NSString(NSAccessibilitySelectedTextRangeAttribute_);
+public static const NSString NSAccessibilitySelectedTextRangeAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilitySelectedTextRangesAttribute NSAccessibilitySelectedTextRangesAttribute_;
-public static const NSString NSAccessibilitySelectedTextRangesAttribute = new NSString(NSAccessibilitySelectedTextRangesAttribute_);
+public static const NSString NSAccessibilitySelectedTextRangesAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilitySizeAttribute NSAccessibilitySizeAttribute_;
-public static const NSString NSAccessibilitySizeAttribute = new NSString(NSAccessibilitySizeAttribute_);
+public static const NSString NSAccessibilitySizeAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilitySliderRole NSAccessibilitySliderRole_;
-public static const NSString NSAccessibilitySliderRole = new NSString(NSAccessibilitySliderRole_);
+public static const NSString NSAccessibilitySliderRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilitySortButtonRole NSAccessibilitySortButtonRole_;
-public static const NSString NSAccessibilitySortButtonRole = new NSString(NSAccessibilitySortButtonRole_);
+public static const NSString NSAccessibilitySortButtonRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilitySplitterRole NSAccessibilitySplitterRole_;
-public static const NSString NSAccessibilitySplitterRole = new NSString(NSAccessibilitySplitterRole_);
+public static const NSString NSAccessibilitySplitterRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityStandardWindowSubrole NSAccessibilityStandardWindowSubrole_;
-public static const NSString NSAccessibilityStandardWindowSubrole = new NSString(NSAccessibilityStandardWindowSubrole_);
+public static const NSString NSAccessibilityStandardWindowSubrole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityStaticTextRole NSAccessibilityStaticTextRole_;
-public static const NSString NSAccessibilityStaticTextRole = new NSString(NSAccessibilityStaticTextRole_);
+public static const NSString NSAccessibilityStaticTextRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityStringForRangeParameterizedAttribute NSAccessibilityStringForRangeParameterizedAttribute_;
-public static const NSString NSAccessibilityStringForRangeParameterizedAttribute = new NSString(NSAccessibilityStringForRangeParameterizedAttribute_);
+public static const NSString NSAccessibilityStringForRangeParameterizedAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityStyleRangeForIndexParameterizedAttribute NSAccessibilityStyleRangeForIndexParameterizedAttribute_;
-public static const NSString NSAccessibilityStyleRangeForIndexParameterizedAttribute = new NSString(NSAccessibilityStyleRangeForIndexParameterizedAttribute_);
+public static const NSString NSAccessibilityStyleRangeForIndexParameterizedAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilitySubroleAttribute NSAccessibilitySubroleAttribute_;
-public static const NSString NSAccessibilitySubroleAttribute = new NSString(NSAccessibilitySubroleAttribute_);
+public static const NSString NSAccessibilitySubroleAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilitySystemDialogSubrole NSAccessibilitySystemDialogSubrole_;
-public static const NSString NSAccessibilitySystemDialogSubrole = new NSString(NSAccessibilitySystemDialogSubrole_);
+public static const NSString NSAccessibilitySystemDialogSubrole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityTabGroupRole NSAccessibilityTabGroupRole_;
-public static const NSString NSAccessibilityTabGroupRole = new NSString(NSAccessibilityTabGroupRole_);
+public static const NSString NSAccessibilityTabGroupRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityTableRole NSAccessibilityTableRole_;
-public static const NSString NSAccessibilityTableRole = new NSString(NSAccessibilityTableRole_);
+public static const NSString NSAccessibilityTableRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityTableRowSubrole NSAccessibilityTableRowSubrole_;
-public static const NSString NSAccessibilityTableRowSubrole = new NSString(NSAccessibilityTableRowSubrole_);
+public static const NSString NSAccessibilityTableRowSubrole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityTabsAttribute NSAccessibilityTabsAttribute_;
-public static const NSString NSAccessibilityTabsAttribute = new NSString(NSAccessibilityTabsAttribute_);
+public static const NSString NSAccessibilityTabsAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityTextAreaRole NSAccessibilityTextAreaRole_;
-public static const NSString NSAccessibilityTextAreaRole = new NSString(NSAccessibilityTextAreaRole_);
+public static const NSString NSAccessibilityTextAreaRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityTextFieldRole NSAccessibilityTextFieldRole_;
-public static const NSString NSAccessibilityTextFieldRole = new NSString(NSAccessibilityTextFieldRole_);
+public static const NSString NSAccessibilityTextFieldRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityTextLinkSubrole NSAccessibilityTextLinkSubrole_;
-public static const NSString NSAccessibilityTextLinkSubrole = new NSString(NSAccessibilityTextLinkSubrole_);
+public static const NSString NSAccessibilityTextLinkSubrole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityTitleAttribute NSAccessibilityTitleAttribute_;
-public static const NSString NSAccessibilityTitleAttribute = new NSString(NSAccessibilityTitleAttribute_);
+public static const NSString NSAccessibilityTitleAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityTitleUIElementAttribute NSAccessibilityTitleUIElementAttribute_;
-public static const NSString NSAccessibilityTitleUIElementAttribute = new NSString(NSAccessibilityTitleUIElementAttribute_);
+public static const NSString NSAccessibilityTitleUIElementAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityToolbarRole NSAccessibilityToolbarRole_;
-public static const NSString NSAccessibilityToolbarRole = new NSString(NSAccessibilityToolbarRole_);
+public static const NSString NSAccessibilityToolbarRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityTopLevelUIElementAttribute NSAccessibilityTopLevelUIElementAttribute_;
-public static const NSString NSAccessibilityTopLevelUIElementAttribute = new NSString(NSAccessibilityTopLevelUIElementAttribute_);
+public static const NSString NSAccessibilityTopLevelUIElementAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityUnknownRole NSAccessibilityUnknownRole_;
-public static const NSString NSAccessibilityUnknownRole = new NSString(NSAccessibilityUnknownRole_);
+public static const NSString NSAccessibilityUnknownRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityUnknownSubrole NSAccessibilityUnknownSubrole_;
-public static const NSString NSAccessibilityUnknownSubrole = new NSString(NSAccessibilityUnknownSubrole_);
+public static const NSString NSAccessibilityUnknownSubrole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityValueAttribute NSAccessibilityValueAttribute_;
-public static const NSString NSAccessibilityValueAttribute = new NSString(NSAccessibilityValueAttribute_);
+public static const NSString NSAccessibilityValueAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityValueChangedNotification NSAccessibilityValueChangedNotification_;
-public static const NSString NSAccessibilityValueChangedNotification = new NSString(NSAccessibilityValueChangedNotification_);
+public static const NSString NSAccessibilityValueChangedNotification;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityValueDescriptionAttribute NSAccessibilityValueDescriptionAttribute_;
-public static const NSString NSAccessibilityValueDescriptionAttribute = new NSString(NSAccessibilityValueDescriptionAttribute_);
+public static const NSString NSAccessibilityValueDescriptionAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityValueIndicatorRole NSAccessibilityValueIndicatorRole_;
-public static const NSString NSAccessibilityValueIndicatorRole = new NSString(NSAccessibilityValueIndicatorRole_);
+public static const NSString NSAccessibilityValueIndicatorRole;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityVerticalOrientationValue NSAccessibilityVerticalOrientationValue_;
-public static const NSString NSAccessibilityVerticalOrientationValue = new NSString(NSAccessibilityVerticalOrientationValue_);
+public static const NSString NSAccessibilityVerticalOrientationValue;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityVerticalScrollBarAttribute NSAccessibilityVerticalScrollBarAttribute_;
-public static const NSString NSAccessibilityVerticalScrollBarAttribute = new NSString(NSAccessibilityVerticalScrollBarAttribute_);
+public static const NSString NSAccessibilityVerticalScrollBarAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityVisibleCharacterRangeAttribute NSAccessibilityVisibleCharacterRangeAttribute_;
-public static const NSString NSAccessibilityVisibleCharacterRangeAttribute = new NSString(NSAccessibilityVisibleCharacterRangeAttribute_);
+public static const NSString NSAccessibilityVisibleCharacterRangeAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityVisibleChildrenAttribute NSAccessibilityVisibleChildrenAttribute_;
-public static const NSString NSAccessibilityVisibleChildrenAttribute = new NSString(NSAccessibilityVisibleChildrenAttribute_);
+public static const NSString NSAccessibilityVisibleChildrenAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityWindowAttribute NSAccessibilityWindowAttribute_;
-public static const NSString NSAccessibilityWindowAttribute = new NSString(NSAccessibilityWindowAttribute_);
+public static const NSString NSAccessibilityWindowAttribute;
 /** @method flags=const */
 alias Cocoa.NSAccessibilityWindowRole NSAccessibilityWindowRole_;
-public static const NSString NSAccessibilityWindowRole = new NSString(NSAccessibilityWindowRole_);
+public static const NSString NSAccessibilityWindowRole;
 /** @method flags=const */
 alias Cocoa.NSBackgroundColorAttributeName NSBackgroundColorAttributeName_;
-public static const NSString NSBackgroundColorAttributeName = new NSString(NSBackgroundColorAttributeName_);
+public static const NSString NSBackgroundColorAttributeName;
 /** @method flags=const */
 alias Cocoa.NSBaselineOffsetAttributeName NSBaselineOffsetAttributeName_;
-public static const NSString NSBaselineOffsetAttributeName = new NSString(NSBaselineOffsetAttributeName_);
+public static const NSString NSBaselineOffsetAttributeName;
 /** @method flags=const */
 alias Cocoa.NSCalibratedRGBColorSpace NSCalibratedRGBColorSpace_;
-public static const NSString NSCalibratedRGBColorSpace = new NSString(NSCalibratedRGBColorSpace_);
+public static const NSString NSCalibratedRGBColorSpace;
 /** @method flags=const */
 alias Cocoa.NSDeviceRGBColorSpace NSDeviceRGBColorSpace_;
-public static const NSString NSDeviceRGBColorSpace = new NSString(NSDeviceRGBColorSpace_);
+public static const NSString NSDeviceRGBColorSpace;
 /** @method flags=const */
 alias Cocoa.NSDeviceResolution NSDeviceResolution_;
-public static const NSString NSDeviceResolution = new NSString(NSDeviceResolution_);
+public static const NSString NSDeviceResolution;
 /** @method flags=const */
 alias Cocoa.NSDragPboard NSDragPboard_;
-public static const NSString NSDragPboard = new NSString(NSDragPboard_);
+public static const NSString NSDragPboard;
 /** @method flags=const */
 alias Cocoa.NSFilenamesPboardType NSFilenamesPboardType_;
-public static const NSString NSFilenamesPboardType = new NSString(NSFilenamesPboardType_);
+public static const NSString NSFilenamesPboardType;
 /** @method flags=const */
 alias Cocoa.NSFontAttributeName NSFontAttributeName_;
-public static const NSString NSFontAttributeName = new NSString(NSFontAttributeName_);
+public static const NSString NSFontAttributeName;
 /** @method flags=const */
 alias Cocoa.NSForegroundColorAttributeName NSForegroundColorAttributeName_;
-public static const NSString NSForegroundColorAttributeName = new NSString(NSForegroundColorAttributeName_);
+public static const NSString NSForegroundColorAttributeName;
 /** @method flags=const */
 alias Cocoa.NSHTMLPboardType NSHTMLPboardType_;
-public static const NSString NSHTMLPboardType = new NSString(NSHTMLPboardType_);
+public static const NSString NSHTMLPboardType;
 /** @method flags=const */
 alias Cocoa.NSLinkAttributeName NSLinkAttributeName_;
-public static const NSString NSLinkAttributeName = new NSString(NSLinkAttributeName_);
+public static const NSString NSLinkAttributeName;
 /** @method flags=const */
 alias Cocoa.NSParagraphStyleAttributeName NSParagraphStyleAttributeName_;
-public static const NSString NSParagraphStyleAttributeName = new NSString(NSParagraphStyleAttributeName_);
+public static const NSString NSParagraphStyleAttributeName;
 /** @method flags=const */
 alias Cocoa.NSPrintAllPages NSPrintAllPages_;
-public static const NSString NSPrintAllPages = new NSString(NSPrintAllPages_);
+public static const NSString NSPrintAllPages;
 /** @method flags=const */
 alias Cocoa.NSPrintCopies NSPrintCopies_;
-public static const NSString NSPrintCopies = new NSString(NSPrintCopies_);
+public static const NSString NSPrintCopies;
 /** @method flags=const */
 alias Cocoa.NSPrintFirstPage NSPrintFirstPage_;
-public static const NSString NSPrintFirstPage = new NSString(NSPrintFirstPage_);
+public static const NSString NSPrintFirstPage;
 /** @method flags=const */
 alias Cocoa.NSPrintJobDisposition NSPrintJobDisposition_;
-public static const NSString NSPrintJobDisposition = new NSString(NSPrintJobDisposition_);
+public static const NSString NSPrintJobDisposition;
 /** @method flags=const */
 alias Cocoa.NSPrintLastPage NSPrintLastPage_;
-public static const NSString NSPrintLastPage = new NSString(NSPrintLastPage_);
+public static const NSString NSPrintLastPage;
 /** @method flags=const */
 alias Cocoa.NSPrintMustCollate NSPrintMustCollate_;
-public static const NSString NSPrintMustCollate = new NSString(NSPrintMustCollate_);
+public static const NSString NSPrintMustCollate;
 /** @method flags=const */
 alias Cocoa.NSPrintPreviewJob NSPrintPreviewJob_;
-public static const NSString NSPrintPreviewJob = new NSString(NSPrintPreviewJob_);
+public static const NSString NSPrintPreviewJob;
 /** @method flags=const */
 alias Cocoa.NSPrintSaveJob NSPrintSaveJob_;
-public static const NSString NSPrintSaveJob = new NSString(NSPrintSaveJob_);
+public static const NSString NSPrintSaveJob;
 /** @method flags=const */
 alias Cocoa.NSPrintSavePath NSPrintSavePath_;
-public static const NSString NSPrintSavePath = new NSString(NSPrintSavePath_);
+public static const NSString NSPrintSavePath;
 /** @method flags=const */
 alias Cocoa.NSPrintSpoolJob NSPrintSpoolJob_;
-public static const NSString NSPrintSpoolJob = new NSString(NSPrintSpoolJob_);
+public static const NSString NSPrintSpoolJob;
 /** @method flags=const */
 alias Cocoa.NSRTFPboardType NSRTFPboardType_;
-public static const NSString NSRTFPboardType = new NSString(NSRTFPboardType_);
+public static const NSString NSRTFPboardType;
 /** @method flags=const */
 alias Cocoa.NSStrikethroughColorAttributeName NSStrikethroughColorAttributeName_;
-public static const NSString NSStrikethroughColorAttributeName = new NSString(NSStrikethroughColorAttributeName_);
+public static const NSString NSStrikethroughColorAttributeName;
 /** @method flags=const */
 alias Cocoa.NSStrikethroughStyleAttributeName NSStrikethroughStyleAttributeName_;
-public static const NSString NSStrikethroughStyleAttributeName = new NSString(NSStrikethroughStyleAttributeName_);
+public static const NSString NSStrikethroughStyleAttributeName;
 /** @method flags=const */
 alias Cocoa.NSStringPboardType NSStringPboardType_;
-public static const NSString NSStringPboardType = new NSString(NSStringPboardType_);
+public static const NSString NSStringPboardType;
 /** @method flags=const */
 alias Cocoa.NSTIFFPboardType NSTIFFPboardType_;
-public static const NSString NSTIFFPboardType = new NSString(NSTIFFPboardType_);
+public static const NSString NSTIFFPboardType;
 /** @method flags=const */
 alias Cocoa.NSURLPboardType NSURLPboardType_;
-public static const NSString NSURLPboardType = new NSString(NSURLPboardType_);
+public static const NSString NSURLPboardType;
 /** @method flags=const */
 alias Cocoa.NSUnderlineColorAttributeName NSUnderlineColorAttributeName_;
-public static const NSString NSUnderlineColorAttributeName = new NSString(NSUnderlineColorAttributeName_);
+public static const NSString NSUnderlineColorAttributeName;
 /** @method flags=const */
 alias Cocoa.NSUnderlineStyleAttributeName NSUnderlineStyleAttributeName_;
-public static const NSString NSUnderlineStyleAttributeName = new NSString(NSUnderlineStyleAttributeName_);
+public static const NSString NSUnderlineStyleAttributeName;
 /** @method flags=const */
 alias Cocoa.NSDefaultRunLoopMode NSDefaultRunLoopMode_;
-public static const NSString NSDefaultRunLoopMode = new NSString(NSDefaultRunLoopMode_);
+public static const NSString NSDefaultRunLoopMode;
 /** @method flags=const */
 alias Cocoa.NSErrorFailingURLStringKey NSErrorFailingURLStringKey_;
-public static const NSString NSErrorFailingURLStringKey = new NSString(NSErrorFailingURLStringKey_);
-
+public static const NSString NSErrorFailingURLStringKey;
 /** Functions */
 
 /**
--- a/dwt/internal/objc/cocoa/Cocoa.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/objc/cocoa/Cocoa.d	Mon Dec 22 15:10:19 2008 +0100
@@ -11,143 +11,145 @@
 import bindings = dwt.internal.objc.cocoa.bindings;
 import dwt.internal.objc.runtime;
 
-extern (C):
-
-// *.h
-extern
+extern (C)
 {
-    id NSAccessibilityButtonRole;
-    id NSAccessibilityCheckBoxRole;
-    id NSAccessibilityChildrenAttribute;
-    id NSAccessibilityColumnRole;
-    id NSAccessibilityComboBoxRole;
-    id NSAccessibilityConfirmAction;
-    id NSAccessibilityContentsAttribute;
-    id NSAccessibilityDescriptionAttribute;
-    id NSAccessibilityDialogSubrole;
-    id NSAccessibilityEnabledAttribute;
-    id NSAccessibilityExpandedAttribute;
-    id NSAccessibilityFloatingWindowSubrole;
-    id NSAccessibilityFocusedAttribute;
-    id NSAccessibilityFocusedUIElementChangedNotification;
-    id NSAccessibilityGridRole;
-    id NSAccessibilityGroupRole;
-    id NSAccessibilityHelpAttribute;
-    id NSAccessibilityHelpTagRole;
-    id NSAccessibilityHorizontalOrientationValue;
-    id NSAccessibilityHorizontalScrollBarAttribute;
-    id NSAccessibilityImageRole;
-    id NSAccessibilityIncrementorRole;
-    id NSAccessibilityInsertionPointLineNumberAttribute;
-    id NSAccessibilityLabelValueAttribute;
-    id NSAccessibilityLineForIndexParameterizedAttribute;
-    id NSAccessibilityLinkRole;
-    id NSAccessibilityLinkTextAttribute;
-    id NSAccessibilityListRole;
-    id NSAccessibilityMaxValueAttribute;
-    id NSAccessibilityMenuBarRole;
-    id NSAccessibilityMenuButtonRole;
-    id NSAccessibilityMenuItemRole;
-    id NSAccessibilityMenuRole;
-    id NSAccessibilityMinValueAttribute;
-    id NSAccessibilityNextContentsAttribute;
-    id NSAccessibilityNumberOfCharactersAttribute;
-    id NSAccessibilityOrientationAttribute;
-    id NSAccessibilityOutlineRole;
-    id NSAccessibilityOutlineRowSubrole;
-    id NSAccessibilityParentAttribute;
-    id NSAccessibilityPopUpButtonRole;
-    id NSAccessibilityPositionAttribute;
-    id NSAccessibilityPressAction;
-    id NSAccessibilityPreviousContentsAttribute;
-    id NSAccessibilityProgressIndicatorRole;
-    id NSAccessibilityRTFForRangeParameterizedAttribute;
-    id NSAccessibilityRadioButtonRole;
-    id NSAccessibilityRadioGroupRole;
-    id NSAccessibilityRangeForIndexParameterizedAttribute;
-    id NSAccessibilityRangeForLineParameterizedAttribute;
-    id NSAccessibilityRangeForPositionParameterizedAttribute;
-    id NSAccessibilityRoleAttribute;
-    id NSAccessibilityRoleDescriptionAttribute;
-    id NSAccessibilityRowRole;
-    id NSAccessibilityScrollAreaRole;
-    id NSAccessibilityScrollBarRole;
-    id NSAccessibilitySelectedAttribute;
-    id NSAccessibilitySelectedChildrenAttribute;
-    id NSAccessibilitySelectedChildrenChangedNotification;
-    id NSAccessibilitySelectedTextAttribute;
-    id NSAccessibilitySelectedTextChangedNotification;
-    id NSAccessibilitySelectedTextRangeAttribute;
-    id NSAccessibilitySelectedTextRangesAttribute;
-    id NSAccessibilitySizeAttribute;
-    id NSAccessibilitySliderRole;
-    id NSAccessibilitySortButtonRole;
-    id NSAccessibilitySplitterRole;
-    id NSAccessibilityStandardWindowSubrole;
-    id NSAccessibilityStaticTextRole;
-    id NSAccessibilityStringForRangeParameterizedAttribute;
-    id NSAccessibilityStyleRangeForIndexParameterizedAttribute;
-    id NSAccessibilitySubroleAttribute;
-    id NSAccessibilitySystemDialogSubrole;
-    id NSAccessibilityTabGroupRole;
-    id NSAccessibilityTableRole;
-    id NSAccessibilityTableRowSubrole;
-    id NSAccessibilityTabsAttribute;
-    id NSAccessibilityTextAreaRole;
-    id NSAccessibilityTextFieldRole;
-    id NSAccessibilityTextLinkSubrole;
-    id NSAccessibilityTitleAttribute;
-    id NSAccessibilityTitleUIElementAttribute;
-    id NSAccessibilityToolbarRole;
-    id NSAccessibilityTopLevelUIElementAttribute;
-    id NSAccessibilityUnknownRole;
-    id NSAccessibilityUnknownSubrole;
-    id NSAccessibilityValueAttribute;
-    id NSAccessibilityValueChangedNotification;
-    id NSAccessibilityValueDescriptionAttribute;
-    id NSAccessibilityValueIndicatorRole;
-    id NSAccessibilityVerticalOrientationValue;
-    id NSAccessibilityVerticalScrollBarAttribute;
-    id NSAccessibilityVisibleCharacterRangeAttribute;
-    id NSAccessibilityVisibleChildrenAttribute;
-    id NSAccessibilityWindowAttribute;
-    id NSAccessibilityWindowRole;
-    id NSBackgroundColorAttributeName;
-    id NSBaselineOffsetAttributeName;
-    id NSCalibratedRGBColorSpace;
-    id NSDeviceRGBColorSpace;
-    id NSDeviceResolution;
-    id NSDragPboard;
-    id NSFilenamesPboardType;
-    id NSFontAttributeName;
-    id NSForegroundColorAttributeName;
-    id NSHTMLPboardType;
-    id NSLinkAttributeName;
-    id NSParagraphStyleAttributeName;
-    id NSPrintAllPages;
-    id NSPrintCopies;
-    id NSPrintFirstPage;
-    id NSPrintJobDisposition;
-    id NSPrintLastPage;
-    id NSPrintMustCollate;
-    id NSPrintPreviewJob;
-    id NSPrintSaveJob;
-    id NSPrintSavePath;
-    id NSPrintSpoolJob;
-    id NSRTFPboardType;
-    id NSStrikethroughColorAttributeName;
-    id NSStrikethroughStyleAttributeName;
-    id NSStringPboardType;
-    id NSTIFFPboardType;
-    id NSURLPboardType;
-    id NSUnderlineColorAttributeName;
-    id NSUnderlineStyleAttributeName;
-    id NSDefaultRunLoopMode;
-    id NSErrorFailingURLStringKey;
+    // *.h
+    extern
+    {
+        id NSAccessibilityButtonRole;
+        id NSAccessibilityCheckBoxRole;
+        id NSAccessibilityChildrenAttribute;
+        id NSAccessibilityColumnRole;
+        id NSAccessibilityComboBoxRole;
+        id NSAccessibilityConfirmAction;
+        id NSAccessibilityContentsAttribute;
+        id NSAccessibilityDescriptionAttribute;
+        id NSAccessibilityDialogSubrole;
+        id NSAccessibilityEnabledAttribute;
+        id NSAccessibilityExpandedAttribute;
+        id NSAccessibilityFloatingWindowSubrole;
+        id NSAccessibilityFocusedAttribute;
+        id NSAccessibilityFocusedUIElementChangedNotification;
+        id NSAccessibilityGridRole;
+        id NSAccessibilityGroupRole;
+        id NSAccessibilityHelpAttribute;
+        id NSAccessibilityHelpTagRole;
+        id NSAccessibilityHorizontalOrientationValue;
+        id NSAccessibilityHorizontalScrollBarAttribute;
+        id NSAccessibilityImageRole;
+        id NSAccessibilityIncrementorRole;
+        id NSAccessibilityInsertionPointLineNumberAttribute;
+        id NSAccessibilityLabelValueAttribute;
+        id NSAccessibilityLineForIndexParameterizedAttribute;
+        id NSAccessibilityLinkRole;
+        id NSAccessibilityLinkTextAttribute;
+        id NSAccessibilityListRole;
+        id NSAccessibilityMaxValueAttribute;
+        id NSAccessibilityMenuBarRole;
+        id NSAccessibilityMenuButtonRole;
+        id NSAccessibilityMenuItemRole;
+        id NSAccessibilityMenuRole;
+        id NSAccessibilityMinValueAttribute;
+        id NSAccessibilityNextContentsAttribute;
+        id NSAccessibilityNumberOfCharactersAttribute;
+        id NSAccessibilityOrientationAttribute;
+        id NSAccessibilityOutlineRole;
+        id NSAccessibilityOutlineRowSubrole;
+        id NSAccessibilityParentAttribute;
+        id NSAccessibilityPopUpButtonRole;
+        id NSAccessibilityPositionAttribute;
+        id NSAccessibilityPressAction;
+        id NSAccessibilityPreviousContentsAttribute;
+        id NSAccessibilityProgressIndicatorRole;
+        id NSAccessibilityRTFForRangeParameterizedAttribute;
+        id NSAccessibilityRadioButtonRole;
+        id NSAccessibilityRadioGroupRole;
+        id NSAccessibilityRangeForIndexParameterizedAttribute;
+        id NSAccessibilityRangeForLineParameterizedAttribute;
+        id NSAccessibilityRangeForPositionParameterizedAttribute;
+        id NSAccessibilityRoleAttribute;
+        id NSAccessibilityRoleDescriptionAttribute;
+        id NSAccessibilityRowRole;
+        id NSAccessibilityScrollAreaRole;
+        id NSAccessibilityScrollBarRole;
+        id NSAccessibilitySelectedAttribute;
+        id NSAccessibilitySelectedChildrenAttribute;
+        id NSAccessibilitySelectedChildrenChangedNotification;
+        id NSAccessibilitySelectedTextAttribute;
+        id NSAccessibilitySelectedTextChangedNotification;
+        id NSAccessibilitySelectedTextRangeAttribute;
+        id NSAccessibilitySelectedTextRangesAttribute;
+        id NSAccessibilitySizeAttribute;
+        id NSAccessibilitySliderRole;
+        id NSAccessibilitySortButtonRole;
+        id NSAccessibilitySplitterRole;
+        id NSAccessibilityStandardWindowSubrole;
+        id NSAccessibilityStaticTextRole;
+        id NSAccessibilityStringForRangeParameterizedAttribute;
+        id NSAccessibilityStyleRangeForIndexParameterizedAttribute;
+        id NSAccessibilitySubroleAttribute;
+        id NSAccessibilitySystemDialogSubrole;
+        id NSAccessibilityTabGroupRole;
+        id NSAccessibilityTableRole;
+        id NSAccessibilityTableRowSubrole;
+        id NSAccessibilityTabsAttribute;
+        id NSAccessibilityTextAreaRole;
+        id NSAccessibilityTextFieldRole;
+        id NSAccessibilityTextLinkSubrole;
+        id NSAccessibilityTitleAttribute;
+        id NSAccessibilityTitleUIElementAttribute;
+        id NSAccessibilityToolbarRole;
+        id NSAccessibilityTopLevelUIElementAttribute;
+        id NSAccessibilityUnknownRole;
+        id NSAccessibilityUnknownSubrole;
+        id NSAccessibilityValueAttribute;
+        id NSAccessibilityValueChangedNotification;
+        id NSAccessibilityValueDescriptionAttribute;
+        id NSAccessibilityValueIndicatorRole;
+        id NSAccessibilityVerticalOrientationValue;
+        id NSAccessibilityVerticalScrollBarAttribute;
+        id NSAccessibilityVisibleCharacterRangeAttribute;
+        id NSAccessibilityVisibleChildrenAttribute;
+        id NSAccessibilityWindowAttribute;
+        id NSAccessibilityWindowRole;
+        id NSBackgroundColorAttributeName;
+        id NSBaselineOffsetAttributeName;
+        id NSCalibratedRGBColorSpace;
+        id NSDeviceRGBColorSpace;
+        id NSDeviceResolution;
+        id NSDragPboard;
+        id NSFilenamesPboardType;
+        id NSFontAttributeName;
+        id NSForegroundColorAttributeName;
+        id NSHTMLPboardType;
+        id NSLinkAttributeName;
+        id NSParagraphStyleAttributeName;
+        id NSPrintAllPages;
+        id NSPrintCopies;
+        id NSPrintFirstPage;
+        id NSPrintJobDisposition;
+        id NSPrintLastPage;
+        id NSPrintMustCollate;
+        id NSPrintPreviewJob;
+        id NSPrintSaveJob;
+        id NSPrintSavePath;
+        id NSPrintSpoolJob;
+        id NSRTFPboardType;
+        id NSStrikethroughColorAttributeName;
+        id NSStrikethroughStyleAttributeName;
+        id NSStringPboardType;
+        id NSTIFFPboardType;
+        id NSURLPboardType;
+        id NSUnderlineColorAttributeName;
+        id NSUnderlineStyleAttributeName;
+        id NSDefaultRunLoopMode;
+        id NSErrorFailingURLStringKey;
+    }
 }
 
 
 
+
 //NSAccessibility.h
 alias bindings.NSAccessibilityActionDescription NSAccessibilityActionDescription;
 alias bindings.NSAccessibilityPostNotification NSAccessibilityPostNotification;
@@ -161,6 +163,119 @@
 
 
 
+// NSAlert.h
+enum NSAlertStyle : NSUInteger
+{
+    NSWarningAlertStyle = 0,
+    NSInformationalAlertStyle = 1,
+    NSCriticalAlertStyle = 2
+}
+
+
+
+// NSApplication.h
+enum NSApplicationTerminateReply
+{
+    NSTerminateCancel = 0,
+    NSTerminateNow    = 1,
+    NSTerminateLater  = 2
+}
+
+
+
+// NSBezierPath.h
+enum NSBezierPathElement
+{
+    NSMoveToBezierPathElement,
+    NSLineToBezierPathElement,
+    NSCurveToBezierPathElement,
+    NSClosePathBezierPathElement
+}
+
+enum NSLineCapStyle
+{
+    NSButtLineCapStyle = 0,
+    NSRoundLineCapStyle = 1,
+    NSSquareLineCapStyle = 2
+}
+
+enum NSLineJoinStyle
+{
+    NSMiterLineJoinStyle = 0,
+    NSRoundLineJoinStyle = 1,
+    NSBevelLineJoinStyle = 2
+}
+
+enum NSWindingRule
+{
+    NSNonZeroWindingRule = 0,
+    NSEvenOddWindingRule = 1
+}
+
+
+
+// NSButtonCell.h
+enum NSBezelStyle : NSUInteger {
+    NSRoundedBezelStyle = 1,
+    NSRegularSquareBezelStyle = 2,
+    NSThickSquareBezelStyle = 3,
+    NSThickerSquareBezelStyle = 4,
+    NSDisclosureBezelStyle = 5,
+    NSShadowlessSquareBezelStyle = 6,
+    NSCircularBezelStyle = 7,
+    NSTexturedSquareBezelStyle = 8,
+    NSHelpButtonBezelStyle = 9,
+    NSSmallSquareBezelStyle = 10,
+    NSTexturedRoundedBezelStyle = 11,
+    NSRoundRectBezelStyle = 12,
+    NSRecessedBezelStyle = 13,
+    NSRoundedDisclosureBezelStyle = 14,
+}
+
+enum NSButtonType : NSUInteger {
+    NSMomentaryLightButton = 0,
+    NSPushOnPushOffButton = 1,
+    NSToggleButton = 2,
+    NSSwitchButton = 3,
+    NSRadioButton = 4,
+    NSMomentaryChangeButton = 5,
+    NSOnOffButton = 6,
+    NSMomentaryPushInButton = 7,
+    NSMomentaryPushButton = 0,
+    NSMomentaryLight = 7
+}
+
+
+
+// NSCell.h
+enum NSControlSize : NSUInteger
+{
+    NSRegularControlSize,
+    NSSmallControlSize,
+    NSMiniControlSize
+}
+
+enum NSImageScaling : NSUInteger
+{
+    NSImageScaleProportionallyDown = 0,
+    NSImageScaleAxesIndependently,
+    NSImageScaleNone,
+    NSImageScaleProportionallyUpOrDown
+}
+
+enum NSCellImagePosition : NSUInteger
+{
+    NSNoImage       = 0,
+    NSImageOnly     = 1,
+    NSImageLeft     = 2,
+    NSImageRight    = 3,
+    NSImageBelow    = 4,
+    NSImageAbove    = 5,
+    NSImageOverlaps = 6
+}
+
+
+
 // NSDragging.h
 enum NSDragOperation : uint
 {
@@ -177,6 +292,36 @@
 
 
 
+// NSEvent.h
+enum NSEventType
+{
+    NSLeftMouseDown      = 1,
+    NSLeftMouseUp        = 2,
+    NSRightMouseDown     = 3,
+    NSRightMouseUp       = 4,
+    NSMouseMoved         = 5,
+    NSLeftMouseDragged   = 6,
+    NSRightMouseDragged  = 7,
+    NSMouseEntered       = 8,
+    NSMouseExited        = 9,
+    NSKeyDown            = 10,
+    NSKeyUp              = 11,
+    NSFlagsChanged       = 12,
+    NSAppKitDefined      = 13,
+    NSSystemDefined      = 14,
+    NSApplicationDefined = 15,
+    NSPeriodic           = 16,
+    NSCursorUpdate       = 17,
+    NSScrollWheel        = 22,
+    NSTabletPoint        = 23,
+    NSTabletProximity    = 24,
+    NSOtherMouseDown     = 25,
+    NSOtherMouseUp       = 26,
+    NSOtherMouseDragged  = 27
+}
+
+
+
 // NSGraphics.h
 alias int NSWindowDepth;
 
@@ -229,6 +374,26 @@
 
 
 
+// NSGradient.h
+enum NSGradientDrawingOptions : NSUInteger
+{
+    NSGradientDrawsBeforeStartingLocation = (1 << 0),
+    NSGradientDrawsAfterEndingLocation = (1 << 1),
+}
+
+
+
+// NSGraphicsContext.h
+enum NSImageInterpolation
+{
+    NSImageInterpolationDefault,
+    NSImageInterpolationNone,
+    NSImageInterpolationLow,
+    NSImageInterpolationHigh
+} 
+
+
+
 // NSHFSFileTypes.h
 alias bindings.NSFileTypeForHFSTypeCode NSFileTypeForHFSTypeCode;
 
@@ -240,6 +405,37 @@
 
 
 
+// NSImage.h
+enum NSImageCacheMode
+{
+    NSImageCacheDefault,
+    NSImageCacheAlways,
+    NSImageCacheBySize,
+    NSImageCacheNever
+}
+
+
+
+// NSBitmapImageRep.h
+enum NSTIFFCompression : NSUInteger {
+    NSTIFFCompressionNone = 1,
+    NSTIFFCompressionCCITTFAX3 = 3,
+    NSTIFFCompressionCCITTFAX4 = 4,
+    NSTIFFCompressionLZW = 5,
+    NSTIFFCompressionJPEG = 6,
+    NSTIFFCompressionNEXT = 32766,
+    NSTIFFCompressionPackBits = 32773,
+    NSTIFFCompressionOldJPEG = 32865
+}
+
+enum NSBitmapFormat : NSUInteger {
+    NSAlphaFirstBitmapFormat = 1 << 0,
+    NSAlphaNonpremultipliedBitmapFormat = 1 << 1,
+    NSFloatingPointSamplesBitmapFormat = 1 << 2
+}
+
+
+
 // NSObjCRuntime.h
 alias bindings.NSGetSizeAndAlignment NSGetSizeAndAlignment;
 
@@ -248,41 +444,60 @@
     NSNotFound = 0x7fffffff
 }
 
-// NSPathUtilities.h
-enum NSSearchPathDirectory
+
+
+// NSParagraphStyle.h
+enum NSLineBreakMode 
 {
-    NSApplicationDirectory = 1,
-    NSDemoApplicationDirectory,
-    NSDeveloperApplicationDirectory,
-    NSAdminApplicationDirectory,
-    NSLibraryDirectory,
-    NSDeveloperDirectory,
-    NSUserDirectory,
-    NSDocumentationDirectory,
-    NSDocumentDirectory,
-    NSCoreServiceDirectory,
-    NSDesktopDirectory = 12,
-    NSCachesDirectory = 13,
-    NSApplicationSupportDirectory = 14,
-    NSDownloadsDirectory = 15,
-    NSAllApplicationsDirectory = 100,
-    NSAllLibrariesDirectory = 101
+    NSLineBreakByWordWrapping = 0,
+    NSLineBreakByCharWrapping,
+    NSLineBreakByClipping,
+    NSLineBreakByTruncatingHead,
+    NSLineBreakByTruncatingTail,
+    NSLineBreakByTruncatingMiddle
+}
+
+enum NSTextTabType
+{
+    NSLeftTabStopType = 0,
+    NSRightTabStopType,
+    NSCenterTabStopType,
+    NSDecimalTabStopType
 }
 
-enum NSSearchPathDomainMask
-{
-    NSUserDomainMask = 1,
-    NSLocalDomainMask = 2,
-    NSNetworkDomainMask = 4,
-    NSSystemDomainMask = 8,
-    NSAllDomainsMask = 0x0ffff,
-} 
- 
+
+
+// NSPathUtilities.h 
 alias bindings.NSSearchPathForDirectoriesInDomains NSSearchPathForDirectoriesInDomains;
 alias bindings.NSTemporaryDirectory NSTemporaryDirectory;
 
 
 
+// NSText.h
+enum NSTextAlignment
+{
+    NSLeftTextAlignment = 0,
+    NSRightTextAlignment = 1,
+    NSCenterTextAlignment = 2,
+    NSJustifiedTextAlignment = 3,
+    NSNaturalTextAlignment = 4
+}
+
+
+
+// NSWindow.h
+enum : NSUInteger
+{
+    NSBorderlessWindowMask = 0,
+    NSTitledWindowMask = 1 << 0,
+    NSClosableWindowMask = 1 << 1,
+    NSMiniaturizableWindowMask = 1 << 2,
+    NSResizableWindowMask = 1 << 3,
+    NSTexturedBackgroundWindowMask = 1 << 8
+}
+
+
+
 // NSZone.h
 alias void* _NSZone;
 alias _NSZone NSZone;
\ No newline at end of file
--- a/dwt/internal/objc/cocoa/bindings.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/objc/cocoa/bindings.d	Mon Dec 22 15:10:19 2008 +0100
@@ -7,11 +7,45 @@
  */
 module dwt.internal.objc.cocoa.bindings;
 
+import tango.stdc.config;
+
 import dwt.internal.c.Carbon;
 import dwt.internal.cocoa.NSRect;
 import dwt.internal.objc.cocoa.Cocoa;
 import dwt.internal.objc.runtime;
 
+enum NSSearchPathDirectory
+{
+    NSApplicationDirectory = 1,
+    NSDemoApplicationDirectory,
+    NSDeveloperApplicationDirectory,
+    NSAdminApplicationDirectory,
+    NSLibraryDirectory,
+    NSDeveloperDirectory,
+    NSUserDirectory,
+    NSDocumentationDirectory,
+    NSDocumentDirectory,
+    NSCoreServiceDirectory,
+    NSDesktopDirectory = 12,
+    NSCachesDirectory = 13,
+    NSApplicationSupportDirectory = 14,
+    NSDownloadsDirectory = 15,
+    NSAllApplicationsDirectory = 100,
+    NSAllLibrariesDirectory = 101
+}
+
+enum NSSearchPathDomainMask
+{
+    NSUserDomainMask = 1,
+    NSLocalDomainMask = 2,
+    NSNetworkDomainMask = 4,
+    NSSystemDomainMask = 8,
+    NSAllDomainsMask = 0x0ffff,
+}
+
+alias c_long NSInteger;
+alias c_ulong NSUInteger;
+
 extern (C):
 
 //NSAccessibility.h
--- a/dwt/internal/objc/runtime.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/internal/objc/runtime.d	Mon Dec 22 15:10:19 2008 +0100
@@ -7,10 +7,8 @@
  */
 module dwt.internal.objc.runtime;
 
-import tango.stdc.stringz;
-
-import derelict.sdl.macinit.runtime;
 import dwt.dwthelper.utils;
+import dwt.internal.c.Carbon;
 import dwt.internal.cocoa.NSPoint;
 import dwt.internal.cocoa.NSRange;
 import dwt.internal.cocoa.NSSize;
@@ -27,6 +25,15 @@
 
 alias extern (C) id function(id, SEL, ...) IMP;
 
+version (X86)
+    const int STRUCT_SIZE_LIMIT = 8;
+
+else version (PPC)
+    const int STRUCT_SIZE_LIMIT = 4;
+
+else version (X86_64)
+    const int STRUCT_SIZE_LIMIT = 16;
+
 struct objc_object
 {
     Class isa;
@@ -182,7 +189,7 @@
 
 id objc_msgSend (ARGS...) (id theReceiver, SEL theSelector, ARGS args)
 {
-    return dwt.internal.objc.bindings.objc_msgSend(theReceiver, theSelector, args);
+    return (cast(id (*)(id, SEL, ARGS...))&dwt.internal.objc.bindings.objc_msgSend)(theReceiver, theSelector, args);
 }
 
 void objc_msgSend_struct (T, ARGS...) (T* result, id theReceiver, SEL theSelector, ARGS args)
@@ -190,25 +197,29 @@
     result = cast(T*) dwt.internal.objc.bindings.objc_msgSend(theReceiver, theSelector, args);
 }
 
-void objc_msgSend_stret (T, ARGS...) (out T stretAddr, id theReceiver, SEL theSelector, ARGS args)
-{
-    dwt.internal.objc.bindings.objc_msgSend_stret(stretAddr, theReceiver, theSelector, args);
+void objc_msgSend_stret (T, ARGS...) (T* stretAddr, id theReceiver, SEL theSelector, ARGS args)
+{    
+    if (T.sizeof > STRUCT_SIZE_LIMIT)
+		(cast(void (*)(T *, id, SEL, ARGS...))&dwt.internal.objc.bindings.objc_msgSend_stret)(stretAddr, theReceiver, theSelector, args);
+    
+    else
+        *stretAddr = (*cast(T (*)(id, SEL, ARGS...))&dwt.internal.objc.bindings.objc_msgSend)(theReceiver, theSelector, args);
 }
 
 id objc_msgSendSuper (ARGS...) (objc_super* superr, SEL op, ARGS args)
 {
-    return dwt.internal.objc.bindings.objc_msgSendSuper(superr, op, args);
+    return (cast(id (*)(objc_super*, SEL, ARGS...))&dwt.internal.objc.bindings.objc_msgSendSuper)(superr, op, args);
 }
 
 bool objc_msgSend_bool (ARGS...) (id theReceiver, SEL theSelector, ARGS args)
 {
-    return cast(bool) dwt.internal.objc.bindings.objc_msgSend(theReceiver, theSelector, args);
+    return (cast(bool (*)(id, SEL, ARGS...))&dwt.internal.objc.bindings.objc_msgSend)(theReceiver, theSelector, args);
 }
 
 version (X86)
 {
     double objc_msgSend_fpret(ARGS...) (id self, SEL op, ARGS args)
     {
-        return dwt.internal.objc.bindings.objc_msgSend_fpret(self, op, args);
+        return (cast(double (*)(id, SEL, ARGS...))&dwt.internal.objc.bindings.objc_msgSend_fpret)(self, op, args);
     }
 }
\ No newline at end of file
--- 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);
--- a/dwt/widgets/Composite.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/widgets/Composite.d	Mon Dec 22 15:10:19 2008 +0100
@@ -31,7 +31,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.objc.cocoa.Cocoa;
 import dwt.widgets.Control;
 import dwt.widgets.Decorations;
@@ -286,7 +286,7 @@
         scrollWidget.setDrawsBackground(false);
         if ((style & DWT.H_SCROLL) !is 0) scrollWidget.setHasHorizontalScroller(true);
         if ((style & DWT.V_SCROLL) !is 0) scrollWidget.setHasVerticalScroller(true);
-        scrollWidget.setBorderType(hasBorder() ? NSBezelBorder : NSNoBorder);
+        scrollWidget.setBorderType(hasBorder() ? OS.NSBezelBorder : OS.NSNoBorder);
         scrollView = scrollWidget;
         rect.width = rect.height = 100000;
     }
@@ -772,7 +772,7 @@
 
 void resized () {
     super.resized ();
-    if (layout !is null) {
+    if (layout_ !is null) {
         markLayout (false, false);
         updateLayout (false);
     }
@@ -783,7 +783,7 @@
         NSView view = scrollView !is null ? scrollView : this.view;
         if (id is view.id) {
             NSEvent nsEvent = new NSEvent(theEvent);
-            CGFloat delta = nsEvent.deltaY();
+            Carbon.CGFloat delta = nsEvent.deltaY();
             if (delta !is 0) {
                 if (hooks (DWT.MouseWheel) || filters (DWT.MouseWheel)) {
                     if (!sendMouseEvent(nsEvent, DWT.MouseWheel, true)) {
--- a/dwt/widgets/Control.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/widgets/Control.d	Mon Dec 22 15:10:19 2008 +0100
@@ -65,7 +65,7 @@
 
 import dwt.dwthelper.utils;
 import dwt.dwthelper.System;
-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;
@@ -79,9 +79,6 @@
 import dwt.widgets.TypedListener;
 import dwt.widgets.Widget;
 
-
-
-
 /**
  * Control is the abstract superclass of all windowed user interface classes.
  * <p>
@@ -1020,11 +1017,11 @@
     }
     Color background = control.getBackgroundColor ();
     if (background !is null && !background.isDisposed ()) {
-        float [] color = background.handle;
-        context.saveGraphicsState();
-        NSColor.colorWithDeviceRed(color [0], color [1], color [2], getThemeAlpha()).setFill();
-        NSBezierPath.fillRect(rect);
-        context.restoreGraphicsState();
+        Carbon.CGFloat [] color = background.handle;
+		context.saveGraphicsState();
+		NSColor.colorWithDeviceRed(color [0], color [1], color [2], getThemeAlpha()).setFill();
+		NSBezierPath.fillRect(rect);
+		context.restoreGraphicsState();	        
         return;
     }
 }
@@ -2478,7 +2475,7 @@
             break;
         case DWT.MouseWheel:
             event.detail = DWT.SCROLL_LINE;
-            CGFloat delta = nsEvent.deltaY();
+            Carbon.CGFloat delta = nsEvent.deltaY();
             event.count = delta > 0 ? Math.max (1, cast(int)delta) : Math.min (-1, cast(int)delta);
             break;
     }
@@ -2748,7 +2745,7 @@
     bool fixFocus_ = false;
     if (!enabled) {
         control = display.getFocusControl ();
-        fixFocus = isFocusAncestor (control);
+        fixFocus_ = isFocusAncestor (control);
     }
     if (enabled) {
         state &= ~DISABLED;
@@ -3200,7 +3197,7 @@
     bool fixFocus_ = false;
     if (!visible) {
         control = display.getFocusControl ();
-        fixFocus = isFocusAncestor (control);
+        fixFocus_ = isFocusAncestor (control);
     }
     topView().setHidden(!visible);
     if (!visible) {
@@ -3224,7 +3221,7 @@
     NSView otherView = control is null ? null : control.topView ();
     view.retain();
     view.removeFromSuperview();
-    parent.contentView().addSubview(view, above ? NSWindowAbove : NSWindowBelow, otherView);
+    parent.contentView().addSubview(view, above ? OS.NSWindowAbove : OS.NSWindowBelow, otherView);
     view.release();
 }
 
--- a/dwt/widgets/Display.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/widgets/Display.d	Mon Dec 22 15:10:19 2008 +0100
@@ -71,11 +71,12 @@
 import dwt.internal.cocoa.objc_super;
 
 import tango.core.Thread;
+import tango.stdc.stringz;
 
 import dwt.dwthelper.Runnable;
 import dwt.dwthelper.System;
 import dwt.dwthelper.utils;
-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.Caret;
@@ -95,6 +96,8 @@
 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
@@ -209,7 +212,7 @@
     NSAutoreleasePool pool;
     int loopCounter = 0;
     bool idle;
-    static final short DWT_IDLE_TYPE = 1;
+    static const short SWT_IDLE_TYPE = 1;
 
     int[] screenID;
     NSPoint[] screenCascade;
@@ -354,15 +357,16 @@
     CurrentDevice = device;
 }
 
-static byte [] ascii (String name) {
-    int length = name.length ();
+static char* ascii (String name) {
+    /*int length = name.length ();
     char [] chars = new char [length];
     name.getChars (0, length, chars, 0);
     byte [] buffer = new byte [length + 1];
     for (int i=0; i<length; i++) {
         buffer [i] = cast(byte) chars [i];
     }
-    return buffer;
+    return buffer;*/
+    return name.toStringz();
 }
 
 static int translateKey (int key) {
@@ -555,12 +559,13 @@
     while (screenID[index] !is 0 && screenID[index] !is screenNumber) index++;
     screenID[index] = screenNumber;
     NSPoint cascade = screenCascade[index];
-    if (cascade is null) {
+    //FIXME Jacob Carlborg
+    /*if (cascade is null) {
         NSRect frame = screen.frame();
         cascade = NSPoint();
         cascade.x = frame.x;
         cascade.y = frame.y + frame.height;
-    }
+    }*/
     screenCascade[index] = window.cascadeTopLeftFromPoint(cascade);
 }
 
@@ -701,15 +706,15 @@
 
 void clearModal (Shell shell) {
     if (modalShells is null) return;
-    int index = 0, length = modalShells.length;
-    while (index < length) {
+    int index = 0, length_ = modalShells.length;
+    while (index < length_) {
         if (modalShells [index] is shell) break;
         if (modalShells [index] is null) return;
         index++;
     }
-    if (index is length) return;
-    System.arraycopy (modalShells, index + 1, modalShells, index, --length - index);
-    modalShells [length] = null;
+    if (index is length_) return;
+    System.arraycopy (modalShells, index + 1, modalShells, index, --length_ - index);
+    modalShells [length_] = null;
     if (index is 0 && modalShells [0] is null) modalShells = null;
     Shell [] shells = getShells ();
     for (int i=0; i<shells.length; i++) shells [i].updateModal ();
@@ -765,7 +770,7 @@
 
     NSThread nsthread = NSThread.currentThread();
     NSMutableDictionary dictionary = nsthread.threadDictionary();
-    NSString key = NSString.stringWith("DWT_NSAutoreleasePool");
+    NSString key = NSString.stringWith("SWT_NSAutoreleasePool");
     pool = new NSAutoreleasePool(dictionary.objectForKey(key));
 
     application = NSApplication.sharedApplication();
@@ -789,17 +794,17 @@
          * used) but both functions must be called in order for
          * windows to come to the front.
          */
-        ProcessSerialNumber* psn;
-        if (OS.GetCurrentProcess (psn) is OS.noErr) {
+        Carbon.ProcessSerialNumber psn;
+        if (OS.GetCurrentProcess (&psn) is OS.noErr) {
             int pid = OS.getpid ();
-            char* ptr = OS.getenv (ascii ("APP_NAME_" + pid));
+            char* ptr = OS.getenv (ascii ("APP_NAME_" ~ Integer.toString(pid)));
             if (ptr is null && APP_NAME !is null) {
                 ptr = NSString.stringWith(APP_NAME).UTF8String();   
             }
-            if (ptr !is null) OS.CPSSetProcessName (psn, ptr);
-            OS.TransformProcessType (psn, OS.kProcessTransformToForegroundApplication);
-            OS.SetFrontProcess (psn);
-            ptr = OS.getenv (ascii ("APP_ICON_" + pid));
+            if (ptr !is null) OS.CPSSetProcessName (&psn, ptr);
+            OS.TransformProcessType (&psn, OS.kProcessTransformToForegroundApplication);
+            OS.SetFrontProcess (&psn);
+            ptr = OS.getenv (ascii ("APP_ICON_" ~ Integer.toString(pid)));
             if (ptr !is null) {
                 NSString path = NSString.stringWithUTF8String (ptr);
                 NSImage image = cast(NSImage) (new NSImage()).alloc();
@@ -811,13 +816,18 @@
 
         String className = "SWTApplication";
         objc.Class cls;
-        if ((cls = OS.objc_lookUpClass (className)) is null) {
+        if ((cls = cast(objc.Class) OS.objc_lookUpClass (className)) is null) {
             objc.IMP proc2 = cast(objc.IMP) &applicationProc2;
             objc.IMP proc3 = cast(objc.IMP) &applicationProc3;
             objc.IMP proc6 = cast(objc.IMP) &applicationProc6;
-            cls = OS.objc_allocateClassPair(OS.class_NSApplication, className, 0);
+            cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSApplication, className, 0);
             OS.class_addMethod(cls, OS.sel_sendEvent_, proc3, "@:@");
-            OS.class_addMethod(cls, OS.sel_nextEventMatchingMask_untilDate_inMode_dequeue_, proc6, "@:i@@B");
+            
+            static if ((void*).sizeof > int.sizeof) // 64bit target
+                OS.class_addMethod(cls, OS.sel_nextEventMatchingMask_untilDate_inMode_dequeue_, proc6, "@:Q@@B");
+            else
+                OS.class_addMethod(cls, OS.sel_nextEventMatchingMask_untilDate_inMode_dequeue_, proc6, "@:I@@B");
+            
             OS.class_addMethod(cls, OS.sel_isRunning, proc2, "@:");
             OS.objc_registerClassPair(cls);
         }
@@ -828,7 +838,7 @@
 
     //  application = new NSApplication(OS.objc_msgSend(cls, OS.sel_sharedApplication));
 }
-
+    
 static void deregister (Display display) {
     synchronized (Device.classinfo) {
         for (int i=0; i<Displays.length; i++) {
@@ -1040,8 +1050,8 @@
 
 Rectangle getBounds (NSArray screens) {
     NSRect primaryFrame = (new NSScreen(screens.objectAtIndex(0))).frame();
-    CGFloat minX = Float.MAX_VALUE, maxX = Float.MIN_VALUE;
-    CGFloat minY = Float.MAX_VALUE, maxY = Float.MIN_VALUE;
+    CGFloat minX = CGFloat.max, maxX = CGFloat.min;
+    CGFloat minY = CGFloat.max, maxY = CGFloat.min;
     NSUInteger count = screens.count();
     for (NSUInteger i = 0; i < count; i++) {
         NSScreen screen = new NSScreen(screens.objectAtIndex(i));
@@ -1410,8 +1420,9 @@
     checkDevice ();
     NSArray screens = NSScreen.screens();
     NSRect primaryFrame = (new NSScreen(screens.objectAtIndex(0))).frame();
-    int count = cast(int)/*64*/screens.count();
-    for (int i=0; i<count; i++) {
+    NSUInteger count = screens.count();
+    dwt.widgets.Monitor.Monitor [] monitors = new dwt.widgets.Monitor.Monitor [count];
+    for (NSUInteger i=0; i<count; i++) {
         dwt.widgets.Monitor.Monitor monitor = new dwt.widgets.Monitor.Monitor ();
         NSScreen screen = new NSScreen(screens.objectAtIndex(i));
         NSRect frame = screen.frame();
@@ -1576,8 +1587,8 @@
     color = color.colorUsingColorSpace(NSColorSpace.deviceRGBColorSpace());
     if (color is null) return super.getSystemColor(id);
     CGFloat[] components = new CGFloat[color.numberOfComponents()];
-    color.getComponents(components);    
-    return Color.cocoa_new (this, [cast(float)/*64*/ components[0], cast(float)/*64*/ components[1], cast(float)/*64*/ components[2], cast(float)/*64*/ components[3]]);
+    color.getComponents(components.ptr);
+    return Color.cocoa_new (this, [components[0], components[1], components[2], components[3]]);
 }
 
 /**
@@ -1775,7 +1786,7 @@
     String className = "SWTApplicationDelegate";
     if (OS.objc_lookUpClass (className) is null) {
         objc.IMP appProc3 = cast(objc.IMP) &applicationDelegateProc;
-        objc.Class cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0);
+        objc.Class cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSObject, className, 0);
         OS.class_addMethod(cls, OS.sel_applicationWillFinishLaunching_, appProc3, "@:@");
         OS.class_addMethod(cls, OS.sel_terminate_, appProc3, "@:@");
         OS.class_addMethod(cls, OS.sel_orderFrontStandardAboutPanel_, appProc3, "@:@");
@@ -1833,7 +1844,7 @@
 
 objc.Class registerCellSubclass(objc.Class cellClass, int size, int align_, String types) {
     String cellClassName = OS.class_getName(cellClass);
-    objc.Class cls = OS.objc_allocateClassPair(cellClass, "DWT" + cellClassName, 0);   
+    objc.Class cls = OS.objc_allocateClassPair(cellClass, "SWT" ~ cellClassName, 0);   
     OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types);
     OS.objc_registerClassPair(cls);
     return cls;
@@ -1842,12 +1853,12 @@
 void initClasses () {
     if (OS.objc_lookUpClass ("SWTView") !is null) return;
     
-    objc.IMP dialogProc3 = &dialogProc3;
-    objc.IMP proc3 = &windowDelegateProc3;
-    objc.IMP proc2 = windowDelegateProc2.getAddress();
-    objc.IMP proc4 = windowDelegateProc4.getAddress();
-    objc.IMP proc5 = windowDelegateProc5.getAddress();
-    objc.IMP proc6 = windowDelegateProc6.getAddress();
+    objc.IMP dialogProc3 = cast(objc.IMP) &dialogProc;
+    objc.IMP proc3 = cast(objc.IMP) &windowDelegateProc3;
+    objc.IMP proc2 = cast(objc.IMP) &windowDelegateProc2;
+    objc.IMP proc4 = cast(objc.IMP) &windowDelegateProc4;
+    objc.IMP proc5 = cast(objc.IMP) &windowDelegateProc5;
+    objc.IMP proc6 = cast(objc.IMP) &windowDelegateProc6;
 
     objc.IMP drawRectProc = OS.drawRect_CALLBACK(proc3);
     objc.IMP drawInteriorWithFrameInViewProc = OS.drawInteriorWithFrame_inView_CALLBACK (proc4);
@@ -1868,7 +1879,7 @@
     size_t size = C.PTR_SIZEOF, align_ = C.PTR_SIZEOF is 4 ? 2 : 3;
 
     String className = "SWTWindowDelegate";
-    objc.Class cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0);
+    objc.Class cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSObject, className, 0);
     OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types);
     OS.class_addMethod(cls, OS.sel_windowDidResize_, proc3, "@:@");
     OS.class_addMethod(cls, OS.sel_windowDidMove_, proc3, "@:@");
@@ -1969,19 +1980,19 @@
     OS.objc_registerClassPair(cls);
 
     className = "SWTTableHeaderCell";
-    cls = OS.objc_allocateClassPair (OS.class_NSTableHeaderCell, className, 0);
+    cls = OS.objc_allocateClassPair (cast(objc.Class) OS.class_NSTableHeaderCell, className, 0);
     OS.class_addIvar (cls, SWT_OBJECT, size, cast(byte)align_, types);
     OS.class_addMethod (cls, OS.sel_drawInteriorWithFrame_inView_, drawInteriorWithFrameInViewProc, "@:{NSRect}@");
     OS.objc_registerClassPair (cls);
 
     className = "SWTBrowserCell";
-    cls = OS.objc_allocateClassPair (OS.class_NSBrowserCell, className, 0);
+    cls = OS.objc_allocateClassPair (cast(objc.Class) OS.class_NSBrowserCell, className, 0);
     OS.class_addIvar (cls, SWT_OBJECT, size, cast(byte)align_, types);
     OS.class_addMethod (cls, OS.sel_drawInteriorWithFrame_inView_, drawInteriorWithFrameInViewProc, "@:{NSRect}@");
     OS.objc_registerClassPair (cls);
 
     className = "SWTTableHeaderView";
-    cls = OS.objc_allocateClassPair(OS.class_NSTableHeaderView, className, 0);
+    cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSTableHeaderView, className, 0);
     OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types);
     OS.class_addMethod(cls, OS.sel_mouseDown_, proc3, "@:@");
     OS.objc_registerClassPair(cls);
@@ -2144,7 +2155,7 @@
     OS.objc_registerClassPair(cls);
     
     className = "SWTEditorView";
-    cls = OS.objc_allocateClassPair(OS.class_NSTextView, className, 0);
+    cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSTextView, className, 0);
     OS.class_addMethod(cls, OS.sel_keyDown_, proc3, "@:@");
     OS.class_addMethod(cls, OS.sel_keyUp_, proc3, "@:@");
     OS.class_addMethod(cls, OS.sel_insertText_, proc3, "@:@");
@@ -2167,7 +2178,7 @@
     NSTextField.setCellClass(cls);
 
     className = "SWTSearchField";
-    cls = OS.objc_allocateClassPair(OS.class_NSSearchField, className, 0);
+    cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSSearchField, className, 0);
     OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types);
     addEventMethods(cls, proc2, proc3, drawRectProc);
     addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
@@ -2182,7 +2193,7 @@
     NSSearchField.setCellClass(cls);
 
     className = "SWTSecureTextField";
-    cls = OS.objc_allocateClassPair(OS.class_NSSecureTextField, className, 0);
+    cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSSecureTextField, className, 0);
     OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types);
     addEventMethods(cls, proc2, proc3, drawRectProc);
     addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
@@ -2250,7 +2261,7 @@
         data.foreground = getSystemColor(DWT.COLOR_BLACK).handle;
         data.font = getSystemFont();
     }
-    return context.id_;
+    return context.id;
 }
 
 /**  
@@ -2563,7 +2574,7 @@
     pt.y = y;
     NSWindow fromWindow = from !is null ? from.view.window() : null;
     NSWindow toWindow = to !is null ? to.view.window() : null;
-    if (toWindow !is null && fromWindow !is null && toWindow.id_ is fromWindow.id_) {
+    if (toWindow !is null && fromWindow !is null && toWindow.id is fromWindow.id) {
         pt = from.view.convertPoint_toView_(pt, to.view);
     } else {
         NSRect primaryFrame = getPrimaryFrame();
@@ -2676,7 +2687,7 @@
     pt.y = y;
     NSWindow fromWindow = from !is null ? from.view.window() : null;
     NSWindow toWindow = to !is null ? to.view.window() : null;
-    if (toWindow !is null && fromWindow !is null && toWindow.id_ is fromWindow.id_) {
+    if (toWindow !is null && fromWindow !is null && toWindow.id is fromWindow.id) {
         pt = from.view.convertPoint_toView_(pt, to.view);
     } else {
         NSRect primaryFrame = getPrimaryFrame();
@@ -2740,7 +2751,7 @@
         events = true;
         application.sendEvent(event);
     }
-//      NSEvent event = NSEvent.otherEventWithType(OS.NSApplicationDefined, NSPoint(), 0, 0, 0, null, DWT_IDLE_TYPE, 0, 0);
+//      NSEvent event = NSEvent.otherEventWithType(OS.NSApplicationDefined, NSPoint(), 0, 0, 0, null, SWT_IDLE_TYPE, 0, 0);
 //      application.postEvent(event, false);
 //      idle = true;
 //      application.run();
@@ -2868,11 +2879,11 @@
     if (pool !is null) pool.release();
     pool = null;
 
-    if (application !is null && applicationClass !is 0) {
+    if (application !is null && applicationClass !is null) {
         OS.object_setClass (application.id, applicationClass);
     }
     application = null;
-    applicationClass = 0;
+    applicationClass = null;
 }
 
 void removeContext (NSGraphicsContext context) {
@@ -2956,7 +2967,7 @@
     OS.object_getInstanceVariable(view.id, SWT_OBJECT, jniRef);
     if (jniRef is null) return null;
     Widget widget = cast(Widget)OS.JNIGetObject(jniRef);
-    OS.object_setInstanceVariable(view.id, SWT_OBJECT, 0);
+    OS.object_setInstanceVariable(view.id, SWT_OBJECT, null);
     return widget;
 }
 
@@ -3035,9 +3046,9 @@
     while (popups !is null) {
         Menu menu = popups [0];
         if (menu is null) break;
-        int length = popups.length;
-        System.arraycopy (popups, 1, popups, 0, --length);
-        popups [length] = null;
+        int length_ = popups.length;
+        System.arraycopy (popups, 1, popups, 0, --length_);
+        popups [length_] = null;
 //      clearMenuFlags ();
         runDeferredEvents ();
         if (!menu.isDisposed ()) menu._setVisible (true);
@@ -3182,10 +3193,15 @@
  */
 public void setData (String key, Object value) {
     checkDevice ();
-    //if (key is null) error (DWT.ERROR_NULL_ARGUMENT);
+    //if (key is null) error (DWT.ERROR_NULL_ARGUMENT);    
     
     if (key.equals (ADD_WIDGET_KEY)) {
-        Object [] data = cast(Object [])value;
+        auto wrap = cast(ArrayWrapperObject) value;
+        
+        if (wrap is null)
+            DWT.error(DWT.ERROR_INVALID_ARGUMENT, null, " []");
+        
+        Object [] data = wrap.array;
         NSObject object = cast(NSObject)data [0];
         Widget widget = cast(Widget)data [1];
         if (widget is null) {
@@ -3571,8 +3587,8 @@
 objc.id applicationNextEventMatchingMask (objc.id id, objc.SEL sel, objc.id mask, objc.id expiration, objc.id mode, objc.id dequeue) {
     objc_super super_struct = objc_super();
     super_struct.receiver = id;
-    super_struct.super_class = OS.objc_msgSend(id, OS.sel_superclass);
-    objc.id result = OS.objc_msgSendSuper(super_struct, sel, mask, expiration, mode, dequeue !is null);
+    super_struct.super_class = cast(objc.Class) OS.objc_msgSend(id, OS.sel_superclass);
+    objc.id result = OS.objc_msgSendSuper(&super_struct, sel, mask, expiration, mode, dequeue !is null);
     if (result !is null) {
         if (trackingControl !is null && dequeue !is null) {
             NSEvent nsEvent = new NSEvent(result);
@@ -3645,12 +3661,12 @@
 void applicationSendEvent (objc.id id, objc.SEL sel, objc.id event) {
     NSEvent nsEvent = new NSEvent(event);
     int type = nsEvent.type ();
-    bool beep = false;
+    bool beep_ = false;
     switch (type) {
         case OS.NSLeftMouseDown:
         case OS.NSRightMouseDown:
         case OS.NSOtherMouseDown:
-            beep = true;
+            beep_ = true;
         case OS.NSLeftMouseUp:
         case OS.NSRightMouseUp:
         case OS.NSMouseMoved:
@@ -3667,7 +3683,7 @@
             if (window !is null) {
                 Shell shell = cast(Shell) getWidget (window.id);
                 if (shell !is null && shell.getModalShell () !is null) {
-                    if (beep) beep ();  
+                    if (beep_) beep ();  
                     return;
                 }
             }
@@ -3676,9 +3692,9 @@
     applicationSendMouseEvent (nsEvent, false);
     objc_super super_struct = objc_super ();
     super_struct.receiver = id;
-    super_struct.super_class = OS.objc_msgSend (id, OS.sel_superclass);
-    OS.objc_msgSendSuper (super_struct, sel, event);
-//  if (nsEvent.type() is OS.NSApplicationDefined && nsEvent.subtype() is DWT_IDLE_TYPE) {
+    super_struct.super_class = cast(objc.Class) OS.objc_msgSend (id, OS.sel_superclass);
+    OS.objc_msgSendSuper (&super_struct, sel, event);
+//  if (nsEvent.type() is OS.NSApplicationDefined && nsEvent.subtype() is SWT_IDLE_TYPE) {
 //      idle = true;
 //  } else {
 //      idle = false;
@@ -3689,17 +3705,17 @@
 extern (C):
 
 // #245724: [NSApplication isRunning] must return true to allow the AWT to load correctly.
-static objc.id applicationProc2(objc.id id, objc.SEL sel) {
+static objc.id applicationProc2(objc.id id, objc.SEL sel) {println("applicationProc2");
     //TODO optimize getting the display
     Display display = getCurrent ();
     if (display is null) return null;
     if (sel is OS.sel_isRunning) {
-        return cast(objc.id) (display.isDisposed() ? null : 1);
+        return cast(objc.id) (display.isDisposed() ? null : cast(objc.id) 1);
     }
     return null;
 }
 
-static objc.id applicationProc3(objc.id id, objc.SEL sel, objc.id event) {
+static objc.id applicationProc3(objc.id id, objc.SEL sel, objc.id event) {println("applicationProc3");
     //TODO optimize getting the display
     Display display = getCurrent ();
     if (display is null) return null;
@@ -3710,7 +3726,7 @@
     return null;
 }
 
-static objc.id applicationProc6(objc.id id, objc.SEL sel, objc.id arg0, objc.id arg1, objc.id arg2, objc.id arg3) {
+static objc.id applicationProc6(objc.id id, objc.SEL sel, objc.id arg0, objc.id arg1, objc.id arg2, objc.id arg3) {println("applicationProc6");
     //TODO optimize getting the display
     Display display = getCurrent ();
     if (display is null) return null;
@@ -3724,14 +3740,14 @@
     //TODO optimize getting the display
     Display display = getCurrent ();
     if (display is null) return null;
-    id applicationDelegate = display.applicationDelegate;
+    cocoa.id applicationDelegate = display.applicationDelegate;
     NSApplication application = display.application;
     if (sel is OS.sel_applicationWillFinishLaunching_) {
         NSDictionary dict = NSDictionary.dictionaryWithObject(applicationDelegate, NSString.stringWith("NSOwner"));
         NSString nibFile = NSString.stringWith("/System/Library/Frameworks/JavaVM.framework/Resources/English.lproj/DefaultApp.nib");
-        if (!NSBundle.loadNibFile(nibFile, dict, 0)) {
+        if (!NSBundle.loadNibFile(nibFile, dict, null)) {
             nibFile = NSString.stringWith("/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Resources/English.lproj/DefaultApp.nib");
-            NSBundle.loadNibFile(nibFile, dict, 0); 
+            NSBundle.loadNibFile(nibFile, dict, null); 
         }
         //replace %@ with application name
         NSMenu mainmenu = application.mainMenu();
@@ -3749,7 +3765,7 @@
         application.terminate(application);
     } else if (sel is OS.sel_orderFrontStandardAboutPanel_) {
 //      Event event = new Event ();
-//      sendEvent (SWT.ABORT, event);
+//      sendEvent (DWT.ABORT, event);
     } else if (sel is OS.sel_hideOtherApplications_) {
         application.hideOtherApplications(application);
     } else if (sel is OS.sel_hide_) {
@@ -3759,12 +3775,12 @@
     } else if (sel is OS.sel_applicationShouldTerminate_) {
         if (!display.disposing) {
             Event event = new Event ();
-            display.sendEvent (SWT.Close, event);
+            display.sendEvent (DWT.Close, event);
             if (event.doit) {
-                return OS.NSTerminateNow;
+                return cast(objc.id) OS.NSTerminateNow;
             }
         }
-        return OS.NSTerminateCancel;
+        return cast(objc.id) OS.NSTerminateCancel;
     } else if (sel is OS.sel_applicationWillTerminate_) {
         display.dispose();
     } else if (sel is OS.sel_applicationWillResignActive_) {
@@ -3776,19 +3792,19 @@
     return null;
 }
 
-static objc.id dialogProc(objc.id id, objc.SEL selector, objc.id arg0) { 
+static objc.id dialogProc(objc.id id, objc.SEL sel, objc.id arg0) { 
     void* jniRef;
     OS.object_getInstanceVariable(id, SWT_OBJECT, jniRef);
     if (jniRef is null) return null;
-    if (sel == OS.sel_changeColor_) {
+    if (sel is OS.sel_changeColor_) {
         ColorDialog dialog = cast(ColorDialog)OS.JNIGetObject(jniRef);
-    if (jniRef is null) return null;
+        if (jniRef is null) return null;
         dialog.changeColor(id, sel, arg0);
-    } else if (sel == OS.sel_changeFont_) {
+    } else if (sel is OS.sel_changeFont_) {
         FontDialog dialog = cast(FontDialog)OS.JNIGetObject(jniRef);
         if (dialog is null) return null;
         dialog.changeFont(id, sel, arg0);
-    } else if (sel == OS.sel_windowWillClose_) {
+    } else if (sel is OS.sel_windowWillClose_) {
         Object object = OS.JNIGetObject(jniRef);
         if (cast(FontDialog) object) {
             (cast(FontDialog)object).windowWillClose(id, sel, arg0);
@@ -3799,7 +3815,7 @@
     return null;
 }
 	
-static objc.id windowDelegateProc2(objc.id id, objc.SEL selector) {
+static objc.id windowDelegateProc2(objc.id id, objc.SEL sel) {
     Widget widget = GetWidget(id);
     if (widget is null) return null;
     if (sel is OS.sel_sendSelection) {
@@ -3827,14 +3843,14 @@
     } else if (sel is OS.sel_markedRange) {
         NSRange range = widget.markedRange (id, sel);
         /* NOTE that this is freed in C */
-        objc.id result = OS.malloc (NSRange.sizeof);
-        OS.memmove (result, range, NSRange.sizeof);
+        objc.id result = cast(objc.id) OS.malloc (NSRange.sizeof);
+        OS.memmove (result, &range, NSRange.sizeof);
         return result;
     } else if (sel is OS.sel_selectedRange) {
         NSRange range = widget.selectedRange (id, sel);
         /* NOTE that this is freed in C */
-        objc.id result = OS.malloc (NSRange.sizeof);
-        OS.memmove (result, range, NSRange.sizeof);
+        objc.id result = cast(objc.id) OS.malloc (NSRange.sizeof);
+        OS.memmove (result, &range, NSRange.sizeof);
         return result;
     } else if (sel is OS.sel_hasMarkedText) {
         return widget.hasMarkedText (id, sel) ? cast(objc.id) 1 : null;
@@ -3854,7 +3870,7 @@
     return null;
 }
 
-static objc.id windowDelegateProc3(objc.id ID, objc.SEL selector, objc.id arg0) {
+static objc.id windowDelegateProc3(objc.id id, objc.SEL sel, objc.id arg0) {
     if (sel is OS.sel_timerProc_) {
         //TODO optimize getting the display
         Display display = getCurrent ();
@@ -3865,24 +3881,24 @@
     if (widget is null && (sel is OS.sel_keyDown_ ||sel is OS.sel_keyUp_ ||sel is OS.sel_insertText_ ||sel is OS.sel_doCommandBySelector_))  {
         widget = GetFocusControl ((new NSView (id)).window ());
     }
-    if (widget is null) return 0;
+    if (widget is null) return null;
     if (sel is OS.sel_windowWillClose_) {
         widget.windowWillClose(id, sel, arg0);
     } else if (sel is OS.sel_drawRect_) {
-        NSRect rect = new NSRect();
-        OS.memmove(rect, arg0, NSRect.sizeof);
+        NSRect rect = NSRect();
+        OS.memmove(&rect, arg0, NSRect.sizeof);
         widget.drawRect(id, sel, rect);
     } else if (sel is OS.sel_setFrameOrigin_) {
-        NSPoint point = new NSPoint();
-        OS.memmove(point, arg0, NSPoint.sizeof);
+        NSPoint point = NSPoint();
+        OS.memmove(&point, arg0, NSPoint.sizeof);
         widget.setFrameOrigin(id, sel, point);
     } else if (sel is OS.sel_setFrameSize_) {
-        NSSize size = new NSSize();
-        OS.memmove(size, arg0, NSSize.sizeof);
+        NSSize size = NSSize();
+        OS.memmove(&size, arg0, NSSize.sizeof);
         widget.setFrameSize(id, sel, size);
     } else if (sel is OS.sel_hitTest_) {
-        NSPoint point = new NSPoint();
-        OS.memmove(point, arg0, NSPoint.sizeof);
+        NSPoint point = NSPoint();
+        OS.memmove(&point, arg0, NSPoint.sizeof);
         return widget.hitTest(id, sel, point);
     } else if (sel is OS.sel_windowShouldClose_) {
         return widget.windowShouldClose(id, sel, arg0) ? cast(objc.id) 1 : null;
@@ -3915,7 +3931,7 @@
     } else if (sel is OS.sel_menuForEvent_) {
         return widget.menuForEvent(id, sel, arg0);
     } else if (sel is OS.sel_numberOfRowsInTableView_) {
-        return widget.numberOfRowsInTableView(id, sel, arg0);
+        return cast(objc.id) widget.numberOfRowsInTableView(id, sel, arg0);
     } else if (sel is OS.sel_comboBoxSelectionDidChange_) {
         widget.comboBoxSelectionDidChange(id, sel, arg0);
     } else if (sel is OS.sel_tableViewSelectionDidChange_) {
@@ -3955,24 +3971,24 @@
     } else if (sel is OS.sel_attributedSubstringFromRange_) {
         return widget.attributedSubstringFromRange (id, sel, arg0);
     } else if (sel is OS.sel_characterIndexForPoint_) {
-        return widget.characterIndexForPoint (id, sel, arg0);
+        return cast(objc.id) widget.characterIndexForPoint (id, sel, arg0);
     } else if (sel is OS.sel_firstRectForCharacterRange_) {
         NSRect rect = widget.firstRectForCharacterRange (id, sel, arg0);
         /* NOTE that this is freed in C */
-        objc.id result = OS.malloc (NSRect.sizeof);
-        OS.memmove (result, rect, NSRect.sizeof);
+        objc.id result = cast(objc.id) OS.malloc (NSRect.sizeof);
+        OS.memmove (result, &rect, NSRect.sizeof);
         return result;
     } else if (sel is OS.sel_insertText_) {
         widget.insertText (id, sel, arg0);
     } else if (sel is OS.sel_doCommandBySelector_) {
-        widget.doCommandBySelector (id, sel, arg0);
+        widget.doCommandBySelector (id, sel, cast(char*) arg0);
     } else if (sel is OS.sel_highlightSelectionInClipRect_) {
         widget.highlightSelectionInClipRect (id, sel, arg0);
     } else if (sel is OS.sel_reflectScrolledClipView_) {
         widget.reflectScrolledClipView (id, sel, arg0);
     } else if (sel is OS.sel_accessibilityHitTest_) {
-        NSPoint point = new NSPoint();
-        OS.memmove(point, arg0, NSPoint.sizeof);
+        NSPoint point = NSPoint();
+        OS.memmove(&point, arg0, NSPoint.sizeof);
         return widget.accessibilityHitTest(id, sel, point);
     } else if (sel is OS.sel_accessibilityAttributeValue_) {
         return widget.accessibilityAttributeValue(id, sel, arg0);
@@ -3996,7 +4012,7 @@
     return null;
 }
 
-static objc.id windowDelegateProc4(objc.id id, objc.SEL selector, objc.id arg0, objc.id arg1) {
+static objc.id windowDelegateProc4(objc.id id, objc.SEL sel, objc.id arg0, objc.id arg1) {
     Widget widget = GetWidget(id);
     if (widget is null) return null;
     if (sel is OS.sel_tabView_willSelectTabViewItem_) {
@@ -4006,7 +4022,7 @@
     } else if (sel is OS.sel_outlineView_isItemExpandable_) {
         return widget.outlineView_isItemExpandable(id, sel, arg0, arg1) ? cast(objc.id) 1 : null;
     } else if (sel is OS.sel_outlineView_numberOfChildrenOfItem_) {
-        return widget.outlineView_numberOfChildrenOfItem(id, sel, arg0, arg1);
+        return cast(objc.id) widget.outlineView_numberOfChildrenOfItem(id, sel, arg0, arg1);
     } else if (sel is OS.sel_outlineView_shouldCollapseItem_) {
         return widget.outlineView_shouldCollapseItem(id, sel, arg0, arg1) ? cast(objc.id) 1 : null;
     } else if (sel is OS.sel_outlineView_shouldExpandItem_) {
@@ -4027,7 +4043,7 @@
     return null;
 }
 
-static objc.id windowDelegateProc5(objc.id id, objc.SEL selector, objc.id arg0, objc.id arg1, objc.id arg2) {
+static objc.id windowDelegateProc5(objc.id id, objc.SEL sel, objc.id arg0, objc.id arg1, objc.id arg2) {
     Widget widget = GetWidget(id);
     if (widget is null) return null;
     if (sel is OS.sel_tableView_objectValueForTableColumn_row_) {
@@ -4043,14 +4059,14 @@
     } else if (sel is OS.sel_textView_willChangeSelectionFromCharacterRange_toCharacterRange_) {
         NSRange range = widget.textView_willChangeSelectionFromCharacterRange_toCharacterRange(id, sel, arg0, arg1, arg2);
         /* NOTE that this is freed in C */
-        objc.id result = OS.malloc (NSRange.sizeof);
-        OS.memmove (result, range, NSRange.sizeof);
+        objc.id result = cast(objc.id) OS.malloc (NSRange.sizeof);
+        OS.memmove (result, &range, NSRange.sizeof);
         return result;
     }
     return null;
 }
 
-static objc.id windowDelegateProc6(objc.id id, objc.SEL selector, objc.id arg0, objc.id arg1, objc.id arg2, objc.id arg3) {
+static objc.id windowDelegateProc6(objc.id id, objc.SEL sel, objc.id arg0, objc.id arg1, objc.id arg2, objc.id arg3) {
     Widget widget = GetWidget(id);
     if (widget is null) return null;
     if (sel is OS.sel_tableView_willDisplayCell_forTableColumn_row_) {
--- a/dwt/widgets/IME.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/widgets/IME.d	Mon Dec 22 15:10:19 2008 +0100
@@ -365,11 +365,11 @@
 bool insertText (objc.id id, objc.SEL sel, objc.id string) {
     if (startOffset is -1) return true;
     NSString str = new NSString (string);
-    if (str.isKindOfClass (OS.objc_getClass ("NSAttributedString"))) {
+    if (str.isKindOfClass (cast(objc.Class) OS.objc_getClass ("NSAttributedString"))) {
         str = (new NSAttributedString (string)).string ();
     }
     NSUInteger length = str.length ();
-    NSUInteger end = startOffset + text.length ();
+    NSUInteger end = startOffset + text.length;
     ranges = null;
     styles = null;
     caretOffset = commitCount = length;
@@ -463,7 +463,7 @@
         end = event.end;
     }
     NSString str = new NSString (string);
-    if (str.isKindOfClass (OS.objc_getClass ("NSAttributedString"))) {
+    if (str.isKindOfClass (cast(objc.Class) OS.objc_getClass ("NSAttributedString"))) {
         NSAttributedString attribStr = new NSAttributedString (string);
         str = attribStr.string ();
         NSUInteger length = str.length ();
@@ -472,10 +472,10 @@
         NSRange rangeLimit = NSRange (), effectiveRange = NSRange ();
         rangeLimit.length = length;
         int rangeCount = 0;
-        NSRangePointer ptr = OS.malloc (NSRange.sizeof);
+        NSRangePointer ptr = cast(NSRangePointer) OS.malloc (NSRange.sizeof);
         for (NSUInteger i = 0; i < length;) {
             NSDictionary attribs = attribStr.attributesAtIndex(i, ptr, rangeLimit);
-            OS.memmove (effectiveRange, ptr, NSRange.sizeof);
+            OS.memmove (&effectiveRange, ptr, NSRange.sizeof);
             i = effectiveRange.location + effectiveRange.length;
             ranges [rangeCount * 2] = cast(int)/*64*/effectiveRange.location;
             ranges [rangeCount * 2 + 1] = cast(int)/*64*/(effectiveRange.location + effectiveRange.length - 1);
@@ -497,7 +497,7 @@
         ranges = [0, length - 1];
     }
     NSRange range = NSRange ();
-    OS.memmove (range, selRange, NSRange.sizeof);
+    OS.memmove (&range, selRange, NSRange.sizeof);
     caretOffset = cast(int)/*64*/range.location;
     Event event = new Event ();
     event.detail = DWT.COMPOSITION_CHANGED;
--- a/dwt/widgets/MessageBox.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/widgets/MessageBox.d	Mon Dec 22 15:10:19 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.MessageBox;
 
@@ -20,6 +23,10 @@
 import dwt.internal.cocoa.NSWindow;
 import dwt.internal.cocoa.OS;
 
+import dwt.internal.objc.cocoa.Cocoa;
+import dwt.widgets.Dialog;
+import dwt.widgets.Shell;
+
 /**
  * Instances of this class are used to inform or warn the user.
  * <dl>
@@ -88,7 +95,7 @@
  * </ul>
  */
 public this (Shell parent, int style) {
-    super (parent, checkStyle (parent, checkStyle (style)));
+    super (parent, super.checkStyle (parent, checkStyle (style)));
     checkSubclass ();
 }
 
@@ -126,7 +133,7 @@
  * </ul>
  */
 public int open () {
-    int alertType = OS.NSInformationalAlertStyle;
+    NSAlertStyle alertType = OS.NSInformationalAlertStyle;
     if ((style & DWT.ICON_ERROR) !is 0) alertType = OS.NSCriticalAlertStyle;
     if ((style & DWT.ICON_INFORMATION) !is 0) alertType = OS.NSInformationalAlertStyle;
     if ((style & DWT.ICON_QUESTION) !is 0) alertType = OS.NSInformationalAlertStyle;
@@ -172,9 +179,9 @@
     NSString title = NSString.stringWith(this.title !is null ? this.title : "");
     NSString message = NSString.stringWith(this.message !is null ? this.message : "");
     NSAlert alert = NSAlert.alertWithMessageText(NSString.stringWith(""), defaultButton, alternateButton, otherButton, message);
-    new NSWindow(alert.window().id).setTitle(title);
+    (new NSWindow(alert.window().id)).setTitle(title);
     alert.setAlertStyle(alertType);
-    int response = (int)/*64*/alert.runModal();
+    NSInteger response = alert.runModal();
     switch (bits) {
         case DWT.OK:
             switch (response) {
@@ -260,7 +267,7 @@
  * </ul>
  */
 public void setMessage (String string) {
-    if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
+    //if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
     message = string;
 }
 
--- a/dwt/widgets/ScrollBar.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/widgets/ScrollBar.d	Mon Dec 22 15:10:19 2008 +0100
@@ -25,7 +25,7 @@
 import dwt.internal.cocoa.id;
 
 import dwt.dwthelper.utils;
-import dwt.internal.c.Carbon;
+import Carbon = dwt.internal.c.Carbon;
 import dwt.internal.cocoa.NSScroller;
 import dwt.widgets.Event;
 import dwt.widgets.Scrollable;
@@ -674,7 +674,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);
     widget.setEnabled (range > 0); 
 }
--- a/dwt/widgets/Shell.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/widgets/Shell.d	Mon Dec 22 15:10:19 2008 +0100
@@ -39,7 +39,7 @@
 import dwt.internal.cocoa.id;
 
 import dwt.dwthelper.utils;
-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;
@@ -563,7 +563,7 @@
         }
         display.cascadeWindow(window, screen);
         NSRect screenFrame = screen.frame();
-        CGFloat width = screenFrame.width * 5 / 8, height = screenFrame.height * 5 / 8;;
+        Carbon.CGFloat width = screenFrame.width * 5 / 8, height = screenFrame.height * 5 / 8;;
         NSRect frame = window.frame();
         NSRect primaryFrame = primaryScreen.frame();
         frame.y = primaryFrame.height - ((primaryFrame.height - (frame.y + frame.height)) + height);
@@ -588,7 +588,7 @@
     window.disableCursorRects();
     id id = window.fieldEditor (true, null);
     if (id !is null) {
-        OS.object_setClass (id.id, OS.objc_getClass ("SWTEditorView"));
+        OS.object_setClass (id.id, cast(objc.Class) OS.objc_getClass ("SWTEditorView"));
     }
 }
 
@@ -718,7 +718,7 @@
 public Rectangle getBounds () {
     checkWidget();
     NSRect frame = (window is null ? view.frame() : window.frame());
-    GCFloat y = display.getPrimaryFrame().height - cast(int)(frame.y + frame.height);
+    Carbon.CGFloat y = display.getPrimaryFrame().height - cast(int)(frame.y + frame.height);
     return new Rectangle (cast(int)frame.x, cast(int)y, cast(int)frame.width, cast(int)frame.height);
 }
 
@@ -733,11 +733,12 @@
     }
 
     NSRect rect = window.contentRectForFrameRect(window.frame());
+    int width = cast(int)rect.width, height = cast(int)rect.height;
     if (scrollView !is null) {
         NSSize size = NSSize();
         size.width = width;
         size.height = height;
-        size = NSScrollView.contentSizeForFrameSize(size, (style & DWT.H_SCROLL) !is 0, (style & DWT.V_SCROLL) !is 0, NSNoBorder);
+        size = NSScrollView.contentSizeForFrameSize(size, (style & DWT.H_SCROLL) !is 0, (style & DWT.V_SCROLL) !is 0, OS.NSNoBorder);
         width = cast(int)size.width;
         height = cast(int)size.height;
     }
@@ -793,7 +794,7 @@
     checkWidget();
     // TODO: frame is relative to superview. What does getLocation mean in the embedded case?
     NSRect frame = (window !is null ? window.frame() : view.frame());
-    CGFloat y = display.getPrimaryFrame().height - cast(int)(frame.y + frame.height);
+    Carbon.CGFloat y = display.getPrimaryFrame().height - cast(int)(frame.y + frame.height);
     return new Point (cast(int)frame.x, cast(int)y);
 }
 
@@ -1016,7 +1017,7 @@
     setWindowVisible (true, true);
     if (isDisposed ()) return;
 //  if (active) {
-        if (!restoreFocus () && !traverseGroup (true)) setFocus ();
+    if (!restoreFocus () && !traverseGroup (true)) setFocus ();
 //  }
 }
 
@@ -1448,16 +1449,16 @@
     if (region is null) return null;
     NSBezierPath path = NSBezierPath.bezierPath();
     path.retain();
-    OS.QDRegionToRects(region.handle, OS.kQDParseRegionFromTopLeft, cast(RegionToRectsUPP) &regionToRects, path.id);
+    OS.QDRegionToRects(region.handle, OS.kQDParseRegionFromTopLeft, cast(Carbon.RegionToRectsUPP) &regionToRects, path.id);
     if (path.isEmpty()) path.appendBezierPathWithRect(NSRect());
     return path;
 }
 
-extern (C) static OSStatus regionToRects(ushort message, RgnHandle rgn, Rect* r, void* path) {
+extern (C) static Carbon.OSStatus regionToRects(ushort message, Carbon.RgnHandle rgn, Carbon.Rect* r, objc.id path) {
     NSPoint pt = NSPoint();
-    Rect rect;
+    Carbon.Rect rect;
     if (message is OS.kQDRegionToRectsMsgParse) {
-        OS.memmove(&rect, r, rect.length * 2);
+        OS.memmove(&rect, r, rect.sizeof * 2);
         pt.x = rect.left;
         pt.y = rect.top;
         OS.objc_msgSend(path, OS.sel_moveToPoint_, pt);
@@ -1475,7 +1476,7 @@
 
 public void setText (String str) {
     checkWidget();
-    if (str is null) error (DWT.ERROR_NULL_ARGUMENT);
+    //if (str is null) error (DWT.ERROR_NULL_ARGUMENT);
     if (window is null) return;
     NSString nsStr = NSString.stringWith(str);
     window.setTitle(nsStr);
--- a/dwt/widgets/ToolTip.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/widgets/ToolTip.d	Mon Dec 22 15:10:19 2008 +0100
@@ -31,6 +31,7 @@
 
 import dwt.dwthelper.Runnable;
 import dwt.dwthelper.utils;
+import dwt.graphics.Device;
 import dwt.widgets.Display;
 import dwt.widgets.Event;
 import dwt.widgets.Listener;
@@ -606,7 +607,7 @@
      */
     public void setText (String string) {
         checkWidget ();
-        if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
+        //if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
         if (layoutText !is null) layoutText.dispose ();
         layoutText = null;
         if (boldFont !is null) boldFont.dispose ();
@@ -617,7 +618,7 @@
             layoutText.setText (string);
             Font font = display.getSystemFont ();
             FontData data = font.getFontData () [0];
-            boldFont = new Font (display, data.getName (), data.getHeight (), DWT.BOLD);
+            boldFont = new Font (cast(Device) display, data.getName (), data.getHeight (), DWT.BOLD);
             TextStyle style = new TextStyle (boldFont, null, null);
             layoutText.setStyle (style, 0, string.length ());
         }
--- a/dwt/widgets/Widget.d	Tue Dec 09 21:52:21 2008 +0100
+++ b/dwt/widgets/Widget.d	Mon Dec 22 15:10:19 2008 +0100
@@ -173,8 +173,8 @@
 objc.id accessibilityAttributeValue_forParameter(objc.id id, objc.SEL sel, objc.id arg0, objc.id arg1) {
     objc_super super_struct = objc_super();
     super_struct.receiver = id;
-    super_struct.super_class = OS.objc_msgSend(id, OS.sel_superclass);
-    return OS.objc_msgSendSuper(super_struct, sel, arg0, arg1);
+    super_struct.super_class = cast(objc.Class) OS.objc_msgSend(id, OS.sel_superclass);
+    return OS.objc_msgSendSuper(&super_struct, sel, arg0, arg1);
 }
 
 objc.id accessibilityFocusedUIElement(objc.id id, objc.SEL sel) {
@@ -184,8 +184,8 @@
 objc.id accessibilityHitTest(objc.id id, objc.SEL sel, NSPoint point) {
     objc_super super_struct = objc_super();
     super_struct.receiver = id;
-    super_struct.super_class = OS.objc_msgSend(id, OS.sel_superclass);
-    return OS.objc_msgSendSuper(super_struct, sel, point);
+    super_struct.super_class = cast(objc.Class) OS.objc_msgSend(id, OS.sel_superclass);
+    return OS.objc_msgSendSuper(&super_struct, sel, point);
 }
 
 bool accessibilityIsAttributeSettable(objc.id id, objc.SEL sel, objc.id arg0) {
@@ -221,29 +221,29 @@
 void callSuper(objc.id id, objc.SEL sel, objc.id arg0) {
     objc_super super_struct = objc_super();
     super_struct.receiver = id;
-    super_struct.super_class = OS.objc_msgSend(id, OS.sel_superclass);
-    OS.objc_msgSendSuper(super_struct, sel, arg0);
+    super_struct.super_class = cast(objc.Class) OS.objc_msgSend(id, OS.sel_superclass);
+    OS.objc_msgSendSuper(&super_struct, sel, arg0);
 }
 
 void callSuper(objc.id id, objc.SEL sel, NSRect arg0) {
     objc_super super_struct = objc_super();
     super_struct.receiver = id;
-    super_struct.super_class = OS.objc_msgSend(id, OS.sel_superclass);
-    OS.objc_msgSendSuper(super_struct, sel, arg0);
+    super_struct.super_class = cast(objc.Class) OS.objc_msgSend(id, OS.sel_superclass);
+    OS.objc_msgSendSuper(&super_struct, sel, arg0);
 }
 
 void callSuper(objc.id id, objc.SEL sel, NSRect arg0, objc.id arg1) {
     objc_super super_struct = objc_super();
     super_struct.receiver = id;
-    super_struct.super_class = OS.objc_msgSend(id, OS.sel_superclass);
-    OS.objc_msgSendSuper(super_struct, sel, arg0, arg1);
+    super_struct.super_class = cast(objc.Class) OS.objc_msgSend(id, OS.sel_superclass);
+    OS.objc_msgSendSuper(&super_struct, sel, arg0, arg1);
 }
 
 bool callSuperBoolean(objc.id id, objc.SEL sel) {
     objc_super super_struct = objc_super();
     super_struct.receiver = id;
-    super_struct.super_class = OS.objc_msgSend(id, OS.sel_superclass);
-    return OS.objc_msgSendSuper(super_struct, sel) !is null;
+    super_struct.super_class = cast(objc.Class) OS.objc_msgSend(id, OS.sel_superclass);
+    return OS.objc_msgSendSuper(&super_struct, sel) !is null;
 }
 
 bool canBecomeKeyWindow (objc.id id, objc.SEL sel) {
@@ -253,22 +253,22 @@
 bool callSuperBoolean(objc.id id, objc.SEL sel, objc.id arg0) {
     objc_super super_struct = objc_super();
     super_struct.receiver = id;
-    super_struct.super_class = OS.objc_msgSend(id, OS.sel_superclass);
-    return OS.objc_msgSendSuper(super_struct, sel, arg0) !is null;
+    super_struct.super_class = cast(objc.Class) OS.objc_msgSend(id, OS.sel_superclass);
+    return OS.objc_msgSendSuper(&super_struct, sel, arg0) !is null;
 }
 
 objc.id callSuperObject(objc.id id, objc.SEL sel) {
     objc_super super_struct = objc_super();
     super_struct.receiver = id;
-    super_struct.super_class = OS.objc_msgSend(id, OS.sel_superclass);
-    return OS.objc_msgSendSuper(super_struct, sel);
+    super_struct.super_class = cast(objc.Class) OS.objc_msgSend(id, OS.sel_superclass);
+    return OS.objc_msgSendSuper(&super_struct, sel);
 }
 
 objc.id callSuperObject(objc.id id, objc.SEL sel, objc.id arg0) {
     objc_super super_struct = objc_super();
     super_struct.receiver = id;
-    super_struct.super_class = OS.objc_msgSend(id, OS.sel_superclass);
-    return OS.objc_msgSendSuper(super_struct, sel, arg0);
+    super_struct.super_class = cast(objc.Class) OS.objc_msgSend(id, OS.sel_superclass);
+    return OS.objc_msgSendSuper(&super_struct, sel, arg0);
 }
 
 NSInteger characterIndexForPoint (objc.id id, objc.SEL sel, objc.id point) {
@@ -525,7 +525,7 @@
     /* Do nothing */
 }
 
-void drawInteriorWithFrame_inView (objc.id id, objc.SEL sel, int /*long*/ cellFrame, int /*long*/ view) {
+void drawInteriorWithFrame_inView (objc.id id, objc.SEL sel, objc.id cellFrame, objc.id view) {
 }
 
 void drawRect (objc.id id, objc.SEL sel, NSRect rect) {
@@ -537,9 +537,10 @@
         current.saveGraphicsState();
         path.addClip ();
     }
+    objc_super super_struct = objc_super();
     super_struct.receiver = id;
-    super_struct.super_class = OS.objc_msgSend(id, OS.sel_superclass);
-    OS.objc_msgSendSuper(super_struct, sel, rect);
+    super_struct.super_class = cast(objc.Class) OS.objc_msgSend(id, OS.sel_superclass);
+    OS.objc_msgSendSuper(&super_struct, sel, rect);
     drawWidget (id, rect);
     if (path !is null) {
         current.restoreGraphicsState();
@@ -562,6 +563,7 @@
 }
 
 int fixMnemonic (char [] buffer) {
+    int i=0, j=0;
     while (i < buffer.length) {
         if ((buffer [j++] = buffer [i++]) is '&') {
             if (i is buffer.length) {continue;}
@@ -733,8 +735,8 @@
 objc.id hitTest (objc.id id, objc.SEL sel, NSPoint point) {
     objc_super super_struct = objc_super();
     super_struct.receiver = id;
-    super_struct.super_class = OS.objc_msgSend(id, OS.sel_superclass);
-    return OS.objc_msgSendSuper(super_struct, sel, point);
+    super_struct.super_class = cast(objc.Class) OS.objc_msgSend(id, OS.sel_superclass);
+    return OS.objc_msgSendSuper(&super_struct, sel, point);
 }
 
 bool hooks (int eventType) {
@@ -858,8 +860,8 @@
 objc.id menuForEvent (objc.id id, objc.SEL sel, objc.id theEvent) {
     objc_super super_struct = objc_super();
     super_struct.receiver = id;
-    super_struct.super_class = OS.objc_msgSend(id, OS.sel_superclass);
-    return OS.objc_msgSendSuper(super_struct, sel, theEvent);
+    super_struct.super_class = cast(objc.Class) OS.objc_msgSend(id, OS.sel_superclass);
+    return OS.objc_msgSendSuper(&super_struct, sel, theEvent);
 }
 
 void menuNeedsUpdate(objc.id id, objc.SEL sel, objc.id menu) {
@@ -870,7 +872,7 @@
 }
 
 NSRange markedRange (objc.id id, objc.SEL sel) {
-    return new NSRange ();
+    return NSRange ();
 }
 
 void menu_willHighlightItem(objc.id id, objc.SEL sel, objc.id menu, objc.id item) {
@@ -882,7 +884,7 @@
 void menuWillOpen(objc.id id, objc.SEL sel, objc.id menu) {
 }
 
-int /*long*/ numberOfRowsInTableView(objc.id id, objc.SEL sel, objc.id aTableView) {
+NSInteger numberOfRowsInTableView(objc.id id, objc.SEL sel, objc.id aTableView) {
     return 0;
 }
 
@@ -893,15 +895,15 @@
 void outlineView_didClickTableColumn(objc.id id, objc.SEL sel, objc.id outlineView, objc.id tableColumn) {
 }
 
-int /*long*/ outlineView_objectValueForTableColumn_byItem(objc.id id, objc.SEL sel, objc.id outlineView, objc.id tableColumn, objc.id item) {
-    return 0;
+objc.id outlineView_objectValueForTableColumn_byItem(objc.id id, objc.SEL sel, objc.id outlineView, objc.id tableColumn, objc.id item) {
+    return null;
 }
 
 bool outlineView_isItemExpandable(objc.id id, objc.SEL sel, objc.id outlineView, objc.id item) {
     return false;
 }
 
-int /*long*/ outlineView_numberOfChildrenOfItem(objc.id id, objc.SEL sel, objc.id outlineView, objc.id item) {
+NSInteger outlineView_numberOfChildrenOfItem(objc.id id, objc.SEL sel, objc.id outlineView, objc.id item) {
     return 0;
 }
 
@@ -1109,7 +1111,7 @@
 }
 
 NSRange selectedRange (objc.id id, objc.SEL sel) {
-    return new NSRange ();
+    return NSRange ();
 }
 
 void sendDoubleSelection() {
@@ -1287,15 +1289,15 @@
 void setFrameOrigin (objc.id id, objc.SEL sel, NSPoint point) {
     objc_super super_struct = objc_super();
     super_struct.receiver = id;
-    super_struct.super_class = OS.objc_msgSend(id, OS.sel_superclass);
-    OS.objc_msgSendSuper(super_struct, sel, point);
+    super_struct.super_class = cast(objc.Class) OS.objc_msgSend(id, OS.sel_superclass);
+    OS.objc_msgSendSuper(&super_struct, sel, point);
 }
 
 void setFrameSize (objc.id id, objc.SEL sel, NSSize size) {
     objc_super super_struct = objc_super();
     super_struct.receiver = id;
-    super_struct.super_class = OS.objc_msgSend(id, OS.sel_superclass);
-    OS.objc_msgSendSuper(super_struct, sel, size);
+    super_struct.super_class = cast(objc.Class) OS.objc_msgSend(id, OS.sel_superclass);
+    OS.objc_msgSendSuper(&super_struct, sel, size);
 }
 
 bool setInputState (Event event, NSEvent nsEvent, int type) {