Mercurial > projects > dwt-mac
diff dwt/widgets/Display.d @ 46:cfa563df4fdd
Updated Widget and Display to 3.514
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Fri, 05 Dec 2008 16:00:41 +0100 |
parents | d8635bb48c7c |
children | 9dd4a17513f9 |
line wrap: on
line diff
--- a/dwt/widgets/Display.d Mon Dec 01 17:07:00 2008 +0100 +++ b/dwt/widgets/Display.d Fri Dec 05 16:00:41 2008 +0100 @@ -75,14 +75,13 @@ import dwt.dwthelper.Runnable; import dwt.dwthelper.System; import dwt.dwthelper.utils; - -import dwt.internal.c.carboncore.MacTypes; -import dwt.internal.cocoa.NSInteger; +import dwt.internal.c.Carbon; +import dwt.internal.objc.cocoa.Cocoa; import objc = dwt.internal.objc.runtime; - import dwt.widgets.Caret; import dwt.widgets.ColorDialog; import dwt.widgets.Control; +import dwt.widgets.Decorations; import dwt.widgets.Dialog; import dwt.widgets.Event; import dwt.widgets.EventTable; @@ -96,8 +95,6 @@ import dwt.widgets.Tray; import dwt.widgets.Widget; -//import mambo.io; - /** * Instances of this class are responsible for managing the * connection between DWT and the underlying operating @@ -202,7 +199,7 @@ Menu[] menus, popups; NSApplication application; - int /*long*/ applicationClass; + objc.Class applicationClass; NSImage dockImage; bool isEmbedded; @@ -214,10 +211,8 @@ bool idle; static final short DWT_IDLE_TYPE = 1; - int[] screenID = new int[32]; - NSPoint[] screenCascade = new NSPoint[32]; - static Callback dialogCallback3; - static Callback applicationCallback2, applicationCallback3, applicationCallback6; + int[] screenID; + NSPoint[] screenCascade; /* Menus */ // Menu menuBar; @@ -236,86 +231,86 @@ /* Key Mappings. */ static int [] [] KeyTable = [ - + /* Keyboard and Mouse Masks */ - {58, DWT.ALT}, - {56, DWT.SHIFT}, - {59, DWT.CONTROL}, - {55, DWT.COMMAND}, - {61, DWT.ALT}, - {62, DWT.CONTROL}, - {60, DWT.SHIFT}, - {54, DWT.COMMAND}, - - /* Non-Numeric Keypad Keys */ - {126, DWT.ARROW_UP}, - {125, DWT.ARROW_DOWN}, - {123, DWT.ARROW_LEFT}, - {124, DWT.ARROW_RIGHT}, - {116, DWT.PAGE_UP}, - {121, DWT.PAGE_DOWN}, - {115, DWT.HOME}, - {119, DWT.END}, -// [??, DWT.INSERT], - - /* Virtual and Ascii Keys */ - {51, DWT.BS}, - {36, DWT.CR}, - {117, DWT.DEL}, - {53, DWT.ESC}, - {76, DWT.LF}, - {48, DWT.TAB}, - - /* Functions Keys */ - {122, DWT.F1}, - {120, DWT.F2}, - {99, DWT.F3}, - {118, DWT.F4}, - {96, DWT.F5}, - {97, DWT.F6}, - {98, DWT.F7}, - {100, DWT.F8}, - {101, DWT.F9}, - {109, DWT.F10}, - {103, DWT.F11}, - {111, DWT.F12}, - {105, DWT.F13}, - {107, DWT.F14}, - {113, DWT.F15}, - - /* Numeric Keypad Keys */ - {67, DWT.KEYPAD_MULTIPLY}, - {69, DWT.KEYPAD_ADD}, - {76, DWT.KEYPAD_CR}, - {78, DWT.KEYPAD_SUBTRACT}, - {65, DWT.KEYPAD_DECIMAL}, - {75, DWT.KEYPAD_DIVIDE}, - {82, DWT.KEYPAD_0}, - {83, DWT.KEYPAD_1}, - {84, DWT.KEYPAD_2}, - {85, DWT.KEYPAD_3}, - {86, DWT.KEYPAD_4}, - {87, DWT.KEYPAD_5}, - {88, DWT.KEYPAD_6}, - {89, DWT.KEYPAD_7}, - {91, DWT.KEYPAD_8}, - {92, DWT.KEYPAD_9}, - {81, DWT.KEYPAD_EQUAL}, - - /* Other keys */ - {57, DWT.CAPS_LOCK}, - {71, DWT.NUM_LOCK}, + [58, DWT.ALT], + [56, DWT.SHIFT], + [59, DWT.CONTROL], + [55, DWT.COMMAND], + [61, DWT.ALT], + [62, DWT.CONTROL], + [60, DWT.SHIFT], + [54, DWT.COMMAND], + + /* Non-Numeric Keypad Keys */ + [126, DWT.ARROW_UP], + [125, DWT.ARROW_DOWN], + [123, DWT.ARROW_LEFT], + [124, DWT.ARROW_RIGHT], + [116, DWT.PAGE_UP], + [121, DWT.PAGE_DOWN], + [115, DWT.HOME], + [119, DWT.END], +// [??, DWT.INSERT], + + /* Virtual and Ascii Keys */ + [51, DWT.BS], + [36, DWT.CR], + [117, DWT.DEL], + [53, DWT.ESC], + [76, DWT.LF], + [48, DWT.TAB], + + /* Functions Keys */ + [122, DWT.F1], + [120, DWT.F2], + [99, DWT.F3], + [118, DWT.F4], + [96, DWT.F5], + [97, DWT.F6], + [98, DWT.F7], + [100, DWT.F8], + [101, DWT.F9], + [109, DWT.F10], + [103, DWT.F11], + [111, DWT.F12], + [105, DWT.F13], + [107, DWT.F14], + [113, DWT.F15], + + /* Numeric Keypad Keys */ + [67, DWT.KEYPAD_MULTIPLY], + [69, DWT.KEYPAD_ADD], + [76, DWT.KEYPAD_CR], + [78, DWT.KEYPAD_SUBTRACT], + [65, DWT.KEYPAD_DECIMAL], + [75, DWT.KEYPAD_DIVIDE], + [82, DWT.KEYPAD_0], + [83, DWT.KEYPAD_1], + [84, DWT.KEYPAD_2], + [85, DWT.KEYPAD_3], + [86, DWT.KEYPAD_4], + [87, DWT.KEYPAD_5], + [88, DWT.KEYPAD_6], + [89, DWT.KEYPAD_7], + [91, DWT.KEYPAD_8], + [92, DWT.KEYPAD_9], + [81, DWT.KEYPAD_EQUAL], + + /* Other keys */ + [57, DWT.CAPS_LOCK], + [71, DWT.NUM_LOCK], // [??, DWT.SCROLL_LOCK], // [??, DWT.PAUSE], // [??, DWT.BREAK], // [??, DWT.PRINT_SCREEN], - {114, DWT.HELP}, + [114, DWT.HELP], ]; static String APP_NAME = "DWT"; static const String ADD_WIDGET_KEY = "dwt.internal.addWidget"; - static const String DWT_OBJECT = "DWT_OBJECT"; //$NON-NLS-1$ + static const String SWT_OBJECT = "SWT_OBJECT"; //$NON-NLS-1$ /* Multiple Displays. */ static Display Default; @@ -507,7 +502,7 @@ void addWidget (NSObject view, Widget widget) { if (view is null) return; - OS.object_setInstanceVariable (view.id, DWT_OBJECT, widget.jniRef); + OS.object_setInstanceVariable (view.id, SWT_OBJECT, widget.jniRef); } /** @@ -555,14 +550,14 @@ void cascadeWindow (NSWindow window, NSScreen screen) { NSDictionary dictionary = screen.deviceDescription(); - int screenNumber = new NSNumber(dictionary.objectForKey(NSString.stringWith("NSScreenNumber")).id).intValue(); + int screenNumber = (new NSNumber(dictionary.objectForKey(NSString.stringWith("NSScreenNumber")).id)).intValue(); int index = 0; while (screenID[index] !is 0 && screenID[index] !is screenNumber) index++; screenID[index] = screenNumber; NSPoint cascade = screenCascade[index]; if (cascade is null) { NSRect frame = screen.frame(); - cascade = new NSPoint(); + cascade = NSPoint(); cascade.x = frame.x; cascade.y = frame.y + frame.height; } @@ -621,6 +616,8 @@ */ public this (DeviceData data) { super (data); + screenID = new int[32]; + screenCascade = new NSPoint[32]; cursors = new Cursor [DWT.CURSOR_HAND + 1]; Displays = new Display [4]; timerDelegate = cast(SWTWindowDelegate)(new SWTWindowDelegate()).alloc().init(); @@ -646,6 +643,21 @@ } }; + + hoverTimer = new class(currentControl) Runnable { + Control currentControl; + + this (Control currentControl) + { + this.currentControl = currentControl; + } + + public void run () { + if (currentControl !is null && !currentControl.isDisposed()) { + currentControl.sendMouseEvent (null, DWT.MouseHover, trackingControl !is null); + } + } + }; } static void checkDisplay (Thread thread, bool multiple) { @@ -777,20 +789,20 @@ * used) but both functions must be called in order for * windows to come to the front. */ - ProcessSerialNumber* psn; + ProcessSerialNumber* psn; if (OS.GetCurrentProcess (psn) is OS.noErr) { int pid = OS.getpid (); - int /*long*/ ptr = OS.getenv (ascii ("APP_NAME_" + pid)); - if (ptr is 0 && APP_NAME !is null) { + char* ptr = OS.getenv (ascii ("APP_NAME_" + pid)); + if (ptr is null && APP_NAME !is null) { ptr = NSString.stringWith(APP_NAME).UTF8String(); } - if (ptr !is 0) OS.CPSSetProcessName (psn, ptr); + 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 0) { + if (ptr !is null) { NSString path = NSString.stringWithUTF8String (ptr); - NSImage image = (NSImage) new NSImage().alloc(); + NSImage image = cast(NSImage) (new NSImage()).alloc(); image = image.initByReferencingFile(path); dockImage = image; application.setApplicationIconImage(image); @@ -798,18 +810,11 @@ } String className = "SWTApplication"; - int /*long*/ cls; - if ((cls = OS.objc_lookUpClass (className)) is 0) { - Class clazz = getClass(); - applicationCallback2 = new Callback(clazz, "applicationProc", 2); - int /*long*/ proc2 = applicationCallback2.getAddress(); - if (proc2 is 0) error (DWT.ERROR_NO_MORE_CALLBACKS); - applicationCallback3 = new Callback(clazz, "applicationProc", 3); - int /*long*/ proc3 = applicationCallback3.getAddress(); - if (proc3 is 0) error (DWT.ERROR_NO_MORE_CALLBACKS); - applicationCallback6 = new Callback(clazz, "applicationProc", 6); - int /*long*/ proc6 = applicationCallback6.getAddress(); - if (proc6 is 0) error (DWT.ERROR_NO_MORE_CALLBACKS); + objc.Class cls; + if ((cls = 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); OS.class_addMethod(cls, OS.sel_sendEvent_, proc3, "@:@"); OS.class_addMethod(cls, OS.sel_nextEventMatchingMask_untilDate_inMode_dequeue_, proc6, "@:i@@B"); @@ -1003,12 +1008,12 @@ public Shell getActiveShell () { checkDevice (); NSArray windows = application.windows(); - int count = (int)/*64*/windows.count(); + int count = cast(int)/*64*/windows.count(); for (int i = 0; i < count; i++) { NSWindow win = new NSWindow(windows.objectAtIndex(i)); if (win.isKeyWindow()) { Widget widget = getWidget(win.contentView()); - if (widget instanceof Shell) { + if (cast(Shell) widget) { return cast(Shell)widget; } } @@ -1034,15 +1039,15 @@ } Rectangle getBounds (NSArray screens) { - NSRect primaryFrame = new NSScreen(screens.objectAtIndex(0)).frame(); - float /*double*/ minX = Float.MAX_VALUE, maxX = Float.MIN_VALUE; - float /*double*/ minY = Float.MAX_VALUE, maxY = Float.MIN_VALUE; - int /*long*/ count = screens.count(); - for (int i = 0; i < count; i++) { + 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; + NSUInteger count = screens.count(); + for (NSUInteger i = 0; i < count; i++) { NSScreen screen = new NSScreen(screens.objectAtIndex(i)); NSRect frame = screen.frame(); - float /*double*/ x1 = frame.x, x2 = frame.x + frame.width; - float /*double*/ y1 = primaryFrame.height - frame.y, y2 = primaryFrame.height - (frame.y + frame.height); + CGFloat x1 = frame.x, x2 = frame.x + frame.width; + CGFloat y1 = primaryFrame.height - frame.y, y2 = primaryFrame.height - (frame.y + frame.height); if (x1 < minX) minX = x1; if (x2 < minX) minX = x2; if (x1 > maxX) maxX = x1; @@ -1052,7 +1057,7 @@ if (y1 > maxY) maxY = y1; if (y2 > maxY) maxY = y2; } - return new Rectangle ((int)minX, (int)minY, (int)(maxX - minX), (int)(maxY - minY)); + return new Rectangle (cast(int)minX, cast(int)minY, cast(int)(maxX - minX), cast(int)(maxY - minY)); } /** @@ -1091,8 +1096,8 @@ NSScreen screen = new NSScreen(screens.objectAtIndex(0)); NSRect frame = screen.frame(); NSRect visibleFrame = screen.visibleFrame(); - float /*double*/ y = frame.height - (visibleFrame.y + visibleFrame.height); - return new Rectangle((int)visibleFrame.x, (int)y, (int)visibleFrame.width, (int)visibleFrame.height); + CGFloat y = frame.height - (visibleFrame.y + visibleFrame.height); + return new Rectangle(cast(int)visibleFrame.x, cast(int)y, cast(int)visibleFrame.width, cast(int)visibleFrame.height); } /** @@ -1225,11 +1230,11 @@ } /** - * Returns the button dismissal alignment, one of <code>LEFT</code> or <code>RIGHT</code>. - * The button dismissal alignment is the ordering that should be used when positioning the + * Returns the button dismissal align_ment, one of <code>LEFT</code> or <code>RIGHT</code>. + * The button dismissal align_ment is the ordering that should be used when positioning the * default dismissal button for a dialog. For example, in a dialog that contains an OK and - * CANCEL button, on platforms where the button dismissal alignment is <code>LEFT</code>, the - * button ordering should be OK/CANCEL. When button dismissal alignment is <code>RIGHT</code>, + * CANCEL button, on platforms where the button dismissal align_ment is <code>LEFT</code>, the + * button ordering should be OK/CANCEL. When button dismissal align_ment is <code>RIGHT</code>, * the button ordering should be CANCEL/OK. * * @return the button dismissal order @@ -1293,8 +1298,8 @@ if (view !is null) { do { Widget widget = GetWidget (view.id); - if (widget instanceof Control) { - return (Control)widget; + if (cast(Control)widget) { + return cast(Control)widget; } view = view.superview(); } while (view !is null); @@ -1404,19 +1409,19 @@ public dwt.widgets.Monitor.Monitor [] getMonitors () { checkDevice (); NSArray screens = NSScreen.screens(); - NSRect primaryFrame = new NSScreen(screens.objectAtIndex(0)).frame(); - int count = (int)/*64*/screens.count(); + NSRect primaryFrame = (new NSScreen(screens.objectAtIndex(0))).frame(); + int count = cast(int)/*64*/screens.count(); for (int 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(); monitor.x = cast(int)frame.x; - monitor.y = (int)(primaryFrame.height - (frame.y + frame.height)); + monitor.y = cast(int)(primaryFrame.height - (frame.y + frame.height)); monitor.width = cast(int)frame.width; monitor.height = cast(int)frame.height; NSRect visibleFrame = screen.visibleFrame(); monitor.clientX = cast(int)visibleFrame.x; - monitor.clientY = (int)(primaryFrame.height - (visibleFrame.y + visibleFrame.height)); + monitor.clientY = cast(int)(primaryFrame.height - (visibleFrame.y + visibleFrame.height)); monitor.clientWidth = cast(int)visibleFrame.width; monitor.clientHeight = cast(int)visibleFrame.height; monitors [i] = monitor; @@ -1426,7 +1431,7 @@ NSRect getPrimaryFrame () { NSArray screens = NSScreen.screens(); - return new NSScreen(screens.objectAtIndex(0)).frame(); + return (new NSScreen(screens.objectAtIndex(0))).frame(); } /** @@ -1443,12 +1448,12 @@ NSScreen screen = new NSScreen(screens.objectAtIndex(0)); NSRect frame = screen.frame(); monitor.x = cast(int)frame.x; - monitor.y = (int)(frame.height - (frame.y + frame.height)); + monitor.y = cast(int)(frame.height - (frame.y + frame.height)); monitor.width = cast(int)frame.width; monitor.height = cast(int)frame.height; NSRect visibleFrame = screen.visibleFrame(); monitor.clientX = cast(int)visibleFrame.x; - monitor.clientY = (int)(frame.height - (visibleFrame.y + visibleFrame.height)); + monitor.clientY = cast(int)(frame.height - (visibleFrame.y + visibleFrame.height)); monitor.clientWidth = cast(int)visibleFrame.width; monitor.clientHeight = cast(int)visibleFrame.height; return monitor; @@ -1469,12 +1474,12 @@ checkDevice (); NSArray windows = application.windows(); int index = 0; - Shell [] result = new Shell [(int)/*64*/windows.count()]; + Shell [] result = new Shell [windows.count()]; for (int i = 0; i < result.length; i++) { NSWindow window = new NSWindow(windows.objectAtIndex(i)); Widget widget = getWidget(window.contentView()); - if (widget instanceof Shell) { - result[index++] = (Shell)widget; + if (cast(Shell) widget) { + result[index++] = cast(Shell)widget; } } if (index is result.length) return result; @@ -1570,7 +1575,7 @@ if (color is null) return super.getSystemColor(id); color = color.colorUsingColorSpace(NSColorSpace.deviceRGBColorSpace()); if (color is null) return super.getSystemColor(id); - float /*double*/[] components = new float /*double*/[(int)/*64*/color.numberOfComponents()]; + 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]]); } @@ -1722,16 +1727,16 @@ return 560; } -Widget getWidget (int /*long*/ id) { +Widget getWidget (objc.id id) { return GetWidget (id); } -static Widget GetWidget (int /*long*/ id) { - if (id is 0) return null; - int /*long*/ [] jniRef = new int /*long*/ [1]; - OS.object_getInstanceVariable(id, DWT_OBJECT, jniRef); - if (jniRef[0] is 0) return null; - return (Widget)OS.JNIGetObject(jniRef[0]); +static Widget GetWidget (objc.id id) { + if (id is null) return null; + void* jniRef; + OS.object_getInstanceVariable(id, SWT_OBJECT, jniRef); + if (jniRef is null) return null; + return cast(Widget)OS.JNIGetObject(jniRef); } Widget getWidget (NSView view) { @@ -1757,7 +1762,7 @@ application.finishLaunching(); } - timerDelegate = (SWTWindowDelegate)new SWTWindowDelegate().alloc().init(); + timerDelegate = cast(SWTWindowDelegate)(new SWTWindowDelegate()).alloc().init(); NSTextView textView = cast(NSTextView)(new NSTextView()).alloc(); textView.initWithFrame (NSRect ()); @@ -1769,11 +1774,8 @@ void initApplicationDelegate() { String className = "SWTApplicationDelegate"; if (OS.objc_lookUpClass (className) is null) { - Class clazz = getClass (); - applicationDelegateCallback3 = new Callback(clazz, "applicationDelegateProc", 3); - int /*long*/ appProc3 = applicationDelegateCallback3.getAddress(); - if (appProc3 is 0) error (DWT.ERROR_NO_MORE_CALLBACKS); - int /*long*/ cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0); + objc.IMP appProc3 = cast(objc.IMP) &applicationDelegateProc; + objc.Class cls = OS.objc_allocateClassPair(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, "@:@"); @@ -1789,7 +1791,7 @@ application.setDelegate(applicationDelegate); } -void addEventMethods (int /*long*/ cls, int /*long*/ proc2, int /*long*/ proc3, int /*long*/ drawRectProc) { +void addEventMethods (objc.Class cls, objc.IMP proc2, objc.IMP proc3, objc.IMP drawRectProc) { OS.class_addMethod(cls, OS.sel_mouseDown_, proc3, "@:@"); OS.class_addMethod(cls, OS.sel_mouseUp_, proc3, "@:@"); OS.class_addMethod(cls, OS.sel_scrollWheel_, proc3, "@:@"); @@ -1810,12 +1812,12 @@ OS.class_addMethod(cls, OS.sel_drawRect_, drawRectProc, "@:{NSRect}"); } -void addFrameMethods(int /*long*/ cls, int /*long*/ setFrameOriginProc, int /*long*/ setFrameSizeProc) { +void addFrameMethods(objc.Class cls, objc.IMP setFrameOriginProc, objc.IMP setFrameSizeProc) { OS.class_addMethod(cls, OS.sel_setFrameOrigin_, setFrameOriginProc, "@:{NSPoint}"); OS.class_addMethod(cls, OS.sel_setFrameSize_, setFrameSizeProc, "@:{NSSize}"); } -void addAccessibilityMethods(int /*long*/ cls, int /*long*/ proc2, int /*long*/ proc3, int /*long*/ proc4, int /*long*/ accessibilityHitTestProc) { +void addAccessibilityMethods(objc.Class cls, objc.IMP proc2, objc.IMP proc3, objc.IMP proc4, objc.IMP accessibilityHitTestProc) { OS.class_addMethod(cls, OS.sel_accessibilityActionNames, proc2, "@:"); OS.class_addMethod(cls, OS.sel_accessibilityAttributeNames, proc2, "@:"); OS.class_addMethod(cls, OS.sel_accessibilityParameterizedAttributeNames, proc2, "@:"); @@ -1829,10 +1831,10 @@ OS.class_addMethod(cls, OS.sel_accessibilityActionDescription_, proc3, "@:@"); } -int registerCellSubclass(int cellClass, int size, int align, String types) { +objc.Class registerCellSubclass(objc.Class cellClass, int size, int align_, String types) { String cellClassName = OS.class_getName(cellClass); - int cls = OS.objc_allocateClassPair(cellClass, "DWT" + cellClassName, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + objc.Class cls = OS.objc_allocateClassPair(cellClass, "DWT" + cellClassName, 0); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); OS.objc_registerClassPair(cls); return cls; } @@ -1840,34 +1842,34 @@ void initClasses () { if (OS.objc_lookUpClass ("SWTView") !is null) return; - Class clazz = getClass (); - dialogCallback3 = new Callback(clazz, "dialogProc", 3); - int /*long*/ dialogProc3 = dialogCallback3.getAddress(); - if (dialogProc3 is 0) error (DWT.ERROR_NO_MORE_CALLBACKS); - windowDelegateCallback3 = new Callback(clazz, "windowDelegateProc", 3); - int /*long*/ proc3 = windowDelegateCallback3.getAddress(); + 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 drawRectProc = OS.drawRect_CALLBACK(proc3); - int /*long*/ drawInteriorWithFrameInViewProc = OS.drawInteriorWithFrame_inView_CALLBACK (proc4); - int /*long*/ setFrameOriginProc = OS.setFrameOrigin_CALLBACK(proc3); - int /*long*/ setFrameSizeProc = OS.setFrameSize_CALLBACK(proc3); - int /*long*/ hitTestProc = OS.hitTest_CALLBACK(proc3); - int /*long*/ markedRangeProc = OS.markedRange_CALLBACK(proc2); - int /*long*/ selectedRangeProc = OS.selectedRange_CALLBACK(proc2); - int /*long*/ highlightSelectionInClipRectProc = OS.highlightSelectionInClipRect_CALLBACK(proc3); - int /*long*/ setMarkedText_selectedRangeProc = OS.setMarkedText_selectedRange_CALLBACK(proc4); - int /*long*/ attributedSubstringFromRangeProc = OS.attributedSubstringFromRange_CALLBACK(proc3); - int /*long*/ characterIndexForPointProc = OS.characterIndexForPoint_CALLBACK(proc3); - int /*long*/ firstRectForCharacterRangeProc = OS.firstRectForCharacterRange_CALLBACK(proc3); - int /*long*/ textWillChangeSelectionProc = OS.textView_willChangeSelectionFromCharacterRange_toCharacterRange_CALLBACK(proc5); - int /*long*/ accessibilityHitTestProc = OS.accessibilityHitTest_CALLBACK(proc3); + objc.IMP drawInteriorWithFrameInViewProc = OS.drawInteriorWithFrame_inView_CALLBACK (proc4); + objc.IMP setFrameOriginProc = OS.setFrameOrigin_CALLBACK(proc3); + objc.IMP setFrameSizeProc = OS.setFrameSize_CALLBACK(proc3); + objc.IMP hitTestProc = OS.hitTest_CALLBACK(proc3); + objc.IMP markedRangeProc = OS.markedRange_CALLBACK(proc2); + objc.IMP selectedRangeProc = OS.selectedRange_CALLBACK(proc2); + objc.IMP highlightSelectionInClipRectProc = OS.highlightSelectionInClipRect_CALLBACK(proc3); + objc.IMP setMarkedText_selectedRangeProc = OS.setMarkedText_selectedRange_CALLBACK(proc4); + objc.IMP attributedSubstringFromRangeProc = OS.attributedSubstringFromRange_CALLBACK(proc3); + objc.IMP characterIndexForPointProc = OS.characterIndexForPoint_CALLBACK(proc3); + objc.IMP firstRectForCharacterRangeProc = OS.firstRectForCharacterRange_CALLBACK(proc3); + objc.IMP textWillChangeSelectionProc = OS.textView_willChangeSelectionFromCharacterRange_toCharacterRange_CALLBACK(proc5); + objc.IMP accessibilityHitTestProc = OS.accessibilityHitTest_CALLBACK(proc3); String types = "*"; - int size = C.PTR_SIZEOF, align = C.PTR_SIZEOF is 4 ? 2 : 3; + size_t size = C.PTR_SIZEOF, align_ = C.PTR_SIZEOF is 4 ? 2 : 3; String className = "SWTWindowDelegate"; - int /*long*/ cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + objc.Class cls = OS.objc_allocateClassPair(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, "@:@"); OS.class_addMethod(cls, OS.sel_windowShouldClose_, proc3, "@:@"); @@ -1879,7 +1881,7 @@ className = "SWTPanelDelegate"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSObject, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); OS.class_addMethod(cls, OS.sel_windowWillClose_, dialogProc3, "@:@"); OS.class_addMethod(cls, OS.sel_changeColor_, dialogProc3, "@:@"); OS.class_addMethod(cls, OS.sel_changeFont_, dialogProc3, "@:@"); @@ -1887,7 +1889,7 @@ className = "SWTMenu"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSMenu, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); OS.class_addMethod(cls, OS.sel_menuWillOpen_, proc3, "@:@"); OS.class_addMethod(cls, OS.sel_menuDidClose_, proc3, "@:@"); OS.class_addMethod(cls, OS.sel_menu_willHighlightItem_, proc4, "@:@@"); @@ -1897,7 +1899,7 @@ className = "SWTView"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSView, className, 0); OS.class_addProtocol(cls, OS.objc_getProtocol("NSTextInput")); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); OS.class_addMethod(cls, OS.sel_acceptsFirstResponder, proc2, "@:"); OS.class_addMethod(cls, OS.sel_isOpaque, proc2, "@:"); @@ -1923,7 +1925,7 @@ className = "SWTScrollView"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSScrollView, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); OS.class_addMethod(cls, OS.sel_sendVerticalSelection, proc2, "@:"); OS.class_addMethod(cls, OS.sel_sendHorizontalSelection, proc2, "@:"); OS.class_addMethod(cls, OS.sel_pageDown_, proc3, "@:@"); @@ -1936,20 +1938,20 @@ className = "SWTButton"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSButton, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); addEventMethods(cls, proc2, proc3, drawRectProc); addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); OS.objc_registerClassPair(cls); - cls = registerCellSubclass(NSButton.cellClass(), size, align, types); + cls = registerCellSubclass(NSButton.cellClass(), size, align_, types); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); NSButton.setCellClass(cls); className = "SWTTableView"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSTableView, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); OS.class_addMethod(cls, OS.sel_highlightSelectionInClipRect_, highlightSelectionInClipRectProc, "@:{NSRect}"); OS.class_addMethod(cls, OS.sel_sendDoubleSelection, proc2, "@:"); OS.class_addMethod(cls, OS.sel_numberOfRowsInTableView_, proc3, "@:@"); @@ -1968,25 +1970,25 @@ className = "SWTTableHeaderCell"; cls = OS.objc_allocateClassPair (OS.class_NSTableHeaderCell, className, 0); - OS.class_addIvar (cls, DWT_OBJECT, size, (byte)align, types); + 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); - OS.class_addIvar (cls, DWT_OBJECT, size, (byte)align, types); + 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); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); OS.class_addMethod(cls, OS.sel_mouseDown_, proc3, "@:@"); OS.objc_registerClassPair(cls); className = "SWTOutlineView"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSOutlineView, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); OS.class_addMethod(cls, OS.sel_highlightSelectionInClipRect_, highlightSelectionInClipRectProc, "@:{NSRect}"); OS.class_addMethod(cls, OS.sel_sendDoubleSelection, proc2, "@:"); OS.class_addMethod(cls, OS.sel_outlineViewSelectionDidChange_, proc3, "@:@"); @@ -2009,12 +2011,12 @@ className = "SWTTreeItem"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSObject, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); OS.objc_registerClassPair(cls); className = "SWTTabView"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSTabView, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); OS.class_addMethod(cls, OS.sel_tabView_willSelectTabViewItem_, proc4, "@:@@"); OS.class_addMethod(cls, OS.sel_tabView_didSelectTabViewItem_, proc4, "@:@@"); addEventMethods(cls, proc2, proc3, drawRectProc); @@ -2024,7 +2026,7 @@ className = "SWTBox"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSBox, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); addEventMethods(cls, proc2, proc3, drawRectProc); addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); @@ -2032,7 +2034,7 @@ className = "SWTProgressIndicator"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSProgressIndicator, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); addEventMethods(cls, proc2, proc3, drawRectProc); addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); @@ -2040,32 +2042,32 @@ className = "SWTSlider"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSSlider, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); addEventMethods(cls, proc2, proc3, drawRectProc); addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); OS.objc_registerClassPair(cls); - cls = registerCellSubclass(NSSlider.cellClass(), size, align, types); + cls = registerCellSubclass(NSSlider.cellClass(), size, align_, types); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); NSSlider.setCellClass(cls); className = "SWTPopUpButton"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSPopUpButton, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); addEventMethods(cls, proc2, proc3, drawRectProc); addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); OS.objc_registerClassPair(cls); - cls = registerCellSubclass(NSPopUpButton.cellClass(), size, align, types); + cls = registerCellSubclass(NSPopUpButton.cellClass(), size, align_, types); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); NSPopUpButton.setCellClass(cls); className = "SWTComboBox"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSComboBox, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); OS.class_addMethod(cls, OS.sel_comboBoxSelectionDidChange_, proc3, "@:@"); OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); OS.class_addMethod(cls, OS.sel_textDidChange_, proc3, "@:@"); @@ -2076,13 +2078,13 @@ addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); OS.objc_registerClassPair(cls); - cls = registerCellSubclass(NSComboBox.cellClass(), size, align, types); + cls = registerCellSubclass(NSComboBox.cellClass(), size, align_, types); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); NSComboBox.setCellClass(cls); className = "SWTDatePicker"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSDatePicker, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); addEventMethods(cls, proc2, proc3, drawRectProc); addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc); @@ -2091,32 +2093,32 @@ className = "SWTImageView"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSImageView, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); addEventMethods(cls, proc2, proc3, drawRectProc); addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); OS.objc_registerClassPair(cls); - cls = registerCellSubclass(NSImageView.cellClass(), size, align, types); + cls = registerCellSubclass(NSImageView.cellClass(), size, align_, types); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); NSImageView.setCellClass(cls); className = "SWTStepper"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSStepper, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); addEventMethods(cls, proc2, proc3, drawRectProc); addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); OS.objc_registerClassPair(cls); - cls = registerCellSubclass(NSStepper.cellClass(), size, align, types); + cls = registerCellSubclass(NSStepper.cellClass(), size, align_, types); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); NSStepper.setCellClass(cls); className = "SWTScroller"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSScroller, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); addEventMethods(cls, proc2, proc3, drawRectProc); addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc); @@ -2125,13 +2127,13 @@ className = "SWTMenuItem"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSMenuItem, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); OS.objc_registerClassPair(cls); className = "SWTTextView"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSTextView, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); addEventMethods(cls, proc2, proc3, drawRectProc); addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); @@ -2151,7 +2153,7 @@ className = "SWTTextField"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSTextField, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); addEventMethods(cls, proc2, proc3, drawRectProc); addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); @@ -2160,13 +2162,13 @@ OS.class_addMethod(cls, OS.sel_textView_willChangeSelectionFromCharacterRange_toCharacterRange_, textWillChangeSelectionProc, "@:@{NSRange}{NSRange}"); OS.objc_registerClassPair(cls); - cls = registerCellSubclass(NSTextField.cellClass(), size, align, types); + cls = registerCellSubclass(NSTextField.cellClass(), size, align_, types); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); NSTextField.setCellClass(cls); className = "SWTSearchField"; cls = OS.objc_allocateClassPair(OS.class_NSSearchField, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); addEventMethods(cls, proc2, proc3, drawRectProc); addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); @@ -2175,13 +2177,13 @@ OS.class_addMethod(cls, OS.sel_textView_willChangeSelectionFromCharacterRange_toCharacterRange_, textWillChangeSelectionProc, "@:@{NSRange}{NSRange}"); OS.objc_registerClassPair(cls); - cls = registerCellSubclass(NSSearchField.cellClass(), size, align, types); + cls = registerCellSubclass(NSSearchField.cellClass(), size, align_, types); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); NSSearchField.setCellClass(cls); className = "SWTSecureTextField"; cls = OS.objc_allocateClassPair(OS.class_NSSecureTextField, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); addEventMethods(cls, proc2, proc3, drawRectProc); addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); @@ -2194,7 +2196,7 @@ className = "SWTWindow"; cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSWindow, className, 0); - OS.class_addIvar(cls, DWT_OBJECT, size, (byte)align, types); + OS.class_addIvar(cls, SWT_OBJECT, size, cast(byte)align_, types); OS.class_addMethod(cls, OS.sel_sendEvent_, proc3, "@:@"); OS.class_addMethod(cls, OS.sel_helpRequested_, proc3, "@:@"); OS.class_addMethod(cls, OS.sel_canBecomeKeyWindow, proc2, "@:"); @@ -2226,8 +2228,8 @@ public objc.id internal_new_GC (GCData data) { if (isDisposed()) DWT.error(DWT.ERROR_DEVICE_DISPOSED); if (screenWindow is null) { - NSWindow window = (NSWindow) new NSWindow ().alloc (); - NSRect rect = new NSRect(); + NSWindow window = cast(NSWindow) (new NSWindow ()).alloc (); + NSRect rect = NSRect(); window = window.initWithContentRect(rect, OS.NSBorderlessWindowMask, OS.NSBackingStoreBuffered, false); window.setReleasedWhenClosed(false); screenWindow = window; @@ -2724,7 +2726,7 @@ checkDevice (); if (loopCounter is 0) { pool.release(); - pool = (NSAutoreleasePool)new NSAutoreleasePool().alloc().init(); + pool = cast(NSAutoreleasePool)(new NSAutoreleasePool()).alloc().init(); } loopCounter ++; bool events = false; @@ -2738,7 +2740,7 @@ events = true; application.sendEvent(event); } -// NSEvent event = NSEvent.otherEventWithType(OS.NSApplicationDefined, new NSPoint(), 0, 0, 0, null, DWT_IDLE_TYPE, 0, 0); +// NSEvent event = NSEvent.otherEventWithType(OS.NSApplicationDefined, NSPoint(), 0, 0, 0, null, DWT_IDLE_TYPE, 0, 0); // application.postEvent(event, false); // idle = true; // application.run(); @@ -2951,10 +2953,10 @@ Widget removeWidget (NSObject view) { if (view is null) return null; int /*long*/ [] jniRef = new int /*long*/ [1]; - OS.object_getInstanceVariable(view.id, DWT_OBJECT, jniRef); + OS.object_getInstanceVariable(view.id, SWT_OBJECT, jniRef); if (jniRef[0] is 0) return null; - Widget widget = (Widget)OS.JNIGetObject(jniRef[0]); - OS.object_setInstanceVariable(view.id, DWT_OBJECT, 0); + Widget widget = cast(Widget)OS.JNIGetObject(jniRef[0]); + OS.object_setInstanceVariable(view.id, SWT_OBJECT, 0); return widget; } @@ -3088,13 +3090,8 @@ } //TODO use custom timer instead of timerExec -Runnable hoverTimer = new Runnable () { - public void run () { - if (currentControl !is null && !currentControl.isDisposed()) { - currentControl.sendMouseEvent (null, DWT.MouseHover, trackingControl !is null); - } - } -}; +Runnable hoverTimer; + //TODO - use custom timer instead of timerExec Runnable caretTimer; @@ -3188,9 +3185,9 @@ //if (key is null) error (DWT.ERROR_NULL_ARGUMENT); if (key.equals (ADD_WIDGET_KEY)) { - Object [] data = (Object [])value; - NSObject object = (NSObject)data [0]; - Widget widget = (Widget)data [1]; + Object [] data = cast(Object [])value; + NSObject object = cast(NSObject)data [0]; + Widget widget = cast(Widget)data [1]; if (widget is null) { removeWidget (object); } else { @@ -3558,8 +3555,8 @@ if (view !is null) { do { Widget widget = getWidget (view); - if (widget instanceof Control) { - control = (Control)widget; + if (cast(Control) widget) { + control = cast(Control)widget; break; } view = view.superview(); @@ -3571,13 +3568,13 @@ return control; } -int /*long*/ applicationNextEventMatchingMask (int /*long*/ id, int /*long*/ sel, int /*long*/ mask, int /*long*/ expiration, int /*long*/ mode, int /*long*/ dequeue) { - objc_super super_struct = new objc_super(); +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); - int /*long*/ result = OS.objc_msgSendSuper(super_struct, sel, mask, expiration, mode, dequeue !is 0); - if (result !is 0) { - if (trackingControl !is null && dequeue !is 0) { + 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); applicationSendMouseEvent(nsEvent, true); } @@ -3588,7 +3585,7 @@ void applicationSendMouseEvent (NSEvent nsEvent, bool send) { if (send) runDeferredEvents(); bool up = false; - int type = (int)/*64*/nsEvent.type(); + int type = cast(int)/*64*/nsEvent.type(); switch (type) { case OS.NSLeftMouseDown: case OS.NSRightMouseDown: @@ -3645,7 +3642,7 @@ } } -void applicationSendEvent (int /*long*/ id, int /*long*/ sel, int /*long*/ event) { +void applicationSendEvent (objc.id id, objc.SEL sel, objc.id event) { NSEvent nsEvent = new NSEvent(event); int type = nsEvent.type (); bool beep = false; @@ -3668,7 +3665,7 @@ case OS.NSScrollWheel: NSWindow window = nsEvent.window (); if (window !is null) { - Shell shell = (Shell) getWidget (window.id); + Shell shell = cast(Shell) getWidget (window.id); if (shell !is null && shell.getModalShell () !is null) { if (beep) beep (); return; @@ -3677,7 +3674,7 @@ break; } applicationSendMouseEvent (nsEvent, false); - objc_super super_struct = new objc_super (); + 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); @@ -3689,42 +3686,44 @@ // application.stop(null); } +extern (C): + // #245724: [NSApplication isRunning] must return true to allow the AWT to load correctly. -static int /*long*/ applicationProc(int /*long*/ id, int /*long*/ sel) { +static objc.id applicationProc2(objc.id id, objc.SEL sel) { //TODO optimize getting the display Display display = getCurrent (); - if (display is null) return 0; + if (display is null) return null; if (sel is OS.sel_isRunning) { - return display.isDisposed() ? 0 : 1; + return cast(objc.id) (display.isDisposed() ? null : 1); } - return 0; + return null; } -static int /*long*/ applicationProc(int /*long*/ id, int /*long*/ sel, int /*long*/ event) { +static objc.id applicationProc3(objc.id id, objc.SEL sel, objc.id event) { //TODO optimize getting the display Display display = getCurrent (); - if (display is null) return 0; + if (display is null) return null; if (sel is OS.sel_sendEvent_) { display.applicationSendEvent (id, sel, event); - return 0; + return null; } - return 0; + return null; } -static objc.id applicationProc(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) { //TODO optimize getting the display Display display = getCurrent (); if (display is null) return null; if (sel is OS.sel_nextEventMatchingMask_untilDate_inMode_dequeue_) { return display.applicationNextEventMatchingMask(id, sel, arg0, arg1, arg2, arg3); } - return 0; + return null; } static objc.id applicationDelegateProc(objc.id id, objc.SEL sel, objc.id arg0) { //TODO optimize getting the display Display display = getCurrent (); - if (display is null) return 0; + if (display is null) return null; id applicationDelegate = display.applicationDelegate; NSApplication application = display.application; if (sel is OS.sel_applicationWillFinishLaunching_) { @@ -3746,45 +3745,43 @@ ni.setTitle(title); } } - } else if (sel == OS.sel_terminate_) { + } else if (sel is OS.sel_terminate_) { application.terminate(application); - } else if (sel == OS.sel_orderFrontStandardAboutPanel_) { + } else if (sel is OS.sel_orderFrontStandardAboutPanel_) { // Event event = new Event (); -// sendEvent (DWT.ABORT, event); - } else if (sel == OS.sel_hideOtherApplications_) { +// sendEvent (SWT.ABORT, event); + } else if (sel is OS.sel_hideOtherApplications_) { application.hideOtherApplications(application); - } else if (sel == OS.sel_hide_) { + } else if (sel is OS.sel_hide_) { application.hide(application); - } else if (sel == OS.sel_unhideAllApplications_) { + } else if (sel is OS.sel_unhideAllApplications_) { application.unhideAllApplications(application); - } else if (sel == OS.sel_applicationShouldTerminate_) { + } else if (sel is OS.sel_applicationShouldTerminate_) { if (!display.disposing) { Event event = new Event (); - display.sendEvent (DWT.Close, event); + display.sendEvent (SWT.Close, event); if (event.doit) { - return cast(objc.id) OS.NSTerminateNow; + return OS.NSTerminateNow; } } - return cast(objc.id) OS.NSTerminateCancel; - } else if (sel == OS.sel_applicationWillTerminate_) { + return OS.NSTerminateCancel; + } else if (sel is OS.sel_applicationWillTerminate_) { display.dispose(); - } else if (sel == OS.sel_applicationWillResignActive_) { + } else if (sel is OS.sel_applicationWillResignActive_) { Shell[] shells = display.getShells(); for (int i = 0; i < shells.length; i++) { shells[i].clearLevel(); } } - } + return null; } -static objc.id dialogProc(objc.id id, objc.SEL selector, objc.id arg0) { - String sel = fromStringz(selector); - - objc.id jniRef; - OS.object_getInstanceVariable(id, DWT_OBJECT, jniRef); - if (jniRef is null) return 0; +static objc.id dialogProc(objc.id id, objc.SEL selector, objc.id arg0) { + void* jniRef; + OS.object_getInstanceVariable(id, SWT_OBJECT, jniRef); + if (jniRef is null) return null; if (sel == OS.sel_changeColor_) { - ColorDialog dialog = (ColorDialog)OS.JNIGetObject(jniRef); + ColorDialog dialog = cast(ColorDialog)OS.JNIGetObject(jniRef); if (jniRef is null) return null; dialog.changeColor(id, sel, arg0); } else if (sel == OS.sel_changeFont_) { @@ -3792,7 +3789,7 @@ if (dialog is null) return null; dialog.changeFont(id, sel, arg0); } else if (sel == OS.sel_windowWillClose_) { - Object object = OS.JNIGetObject(jniRef[0]); + Object object = OS.JNIGetObject(jniRef); if (cast(FontDialog) object) { (cast(FontDialog)object).windowWillClose(id, sel, arg0); } else if (cast(ColorDialog) object) { @@ -3802,28 +3799,26 @@ return null; } -static int objc.id windowDelegateProc2(objc.id id, objc.SEL selector) { - String sel = fromStringz(selector); - +static objc.id windowDelegateProc2(objc.id id, objc.SEL selector) { Widget widget = GetWidget(id); if (widget is null) return null; - if (sel == OS.sel_sendSelection) { + if (sel is OS.sel_sendSelection) { widget.sendSelection(); - } else if (sel == OS.sel_sendDoubleSelection) { + } else if (sel is OS.sel_sendDoubleSelection) { widget.sendDoubleSelection(); - } else if (sel == OS.sel_sendVerticalSelection) { + } else if (sel is OS.sel_sendVerticalSelection) { widget.sendVerticalSelection(); - } else if (sel == OS.sel_sendHorizontalSelection) { + } else if (sel is OS.sel_sendHorizontalSelection) { widget.sendHorizontalSelection(); - } else if (sel == OS.sel_acceptsFirstResponder) { + } else if (sel is OS.sel_acceptsFirstResponder) { return widget.acceptsFirstResponder(id, sel) ? cast(objc.id) 1 : null; } else if (sel is OS.sel_becomeFirstResponder) { return widget.becomeFirstResponder(id, sel) ? cast(objc.id) 1 : null; } else if (sel is OS.sel_resignFirstResponder) { return widget.resignFirstResponder(id, sel) ? cast(objc.id) 1 : null; - } else if (sel == OS.sel_isFlipped) { + } else if (sel is OS.sel_isFlipped) { return widget.isFlipped(id, sel) ? cast(objc.id) 1 : null; - } else if (sel == OS.sel_isOpaque) { + } else if (sel is OS.sel_isOpaque) { return widget.isOpaque(id, sel) ? cast(objc.id) 1 : null; } else if (sel is OS.sel_unmarkText) { //TODO not called? @@ -3832,19 +3827,19 @@ } else if (sel is OS.sel_markedRange) { NSRange range = widget.markedRange (id, sel); /* NOTE that this is freed in C */ - int /*long*/ result = OS.malloc (NSRange.sizeof); + objc.id result = 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 */ - int /*long*/ result = OS.malloc (NSRange.sizeof); + objc.id result = OS.malloc (NSRange.sizeof); OS.memmove (result, range, NSRange.sizeof); return result; } else if (sel is OS.sel_hasMarkedText) { - return widget.hasMarkedText (id, sel) ? 1 : 0; + return widget.hasMarkedText (id, sel) ? cast(objc.id) 1 : null; } else if (sel is OS.sel_canBecomeKeyWindow) { - return widget.canBecomeKeyWindow (id, sel) ? 1 : 0; + return widget.canBecomeKeyWindow (id, sel) ? cast(objc.id) 1 : null; } else if (sel is OS.sel_accessibilityActionNames) { return widget.accessibilityActionNames(id, sel); } else if (sel is OS.sel_accessibilityAttributeNames) { @@ -3854,77 +3849,72 @@ } else if (sel is OS.sel_accessibilityFocusedUIElement) { return widget.accessibilityFocusedUIElement(id, sel); } else if (sel is OS.sel_accessibilityIsIgnored) { - return (widget.accessibilityIsIgnored(id, sel) ? 1 : 0); + return (widget.accessibilityIsIgnored(id, sel) ? cast(objc.id) 1 : null); } return null; } static objc.id windowDelegateProc3(objc.id ID, objc.SEL selector, objc.id arg0) { - String sel = fromStringz(selector); - - if (sel == OS.sel_timerProc_) { + if (sel is OS.sel_timerProc_) { //TODO optimize getting the display Display display = getCurrent (); if (display is null) return null; return display.timerProc (id, sel, arg0); - - if (sel == OS.sel_timerProc_1) { - return timerProc (arg0_); } Widget widget = GetWidget(id); - if (widget is null && (sel == OS.sel_keyDown_ ||sel == OS.sel_keyUp_ ||sel == OS.sel_insertText_ ||sel == OS.sel_doCommandBySelector_)) { - widget = GetFocusControl (new NSView (id).window ()); + 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 null; - if (sel == OS.sel_windowWillClose_) { + if (widget is null) return 0; + if (sel is OS.sel_windowWillClose_) { widget.windowWillClose(id, sel, arg0); - } else if (sel == OS.sel_drawRect_) { - NSRect rect = NSRect(); - OS.memmove(&rect, arg0_, NSRect.sizeof); + } else if (sel is OS.sel_drawRect_) { + NSRect rect = new NSRect(); + OS.memmove(rect, arg0, NSRect.sizeof); widget.drawRect(id, sel, rect); - } else if (sel == OS.sel_setFrameOrigin_) { - NSPoint point = NSPoint(); + } else if (sel is OS.sel_setFrameOrigin_) { + NSPoint point = new NSPoint(); OS.memmove(point, arg0, NSPoint.sizeof); widget.setFrameOrigin(id, sel, point); - } else if (sel == OS.sel_setFrameSize_) { + } else if (sel is OS.sel_setFrameSize_) { NSSize size = new NSSize(); OS.memmove(size, arg0, NSSize.sizeof); widget.setFrameSize(id, sel, size); - } else if (sel == OS.sel_hitTest_) { + } else if (sel is OS.sel_hitTest_) { NSPoint point = new NSPoint(); OS.memmove(point, arg0, NSPoint.sizeof); return widget.hitTest(id, sel, point); - } else if (sel == OS.sel_windowShouldClose_) { - return widget.windowShouldClose(id, sel, arg0) ? 1 : 0; - } else if (sel == OS.sel_mouseDown_) { + } else if (sel is OS.sel_windowShouldClose_) { + return widget.windowShouldClose(id, sel, arg0) ? cast(objc.id) 1 : null; + } else if (sel is OS.sel_mouseDown_) { widget.mouseDown(id, sel, arg0); - } else if (sel == OS.sel_keyDown_) { + } else if (sel is OS.sel_keyDown_) { widget.keyDown(id, sel, arg0); - } else if (sel == OS.sel_keyUp_) { + } else if (sel is OS.sel_keyUp_) { widget.keyUp(id, sel, arg0); - } else if (sel == OS.sel_flagsChanged_) { + } else if (sel is OS.sel_flagsChanged_) { widget.flagsChanged(id, sel, arg0); - } else if (sel == OS.sel_mouseUp_) { + } else if (sel is OS.sel_mouseUp_) { widget.mouseUp(id, sel, arg0); - } else if (sel == OS.sel_rightMouseDown_) { + } else if (sel is OS.sel_rightMouseDown_) { widget.rightMouseDown(id, sel, arg0); - } else if (sel == OS.sel_rightMouseUp_) { + } else if (sel is OS.sel_rightMouseUp_) { widget.rightMouseUp(id, sel, arg0); - } else if (sel == OS.sel_otherMouseDown_) { + } else if (sel is OS.sel_otherMouseDown_) { widget.otherMouseDown(id, sel, arg0); - } else if (sel == OS.sel_otherMouseUp_) { + } else if (sel is OS.sel_otherMouseUp_) { widget.otherMouseUp(id, sel, arg0); - } else if (sel == OS.sel_mouseMoved_) { + } else if (sel is OS.sel_mouseMoved_) { widget.mouseMoved(id, sel, arg0); - } else if (sel == OS.sel_mouseDragged_) { + } else if (sel is OS.sel_mouseDragged_) { widget.mouseDragged(id, sel, arg0); - } else if (sel == OS.sel_mouseEntered_) { + } else if (sel is OS.sel_mouseEntered_) { widget.mouseEntered(id, sel, arg0); - } else if (sel == OS.sel_mouseExited_) { + } else if (sel is OS.sel_mouseExited_) { widget.mouseExited(id, sel, arg0); - } else if (sel == OS.sel_menuForEvent_) { + } else if (sel is OS.sel_menuForEvent_) { return widget.menuForEvent(id, sel, arg0); - } else if (sel == OS.sel_numberOfRowsInTableView_) { + } else if (sel is OS.sel_numberOfRowsInTableView_) { return widget.numberOfRowsInTableView(id, sel, arg0); } else if (sel is OS.sel_comboBoxSelectionDidChange_) { widget.comboBoxSelectionDidChange(id, sel, arg0); @@ -3969,7 +3959,7 @@ } else if (sel is OS.sel_firstRectForCharacterRange_) { NSRect rect = widget.firstRectForCharacterRange (id, sel, arg0); /* NOTE that this is freed in C */ - int /*long*/ result = OS.malloc (NSRect.sizeof); + objc.id result = OS.malloc (NSRect.sizeof); OS.memmove (result, rect, NSRect.sizeof); return result; } else if (sel is OS.sel_insertText_) { @@ -3987,13 +3977,13 @@ } else if (sel is OS.sel_accessibilityAttributeValue_) { return widget.accessibilityAttributeValue(id, sel, arg0); } else if (sel is OS.sel_accessibilityIsAttributeSettable_) { - return (widget.accessibilityIsAttributeSettable(id, sel, arg0) ? 1 : 0); + return (widget.accessibilityIsAttributeSettable(id, sel, arg0) ? cast(objc.id) 1 : null); } else if (sel is OS.sel_accessibilityPerformAction_) { widget.accessibilityPerformAction(id, sel, arg0); } else if (sel is OS.sel_accessibilityActionDescription_) { widget.accessibilityActionDescription(id, sel, arg0); } else if (sel is OS.sel_makeFirstResponder_) { - return widget.makeFirstResponder(id, sel, arg0) ? 1 : 0; + return widget.makeFirstResponder(id, sel, arg0) ? cast(objc.id) 1 : null; } else if (sel is OS.sel_tableViewColumnDidMove_) { widget.tableViewColumnDidMove(id, sel, arg0); } else if (sel is OS.sel_tableViewColumnDidResize_) { @@ -4003,28 +3993,27 @@ } else if (sel is OS.sel_outlineViewColumnDidResize_) { widget.outlineViewColumnDidResize(id, sel, arg0); } + return null; } static objc.id windowDelegateProc4(objc.id id, objc.SEL selector, objc.id arg0, objc.id arg1) { - String sel = fromStringz(selector); - - Widget widget = GetWidget(id); - - if (sel == OS.sel_tabView_willSelectTabViewItem_) { + Widget widget = GetWidget(id); + if (widget is null) return null; + if (sel is OS.sel_tabView_willSelectTabViewItem_) { widget.tabView_willSelectTabViewItem(id, sel, arg0, arg1); - } else if (sel ==is OS.sel_tabView_didSelectTabViewItem_) { + } else if (sel is OS.sel_tabView_didSelectTabViewItem_) { widget.tabView_didSelectTabViewItem(id, sel, arg0, arg1); - } else if (sel == OS.sel_outlineView_isItemExpandable_) { - return widget.outlineView_isItemExpandable(id, sel, arg0, arg1) ? 1 : 0; - } else if (sel == OS.sel_outlineView_numberOfChildrenOfItem_) { + } 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); - } else if (sel == OS.sel_outlineView_shouldCollapseItem_) { - return widget.outlineView_shouldCollapseItem(id, sel, arg0, arg1) ? 1 : 0; - } else if (sel == OS.sel_outlineView_shouldExpandItem_) { - return widget.outlineView_shouldExpandItem(id, sel, arg0, arg1) ? 1 : 0; - } else if (sel == OS.sel_menu_willHighlightItem_) { + } 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_) { + return widget.outlineView_shouldExpandItem(id, sel, arg0, arg1) ? cast(objc.id) 1 : null; + } else if (sel is OS.sel_menu_willHighlightItem_) { widget.menu_willHighlightItem(id, sel, arg0, arg1); - } else if (sel == OS.sel_setMarkedText_selectedRange_) { + } else if (sel is OS.sel_setMarkedText_selectedRange_) { widget.setMarkedText_selectedRange (id, sel, arg0, arg1); } else if (sel is OS.sel_drawInteriorWithFrame_inView_) { widget.drawInteriorWithFrame_inView (id, sel, arg0, arg1); @@ -4038,54 +4027,41 @@ return null; } -objc.id windowDelegateProc5(objc.id id, objc.SEL selector, objc.id arg0, objc.id arg1, objc.id arg2) { - String sel = fromStringz(selector); - - Widget widget = GetWidget(id); - - if (sel == OS.sel_tableView_objectValueForTableColumn_row_) { +static objc.id windowDelegateProc5(objc.id id, objc.SEL selector, 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_) { return widget.tableView_objectValueForTableColumn_row(id, sel, arg0, arg1, arg2); - } else if (sel == OS.sel_tableView_shouldEditTableColumn_row_) { + } else if (sel is OS.sel_tableView_shouldEditTableColumn_row_) { return widget.tableView_shouldEditTableColumn_row(id, sel, arg0, arg1, arg2) ? cast(objc.id) 1 : null; - } else if (sel == OS.sel_textView_clickedOnLink_atIndex_) { + } else if (sel is OS.sel_textView_clickedOnLink_atIndex_) { return widget.textView_clickOnLink_atIndex(id, sel, arg0, arg1, arg2) ? cast(objc.id) 1 : null; - } else if (sel == OS.sel_outlineView_child_ofItem_) { + } else if (sel is OS.sel_outlineView_child_ofItem_) { return widget.outlineView_child_ofItem(id, sel, arg0, arg1, arg2); - } else if (sel == OS.sel_outlineView_objectValueForTableColumn_byItem_) { + } else if (sel is OS.sel_outlineView_objectValueForTableColumn_byItem_) { return widget.outlineView_objectValueForTableColumn_byItem(id, sel, arg0, arg1, arg2); - } else if (sel == OS.sel_textView_willChangeSelectionFromCharacterRange_toCharacterRange_) { + } 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 */ - void* result = OS.malloc (NSRange.sizeof); + objc.id result = OS.malloc (NSRange.sizeof); OS.memmove (result, range, NSRange.sizeof); return result; } return null; } -objc.id windowDelegateProc6(objc.id id, objc.SEL selector, objc.id arg0, objc.id arg1, objc.id arg2, objc.id arg3) { - String sel = fromStringz(selector); - +static objc.id windowDelegateProc6(objc.id id, objc.SEL selector, objc.id arg0, objc.id arg1, objc.id arg2, objc.id arg3) { Widget widget = GetWidget(id); - - if (sel == OS.sel_tableView_willDisplayCell_forTableColumn_row_) { + if (widget is null) return null; + if (sel is OS.sel_tableView_willDisplayCell_forTableColumn_row_) { widget.tableView_willDisplayCell_forTableColumn_row(id, sel, arg0, arg1, arg2, arg3); - } else if (sel == OS.sel_outlineView_willDisplayCell_forTableColumn_item_) { + } else if (sel is OS.sel_outlineView_willDisplayCell_forTableColumn_item_) { widget.outlineView_willDisplayCell_forTableColumn_item(id, sel, arg0, arg1, arg2, arg3); - } else if (sel == OS.sel_outlineView_setObjectValue_forTableColumn_byItem_) { + } else if (sel is OS.sel_outlineView_setObjectValue_forTableColumn_byItem_) { widget.outlineView_setObjectValue_forTableColumn_byItem(id, sel, arg0, arg1, arg2, arg3); - } else if (sel == OS.sel_tableView_setObjectValue_forTableColumn_row_) { + } else if (sel is OS.sel_tableView_setObjectValue_forTableColumn_row_) { widget.tableView_setObjectValue_forTableColumn_row(id, sel, arg0, arg1, arg2, arg3); - } else if (sel == OS.sel_outlineView_1willDisplayCell_1forTableColumn_1item_1) { } return null; } - -Widget getWidget (objc.id ID) -{ - NSInteger* dObject; - OS.object_getInstanceVariable(ID, "dObject", cast(void**)dObject); - if (dObject is null) return null; - return cast(Widget)(*dObject); } -}