diff dwt/widgets/Control.d @ 37:642f460a0908

Fixed a lot of compile errors, a "hello world" app compiles now
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Fri, 10 Oct 2008 12:29:48 +0200
parents 453387bb0706
children d8635bb48c7c
line wrap: on
line diff
--- a/dwt/widgets/Control.d	Tue Oct 07 12:56:18 2008 +0200
+++ b/dwt/widgets/Control.d	Fri Oct 10 12:29:48 2008 +0200
@@ -91,6 +91,9 @@
  * </p>
  */
 public abstract class Control : Widget , Drawable {
+    
+    alias Widget.setInputState setInputState;
+    
     /**
      * the handle to the OS resource 
      * (Warning: This field is platform dependent)
@@ -160,7 +163,7 @@
     objc_super super_struct = objc_super();
     super_struct.receiver = view.id_;
     super_struct.cls = cast(objc.Class) OS.objc_msgSend(view.id_, OS.sel_superclass);
-    return OS.objc_msgSendSuper(super_struct, OS.sel_acceptsFirstResponder) !is null;
+    return OS.objc_msgSendSuper(&super_struct, OS.sel_acceptsFirstResponder) !is null;
 }
 
 bool becomeFirstResponder () {
@@ -168,8 +171,8 @@
     sendEvent (DWT.FocusIn);
     objc_super super_struct = objc_super();
     super_struct.receiver = view.id_;
-    super_struct.cls = OS.objc_msgSend(view.id_, OS.sel_superclass);
-    return OS.objc_msgSendSuper(super_struct, OS.sel_becomeFirstResponder) !is null;
+    super_struct.cls = cast(objc.Class) OS.objc_msgSend(view.id_, OS.sel_superclass);
+    return OS.objc_msgSendSuper(&super_struct, OS.sel_becomeFirstResponder) !is null;
 }
 
 bool resignFirstResponder () {
@@ -177,8 +180,8 @@
     sendEvent (DWT.FocusOut);
     objc_super super_struct = objc_super();
     super_struct.receiver = view.id_;
-    super_struct.cls = OS.objc_msgSend(view.id_, OS.sel_superclass);
-    return OS.objc_msgSendSuper(super_struct, OS.sel_resignFirstResponder) !is null;
+    super_struct.cls = cast(objc.Class) OS.objc_msgSend(view.id_, OS.sel_superclass);
+    return OS.objc_msgSendSuper(&super_struct, OS.sel_resignFirstResponder) !is null;
 }
 
 /**
@@ -639,7 +642,7 @@
 Control[] computeTabList() {
     if (isTabGroup()) {
         if (getVisible() && getEnabled()) {
-            return new Control[] [this];
+            return [this];
         }
     }
     return new Control[0];
@@ -806,13 +809,14 @@
     return false;
 }
 
-void drawRect(int id, NSRect rect) {
+void drawRect(objc.id id, NSRect rect) {
     super.drawRect(id, rect);
     if (!hooks (DWT.Paint) && !filters (DWT.Paint)) return;
 
     /* Send paint event */
     GCData data = new GCData ();
-    data.paintRect = rect;
+    data.paintRectStruct = rect;
+    data.paintRect = &data.paintRectStruct;
     GC gc = GC.cocoa_new (this, data);
     Event event = new Event ();
     event.gc = gc;
@@ -843,7 +847,7 @@
 }
 
 Menu [] findMenus (Control control) {
-    if (menu !is null && this !is control) return new Menu [] [menu];
+    if (menu !is null && this !is control) return [menu];
     return new Menu [0];
 }
 
@@ -1351,7 +1355,7 @@
  * @param hDC the platform specific GC handle
  * @param data the platform specific GC data 
  */
-public void internal_dispose_GC (int context, GCData data) {
+public void internal_dispose_GC (objc.id context, GCData data) {
     checkWidget (); 
 }
 
@@ -1492,7 +1496,7 @@
     event.x = x;
     event.y = y;
     sendEvent (DWT.MenuDetect, event);
-    if (!event.doit) return 0;
+    if (!event.doit) return null;
     Menu menu = getMenu ();
     if (menu !is null && !menu.isDisposed ()) {
         if (x !is event.x || y !is event.y) {
@@ -1502,8 +1506,8 @@
     }
     objc_super super_struct = objc_super();
     super_struct.receiver = view.id_;
-    super_struct.cls = OS.objc_msgSend(view.id_, OS.sel_superclass);
-    return OS.objc_msgSendSuper(super_struct, OS.sel_menuForEvent_1, nsEvent);
+    super_struct.cls = cast(objc.Class) OS.objc_msgSend(view.id_, OS.sel_superclass);
+    return OS.objc_msgSendSuper(&super_struct, OS.sel_menuForEvent_1, nsEvent);
 }
 
 Decorations menuShell () {
@@ -1574,13 +1578,13 @@
     sendEvent (type, event);
 }
 
-void mouseDown(int theEvent) {
+void mouseDown(objc.id theEvent) {
     NSEvent nsEvent = new NSEvent (theEvent);
     sendMouseEvent (nsEvent, DWT.MouseDown, 1);
 }
 
 void mouseDragged(objc.id theEvent) {
-    NSEvent nsEvent = new NSEvent (objc.id);
+    NSEvent nsEvent = new NSEvent (theEvent);
     sendMouseEvent (nsEvent, DWT.MouseMove, 1);
 }
 
@@ -1614,7 +1618,7 @@
         }
         setInputState (event, nsEvent, type);
         if (!setKeyState(event, type, nsEvent)) return false;
-        if (sendKeyEvent (type, event)) {
+        if ((cast(Widget)this).sendKeyEvent (type, event)) {
             chars [count++] = chars [i];
         }
     }
@@ -2525,11 +2529,11 @@
     checkWidget();
     if (((state & DISABLED) is 0) is enabled) return;
     Control control = null;
-    bool fixFocus = false;
+    bool fixFocus_ = false;
     if (!enabled) {
 //      if (display.focusEvent !is DWT.FocusOut) {
             control = display.getFocusControl ();
-            fixFocus = isFocusAncestor (control);
+            fixFocus_ = isFocusAncestor (control);
 //      }
     }
     if (enabled) {
@@ -2538,7 +2542,7 @@
         state |= DISABLED;
     }
     enableWidget (enabled);
-    if (fixFocus) fixFocus (control);
+    if (fixFocus_) fixFocus (control);
 }
 
 /**
@@ -2935,11 +2939,11 @@
     * the focus control.
     */
     Control control = null;
-    bool fixFocus = false;
+    bool fixFocus_ = false;
     if (!visible) {
 //      if (display.focusEvent !is DWT.FocusOut) {
             control = display.getFocusControl ();
-            fixFocus = isFocusAncestor (control);
+            fixFocus_ = isFocusAncestor (control);
 //      }
     }
     topView().setHidden(!visible);
@@ -2952,7 +2956,7 @@
         sendEvent (DWT.Hide);
         if (isDisposed ()) return;
     }
-    if (fixFocus) fixFocus (control);
+    if (fixFocus_) fixFocus (control);
 }
 
 void setZOrder () {
@@ -2970,7 +2974,7 @@
     NSView otherView = control is null ? null : control.topView ();
     view.retain();
     view.removeFromSuperview();
-    parent.contentView().addSubview_positioned_relativeTo_(view, above ? OS.NSWindowAbove : OS.NSWindowBelow, otherView);
+    parent.contentView().addSubview_positioned_relativeTo_(view, above ? NSWindowAbove : NSWindowBelow, otherView);
     view.release();
 }