diff dwt/widgets/Display.d @ 7:e831403a80a9

Add 'cast' to casts
author Frank Benoit <benoit@tionex.de>
date Wed, 27 Aug 2008 14:30:35 +0200
parents 1a8b3cb347e0
children a9ab4c738ed8
line wrap: on
line diff
--- a/dwt/widgets/Display.d	Wed Aug 27 14:10:03 2008 +0200
+++ b/dwt/widgets/Display.d	Wed Aug 27 14:30:35 2008 +0200
@@ -267,7 +267,7 @@
     /* Timer */
     Runnable timerList [];
     NSTimer nsTimers [];
-    SWTWindowDelegate timerDelegate = (SWTWindowDelegate)new SWTWindowDelegate().alloc().init();
+    SWTWindowDelegate timerDelegate = cast(SWTWindowDelegate)new SWTWindowDelegate().alloc().init();
     SWTApplicationDelegate applicationDelegate;
     
     /* Display Data */
@@ -305,7 +305,7 @@
     name.getChars (0, length, chars, 0);
     byte [] buffer = new byte [length + 1];
     for (int i=0; i<length; i++) {
-        buffer [i] = (byte) chars [i];
+        buffer [i] = cast(byte) chars [i];
     }
     return buffer;
 }
@@ -402,13 +402,13 @@
 //  if (menus is null) menus = new Menu [12];
 //  for (int i=0; i<menus.length; i++) {
 //      if (menus [i] is null) {
-//          menu.id = (short)(ID_START + i);
+//          menu.id = cast(short)(ID_START + i);
 //          menus [i] = menu;
 //          return;
 //      }
 //  }
 //  Menu [] newMenus = new Menu [menus.length + 12];
-//  menu.id = (short)(ID_START + menus.length);
+//  menu.id = cast(short)(ID_START + menus.length);
 //  newMenus [menus.length] = menu;
 //  System.arraycopy (menus, 0, newMenus, 0, menus.length);
 //  menus = newMenus;
@@ -563,7 +563,7 @@
         String s = text.substring (i, j);
         result.append (s);
         i = j + 2;
-        result.append (Lf);
+        result.append cast(Lf);
     }
     return result.toString ();
 }
@@ -647,10 +647,10 @@
 //                  range.length = chars.length;
 //                  int encoding = OS.CFStringGetSystemEncoding ();
 //                  int [] size = new int [1];
-//                  int numChars = OS.CFStringGetBytes (cfstring, range, encoding, (byte) '?', true, null, 0, size);
+//                  int numChars = OS.CFStringGetBytes (cfstring, range, encoding, cast(byte) '?', true, null, 0, size);
 //                  if (numChars !is 0) {
 //                      buffer = new byte [size [0] + 1];
-//                      numChars = OS.CFStringGetBytes (cfstring, range, encoding, (byte) '?', true, buffer, size [0], size);
+//                      numChars = OS.CFStringGetBytes (cfstring, range, encoding, cast(byte) '?', true, buffer, size [0], size);
 //                  }
 //                  OS.CFRelease (cfstring);
 //              }
@@ -669,7 +669,7 @@
 //      }
     }
     
-    pool = (NSAutoreleasePool)new NSAutoreleasePool().alloc().init();
+    pool = cast(NSAutoreleasePool)new NSAutoreleasePool().alloc().init();
     application = NSApplication.sharedApplication();
 }
 
@@ -770,7 +770,7 @@
         if (tag !is -1) {
             Object object = OS.JNIGetObject(tag);
             if (object instanceof Widget) {
-                return (Widget)object;
+                return cast(Widget)object;
             }
         }
     }
@@ -870,7 +870,7 @@
             if (tag !is -1) {
                 Object object = OS.JNIGetObject(tag);
                 if (object instanceof Shell) {
-                    return (Shell)object;
+                    return cast(Shell)object;
                 }
             }
         }
@@ -960,7 +960,7 @@
     NSPoint location = NSEvent.mouseLocation();
     //TODO bad for other screens
     NSRect rect = NSScreen.mainScreen().frame();
-    return new Point ((int) location.x, (int) (rect.height - location.y));
+    return new Point (cast(int) location.x, cast(int) (rect.height - location.y));
 }
 
 /**
@@ -1121,7 +1121,7 @@
                 Object object = OS.JNIGetObject(tag);
                 if (object instanceof Control) {
                     //TODO go up hierarchy
-                    return (Control)object;
+                    return cast(Control)object;
                 }
             } else {
                 /*
@@ -1139,7 +1139,7 @@
                                 if (tag !is 0 && tag !is -1) {
                                     Object object = OS.JNIGetObject(tag);
                                     if (object instanceof Control) {
-                                        return (Control)object;
+                                        return cast(Control)object;
                                     }
                                 }
                             }
@@ -1218,8 +1218,8 @@
     * This code is intentionally commented.  Event time is
     * in seconds and we need an accurate time in milliseconds.
     */
-//  return (int) (OS.GetLastUserEventTime () * 1000.0);
-    return (int) System.currentTimeMillis ();
+//  return cast(int) (OS.GetLastUserEventTime () * 1000.0);
+    return cast(int) System.currentTimeMillis ();
 }
 
 //Menu [] getMenus (Decorations shell) {
@@ -1271,15 +1271,15 @@
         Monitor monitor = new Monitor ();
         NSScreen screen = new NSScreen(screens.objectAtIndex(i));
         NSRect frame = screen.frame();
-        monitor.x = (int)frame.x;
-        monitor.y = (int)frame.y;
-        monitor.width = (int)frame.width;
-        monitor.height = (int)frame.height;
+        monitor.x = cast(int)frame.x;
+        monitor.y = cast(int)frame.y;
+        monitor.width = cast(int)frame.width;
+        monitor.height = cast(int)frame.height;
         NSRect visibleFrame = screen.visibleFrame();
-        monitor.clientX = (int)visibleFrame.x;
-        monitor.clientY = (int)visibleFrame.y;
-        monitor.clientWidth = (int)visibleFrame.width;
-        monitor.clientHeight = (int)visibleFrame.height;
+        monitor.clientX = cast(int)visibleFrame.x;
+        monitor.clientY = cast(int)visibleFrame.y;
+        monitor.clientWidth = cast(int)visibleFrame.width;
+        monitor.clientHeight = cast(int)visibleFrame.height;
         monitors [i] = monitor;
     }
     return monitors;
@@ -1297,15 +1297,15 @@
     Monitor monitor = new Monitor ();
     NSScreen screen = NSScreen.mainScreen();
     NSRect frame = screen.frame();
-    monitor.x = (int)frame.x;
-    monitor.y = (int)frame.y;
-    monitor.width = (int)frame.width;
-    monitor.height = (int)frame.height;
+    monitor.x = cast(int)frame.x;
+    monitor.y = cast(int)frame.y;
+    monitor.width = cast(int)frame.width;
+    monitor.height = cast(int)frame.height;
     NSRect visibleFrame = screen.visibleFrame();
-    monitor.clientX = (int)visibleFrame.x;
-    monitor.clientY = (int)visibleFrame.y;
-    monitor.clientWidth = (int)visibleFrame.width;
-    monitor.clientHeight = (int)visibleFrame.height;
+    monitor.clientX = cast(int)visibleFrame.x;
+    monitor.clientY = cast(int)visibleFrame.y;
+    monitor.clientWidth = cast(int)visibleFrame.width;
+    monitor.clientHeight = cast(int)visibleFrame.height;
     return monitor;
 }
 
@@ -1333,7 +1333,7 @@
             if (jniRef !is 0 && jniRef !is -1) {
                 Object object = OS.JNIGetObject(jniRef);
                 if (object instanceof Shell) {
-                    result[index++] = (Shell)object;
+                    result[index++] = cast(Shell)object;
                 }
             }
         }
@@ -1603,7 +1603,7 @@
     OS.class_addMethod(cls, OS.sel_applicationWillTerminate_1, appProc3, "@:@");
     OS.objc_registerClassPair(cls);
     
-    applicationDelegate = (SWTApplicationDelegate)new SWTApplicationDelegate().alloc().init();
+    applicationDelegate = cast(SWTApplicationDelegate)new SWTApplicationDelegate().alloc().init();
     application.setDelegate(applicationDelegate);
 }
 
@@ -1632,7 +1632,7 @@
 
     String className = "SWTWindowDelegate";
     int cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0);
-    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
+    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
     OS.class_addMethod(cls, OS.sel_windowDidResize_1, proc3, "@:@");
     OS.class_addMethod(cls, OS.sel_windowShouldClose_1, proc3, "@:@");
     OS.class_addMethod(cls, OS.sel_windowWillClose_1, proc3, "@:@");
@@ -1646,7 +1646,7 @@
     
     className = "SWTPanelDelegate";
     cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0);
-    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
+    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
     OS.class_addMethod(cls, OS.sel_windowWillClose_1, dialogProc3, "@:@");
     OS.class_addMethod(cls, OS.sel_changeColor_1, dialogProc3, "@:@");
     OS.class_addMethod(cls, OS.sel_changeFont_1, dialogProc3, "@:@");
@@ -1656,7 +1656,7 @@
     
     className = "SWTMenu";
     cls = OS.objc_allocateClassPair(OS.class_NSMenu, className, 0);
-    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
+    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
     OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
     OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
 //  OS.class_addMethod(cls, OS.sel_menuWillOpen_1, proc3, "@:@");
@@ -1668,7 +1668,7 @@
 
     className = "SWTView";
     cls = OS.objc_allocateClassPair(OS.class_NSView, className, 0);
-    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
+    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
     OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
     OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
     OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:");
@@ -1685,7 +1685,7 @@
     
     className = "SWTScrollView";
     cls = OS.objc_allocateClassPair(OS.class_NSScrollView, className, 0);
-    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
+    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
     OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
     OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
     OS.class_addMethod(cls, OS.sel_sendVerticalSelection, proc2, "@:");
@@ -1734,7 +1734,7 @@
     className = "SWTTreeItem";
     cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0);
 //  OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:");
-    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
+    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
     OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
     OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
     OS.objc_registerClassPair(cls);
@@ -1742,7 +1742,7 @@
     className = "SWTTabView";
     cls = OS.objc_allocateClassPair(OS.class_NSTabView, className, 0);
 //  OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:");
-    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
+    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
     OS.class_addMethod(cls, OS.sel_tabView_1willSelectTabViewItem_1, proc4, "@:@@");
     OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
     OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
@@ -1752,7 +1752,7 @@
     className = "SWTBox";
     cls = OS.objc_allocateClassPair(OS.class_NSBox, className, 0);
 //  OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:");
-    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
+    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
     OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
     OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
     OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@");
@@ -1761,7 +1761,7 @@
     className = "SWTProgressIndicator";
     cls = OS.objc_allocateClassPair(OS.class_NSProgressIndicator, className, 0);
 //  OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:");
-    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
+    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
     OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
     OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
     OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@");
@@ -1829,7 +1829,7 @@
     cls = OS.objc_allocateClassPair(OS.class_NSTextView, className, 0);
 //  OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:");
 //  OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:");
-    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
+    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
     OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
     OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
     OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@");
@@ -1843,7 +1843,7 @@
 
     className = "SWTWindow";
     cls = OS.objc_allocateClassPair(OS.class_NSWindow, className, 0);
-    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
+    OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
     OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
     OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
     OS.class_addMethod(cls, OS.sel_sendEvent_1, proc3, "@:@");
@@ -1914,7 +1914,7 @@
 static bool isValidClass (Class clazz) {
     String name = clazz.getName ();
     int index = name.lastIndexOf ('.');
-    return name.substring (0, index + 1).equals (PACKAGE_PREFIX);
+    return name.substring (0, index + 1).equals cast(PACKAGE_PREFIX);
 }
 
 bool isValidThread () {
@@ -1987,14 +1987,14 @@
 //                  return OS.CGPostKeyboardEvent (0, vKey, type is DWT.KeyDown) is 0;
 //              } else {
 //                  vKey = -1;
-//                  int kchrPtr = OS.GetScriptManagerVariable ((short) OS.smKCHRCache);
+//                  int kchrPtr = OS.GetScriptManagerVariable (cast(short) OS.smKCHRCache);
 //                  int key = -1;
 //                  int [] state = new int [1];
 //                  int [] encoding = new int [1];
-//                  short keyScript = (short) OS.GetScriptManagerVariable ((short) OS.smKeyScript);
-//                  short regionCode = (short) OS.GetScriptManagerVariable ((short) OS.smRegionCode);
-//                  if (OS.UpgradeScriptInfoToTextEncoding (keyScript, (short) OS.kTextLanguageDontCare, regionCode, null, encoding) is OS.paramErr) {
-//                      if (OS.UpgradeScriptInfoToTextEncoding (keyScript, (short) OS.kTextLanguageDontCare, (short) OS.kTextRegionDontCare, null, encoding) is OS.paramErr) {
+//                  short keyScript = cast(short) OS.GetScriptManagerVariable (cast(short) OS.smKeyScript);
+//                  short regionCode = cast(short) OS.GetScriptManagerVariable (cast(short) OS.smRegionCode);
+//                  if (OS.UpgradeScriptInfoToTextEncoding (keyScript, cast(short) OS.kTextLanguageDontCare, regionCode, null, encoding) is OS.paramErr) {
+//                      if (OS.UpgradeScriptInfoToTextEncoding (keyScript, cast(short) OS.kTextLanguageDontCare, cast(short) OS.kTextRegionDontCare, null, encoding) is OS.paramErr) {
 //                          encoding [0] = OS.kTextEncodingMacRoman;
 //                      }
 //                  }
@@ -2009,8 +2009,8 @@
 //                  }
 //                  if (key is -1) return false;                
 //                  for (int i = 0 ; i <= 0x7F ; i++) {
-//                      int result1 = OS.KeyTranslate (kchrPtr, (short) (i | 512), state);
-//                      int result2 = OS.KeyTranslate (kchrPtr, (short) i, state);
+//                      int result1 = OS.KeyTranslate (kchrPtr, cast(short) (i | 512), state);
+//                      int result2 = OS.KeyTranslate (kchrPtr, cast(short) i, state);
 //                      if ((result1 & 0x7f) is key || (result2 & 0x7f) is key) {
 //                          vKey = i;
 //                          break;
@@ -2215,8 +2215,8 @@
             pt = to.view.convertPoint_fromView_(pt, null);
         }
     }
-    point.x = (int)pt.x;
-    point.y = (int)pt.y;
+    point.x = cast(int)pt.x;
+    point.y = cast(int)pt.y;
     return point;
 }
 
@@ -2325,8 +2325,8 @@
             pt = to.view.convertPoint_fromView_(pt, null);
         }
     }
-    rectangle.x = (int)pt.x;
-    rectangle.y = (int)pt.y;
+    rectangle.x = cast(int)pt.x;
+    rectangle.y = cast(int)pt.y;
     return rectangle;
 }
 
@@ -2356,7 +2356,7 @@
  */
 public bool readAndDispatch () {
     checkDevice ();
-    NSAutoreleasePool pool = (NSAutoreleasePool)new NSAutoreleasePool().alloc().init();
+    NSAutoreleasePool pool = cast(NSAutoreleasePool)new NSAutoreleasePool().alloc().init();
     try {
         bool events = false;
         events |= runTimers ();
@@ -2873,7 +2873,7 @@
 public bool sleep () {
     checkDevice ();
     if (getMessageCount () !is 0) return true;
-    NSAutoreleasePool pool = (NSAutoreleasePool)new NSAutoreleasePool().alloc().init();
+    NSAutoreleasePool pool = cast(NSAutoreleasePool)new NSAutoreleasePool().alloc().init();
     try {
         allowTimers = runAsyncMessages = false;
         NSRunLoop.currentRunLoop().runMode(OS.NSDefaultRunLoopMode, NSDate.distantFuture());
@@ -3105,19 +3105,19 @@
     int jniRef = OS.objc_msgSend(id, OS.sel_tag);
     if (jniRef is 0 || jniRef is -1) return 0;
     if (sel is OS.sel_changeColor_1) {
-        ColorDialog dialog = (ColorDialog)OS.JNIGetObject(jniRef);
+        ColorDialog dialog = cast(ColorDialog)OS.JNIGetObject(jniRef);
         if (dialog is null) return 0;
         dialog.changeColor(arg0);
     } else if (sel is OS.sel_changeFont_1) {
-        FontDialog dialog = (FontDialog)OS.JNIGetObject(jniRef);
+        FontDialog dialog = cast(FontDialog)OS.JNIGetObject(jniRef);
         if (dialog is null) return 0;
         dialog.changeFont(arg0);
     } else if (sel is OS.sel_windowWillClose_1) {
         Object object = OS.JNIGetObject(jniRef);
         if (object instanceof FontDialog) {
-            ((FontDialog)object).windowWillClose(arg0);
+            (cast(FontDialog)object).windowWillClose(arg0);
         } else if (object instanceof ColorDialog) {
-            ((ColorDialog)object).windowWillClose(arg0);
+            (cast(ColorDialog)object).windowWillClose(arg0);
         }
     }
     return 0;
@@ -3131,7 +3131,7 @@
     }
     int jniRef = OS.objc_msgSend(delegate, OS.sel_tag);
     if (jniRef is 0 || jniRef is -1) return 0;
-    Widget widget = (Widget)OS.JNIGetObject(jniRef);
+    Widget widget = cast(Widget)OS.JNIGetObject(jniRef);
     if (widget is null) return 0;
     if (sel is OS.sel_isFlipped) {
         return widget.isFlipped() ? 1 : 0;
@@ -3178,7 +3178,7 @@
     }
     int jniRef = OS.objc_msgSend(id, OS.sel_tag);
     if (jniRef is 0 || jniRef is -1) return 0;
-    Widget widget = (Widget)OS.JNIGetObject(jniRef);
+    Widget widget = cast(Widget)OS.JNIGetObject(jniRef);
     if (widget is null) return 0;
     if (sel is OS.sel_windowWillClose_1) {
         widget.windowWillClose(arg0);
@@ -3236,7 +3236,7 @@
 int windowDelegateProc(int delegate, int sel, int arg0, int arg1) {
     int jniRef = OS.objc_msgSend(delegate, OS.sel_tag);
     if (jniRef is 0 || jniRef is -1) return 0;
-    Widget widget = (Widget)OS.JNIGetObject(jniRef);
+    Widget widget = cast(Widget)OS.JNIGetObject(jniRef);
     if (widget is null) return 0;
     if (sel is OS.sel_tabView_1willSelectTabViewItem_1) {
         widget.willSelectTabViewItem(arg0, arg1);
@@ -3257,7 +3257,7 @@
 int windowDelegateProc(int delegate, int sel, int arg0, int arg1, int arg2) {
     int jniRef = OS.objc_msgSend(delegate, OS.sel_tag);
     if (jniRef is 0 || jniRef is -1) return 0;
-    Widget widget = (Widget)OS.JNIGetObject(jniRef);
+    Widget widget = cast(Widget)OS.JNIGetObject(jniRef);
     if (widget is null) return 0;
     if (sel is OS.sel_tableView_1objectValueForTableColumn_1row_1) {
         return widget.tableView_objectValueForTableColumn_row(arg0, arg1, arg2);
@@ -3277,7 +3277,7 @@
 int windowDelegateProc(int delegate, int sel, int arg0, int arg1, int arg2, int arg3) {
     int jniRef = OS.objc_msgSend(delegate, OS.sel_tag);
     if (jniRef is 0 || jniRef is -1) return 0;
-    Widget widget = (Widget)OS.JNIGetObject(jniRef);
+    Widget widget = cast(Widget)OS.JNIGetObject(jniRef);
     if (widget is null) return 0;
     if (sel is OS.sel_tableView_1willDisplayCell_1forTableColumn_1row_1) {
         widget.tableView_willDisplayCell_forTableColumn_row(arg0, arg1, arg2, arg3);