Mercurial > projects > dwt-mac
diff dwt/widgets/Widget.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/Widget.d Mon Dec 01 17:07:00 2008 +0100 +++ b/dwt/widgets/Widget.d Fri Dec 05 16:00:41 2008 +0100 @@ -14,8 +14,6 @@ module dwt.widgets.Widget; -import tango.core.Thread; - import dwt.DWT; import dwt.DWTException; import dwt.events.DisposeListener; @@ -33,15 +31,17 @@ import dwt.internal.cocoa.OS; import dwt.internal.cocoa.objc_super; +import tango.core.Thread; + import dwt.dwthelper.utils; -import dwt.internal.cocoa.NSInteger; +import dwt.internal.objc.cocoa.Cocoa; import objc = dwt.internal.objc.runtime; - import dwt.widgets.Display; import dwt.widgets.Event; import dwt.widgets.EventTable; import dwt.widgets.Listener; import dwt.widgets.TypedListener; + /** * This class is the abstract superclass of all user interface objects. * Widgets are created, disposed and issue notification to listeners @@ -75,7 +75,7 @@ EventTable eventTable; Object data; - char* jniRef; + void* jniRef; /* Global state flags */ static const int DISPOSED = 1 << 0; @@ -154,52 +154,53 @@ display = parent.display; } -int accessibilityActionDescription(objc.id id, objc.SEL sel, objc.id arg0) { +objc.id accessibilityActionDescription(objc.id id, objc.SEL sel, objc.id arg0) { return callSuperObject(id, sel, arg0); } -int accessibilityActionNames(int /*long*/ id, int /*long*/ sel) { +objc.id accessibilityActionNames(objc.id id, objc.SEL sel) { return callSuperObject(id, sel); } -int accessibilityAttributeNames(int /*long*/ id, int /*long*/ sel) { +objc.id accessibilityAttributeNames(objc.id id, objc.SEL sel) { return callSuperObject(id, sel); } -int accessibilityAttributeValue(int /*long*/ id, int /*long*/ sel, int /*long*/ arg0) { +objc.id accessibilityAttributeValue(objc.id id, objc.SEL sel, objc.id arg0) { return callSuperObject(id, sel, arg0); } -int accessibilityAttributeValue_forParameter(int id, int sel, int /*long*/ arg0, int /*long*/ arg1) { +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); } -int accessibilityFocusedUIElement(int /*long*/ id, int /*long*/ sel) { +objc.id accessibilityFocusedUIElement(objc.id id, objc.SEL sel) { return callSuperObject(id, sel); } -int accessibilityHitTest(int /*long*/ id, int /*long*/ sel, NSPoint point) { - objc_super super_struct = new objc_super(); +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); } -bool accessibilityIsAttributeSettable(int /*long*/ id, int /*long*/ sel, int /*long*/ arg0) { +bool accessibilityIsAttributeSettable(objc.id id, objc.SEL sel, objc.id arg0) { return callSuperBoolean(id, sel, arg0); } -bool accessibilityIsIgnored(int /*long*/ id, int /*long*/ sel) { +bool accessibilityIsIgnored(objc.id id, objc.SEL sel) { return callSuperBoolean(id, sel); } -int accessibilityParameterizedAttributeNames(int /*long*/ id, int /*long*/ sel) { +objc.id accessibilityParameterizedAttributeNames(objc.id id, objc.SEL sel) { return callSuperObject(id, sel); } -void accessibilityPerformAction(int /*long*/ id, int /*long*/ sel, int /*long*/ arg0) { +void accessibilityPerformAction(objc.id id, objc.SEL sel, objc.id arg0) { callSuper(id, sel, arg0); } @@ -213,76 +214,76 @@ return null; } -int /*long*/ attributedSubstringFromRange (int /*long*/ id, int /*long*/ sel, int /*long*/ range) { +objc.id attributedSubstringFromRange (objc.id id, objc.SEL sel, objc.id range) { return 0; } -void callSuper(int /*long*/ id, int /*long*/ sel, int /*long*/ arg0) { - objc_super super_struct = new objc_super(); +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); } -void callSuper(int /*long*/ id, int /*long*/ sel, NSRect arg0) { - objc_super super_struct = new objc_super(); +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); } -void callSuper(int /*long*/ id, int /*long*/ sel, NSRect arg0, int /*long*/ arg1) { - objc_super super_struct = new objc_super(); +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); } -bool callSuperBoolean(int /*long*/ id, int /*long*/ sel) { - objc_super super_struct = new objc_super(); +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 0; + return OS.objc_msgSendSuper(super_struct, sel) !is null; } -bool canBecomeKeyWindow (int /*long*/ id, int /*long*/ sel) { +bool canBecomeKeyWindow (objc.id id, objc.SEL sel) { return callSuperBoolean (id, sel); } -bool callSuperBoolean(int /*long*/ id, int /*long*/ sel, int /*long*/ arg0) { - objc_super super_struct = new objc_super(); +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 0; + return OS.objc_msgSendSuper(super_struct, sel, arg0) !is null; } -int callSuperObject(int /*long*/ id, int /*long*/ sel) { - objc_super super_struct = new objc_super(); +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); } -int callSuperObject(int /*long*/ id, int /*long*/ sel, int /*long*/ arg0) { - objc_super super_struct = new objc_super(); +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); } -int /*long*/ characterIndexForPoint (int /*long*/ id, int /*long*/ sel, int /*long*/ point) { +int /*long*/ characterIndexForPoint (objc.id id, objc.SEL sel, objc.id point) { return OS.NSNotFound; } -bool acceptsFirstResponder (int /*long*/ id, int /*long*/ sel) { +bool acceptsFirstResponder (objc.id id, objc.SEL sel) { return callSuperBoolean(id, sel); } -bool becomeFirstResponder (int /*long*/ id, int /*long*/ sel) { +bool becomeFirstResponder (objc.id id, objc.SEL sel) { return callSuperBoolean(id, sel); } -bool resignFirstResponder (int /*long*/ id, int /*long*/ sel) { +bool resignFirstResponder (objc.id id, objc.SEL sel) { return callSuperBoolean(id, sel); } @@ -443,18 +444,18 @@ if ((state & DISPOSED) !is 0) error (DWT.ERROR_WIDGET_DISPOSED); } -bool textView_clickOnLink_atIndex(int /*long*/ id, int /*long*/ sel, int /*long*/ textView, int /*long*/ link, int /*long*/ charIndex) { +bool textView_clickOnLink_atIndex(objc.id id, objc.SEL sel, objc.id textView, objc.id link, objc.id charIndex) { return true; } -void comboBoxSelectionDidChange(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) { +void comboBoxSelectionDidChange(objc.id id, objc.SEL sel, objc.id notification) { } -void copyToClipboard (char [] buffer) { +void copyToClipboard (wchar [] buffer) { if (buffer.length is 0) return; NSPasteboard pasteboard = NSPasteboard.generalPasteboard (); pasteboard.declareTypes (NSArray.arrayWithObject (OS.NSStringPboardType), null); - pasteboard.setString (NSString.stringWithCharacters (buffer, buffer.length), OS.NSStringPboardType); + pasteboard.setString (NSString.stringWithCharacters (buffer.ptr, buffer.length), OS.NSStringPboardType); } void createHandle () { @@ -462,7 +463,7 @@ void createJNIRef () { jniRef = OS.NewGlobalRef(this); - if (jniRef is 0) error (DWT.ERROR_NO_HANDLES); + if (jniRef is null) error (DWT.ERROR_NO_HANDLES); } void createWidget () { @@ -475,8 +476,8 @@ } void destroyJNIRef () { - if (jniRef !is 0) OS.DeleteGlobalRef (jniRef); - jniRef = 0; + //if (jniRef !is 0) OS.DeleteGlobalRef (jniRef); + jniRef = null; } void destroyWidget () { @@ -516,7 +517,7 @@ release (true); } -void doCommandBySelector (int /*long*/ id, int /*long*/ sel, int /*long*/ aSelector) { +void doCommandBySelector (objc.id id, objc.SEL sel, objc.id aSelector) { callSuper (id, sel, aSelector); } @@ -524,10 +525,10 @@ /* Do nothing */ } -void drawInteriorWithFrame_inView (int /*long*/ id, int /*long*/ sel, int /*long*/ cellFrame, int /*long*/ view) { +void drawInteriorWithFrame_inView (objc.id id, objc.SEL sel, int /*long*/ cellFrame, int /*long*/ view) { } -void drawRect (int /*long*/ id, int /*long*/ sel, NSRect rect) { +void drawRect (objc.id id, objc.SEL sel, NSRect rect) { //TODO offset region to view coordinates //TODO use region from control as well shell region NSGraphicsContext current = NSGraphicsContext.currentContext(); @@ -545,7 +546,7 @@ } } -void drawWidget (int /*long*/ id, NSRect rect) { +void drawWidget (objc.id id, NSRect rect) { } void error (int code) { @@ -556,10 +557,11 @@ return display.filters (eventType); } -NSRect firstRectForCharacterRange(int /*long*/ id, int /*long*/ sel, int /*long*/ range) { - return new NSRect (); +NSRect firstRectForCharacterRange(objc.id id, objc.SEL sel, objc.id range) { + return NSRect (); } +int fixMnemonic (char [] buffer) { while (i < buffer.length) { if ((buffer [j++] = buffer [i++]) is '&') { if (i is buffer.length) {continue;} @@ -718,18 +720,18 @@ return style; } -bool hasMarkedText (int /*long*/ id, int /*long*/ sel) { +bool hasMarkedText (objc.id id, objc.SEL sel) { return false; } -void helpRequested(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { +void helpRequested(objc.id id, objc.SEL sel, objc.id theEvent) { } -void highlightSelectionInClipRect(int /*long*/ id, int /*long*/ sel, int /*long*/ rect) { +void highlightSelectionInClipRect(objc.id id, objc.SEL sel, objc.id rect) { } -int /*long*/ hitTest (int /*long*/ id, int /*long*/ sel, NSPoint point) { - objc_super super_struct = new objc_super(); +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); @@ -740,7 +742,7 @@ return eventTable.hooks (eventType); } -bool insertText (int /*long*/ id, int /*long*/ sel, int /*long*/ string) { +bool insertText (objc.id id, objc.SEL sel, objc.id string) { callSuper (id, sel, string); return true; } @@ -760,7 +762,7 @@ return (state & DISPOSED) !is 0; } -bool isFlipped (int /*long*/ id, int /*long*/ sel) { +bool isFlipped (objc.id id, objc.SEL sel) { return true; } @@ -785,7 +787,7 @@ return hooks (eventType); } -bool isOpaque(int /*long*/ id, int /*long*/ sel) { +bool isOpaque(objc.id id, objc.SEL sel) { return false; } @@ -797,136 +799,136 @@ return getDisplay ().isValidThread (); } -void flagsChanged (int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { +void flagsChanged (objc.id id, objc.SEL sel, objc.id theEvent) { callSuper (id, sel, theEvent); } -void keyDown (int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { +void keyDown (objc.id id, objc.SEL sel, objc.id theEvent) { callSuper(id, sel, theEvent); } -void keyUp (int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { +void keyUp (objc.id id, objc.SEL sel, objc.id theEvent) { callSuper(id, sel, theEvent); } -void mouseDown(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { +void mouseDown(objc.id id, objc.SEL sel, objc.id theEvent) { callSuper(id, sel, theEvent); } -void mouseUp(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { +void mouseUp(objc.id id, objc.SEL sel, objc.id theEvent) { callSuper(id, sel, theEvent); } -void rightMouseDown(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { +void rightMouseDown(objc.id id, objc.SEL sel, objc.id theEvent) { callSuper(id, sel, theEvent); } -void rightMouseUp(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { +void rightMouseUp(objc.id id, objc.SEL sel, objc.id theEvent) { callSuper(id, sel, theEvent); } -void otherMouseDown(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { +void otherMouseDown(objc.id id, objc.SEL sel, objc.id theEvent) { callSuper(id, sel, theEvent); } -void otherMouseUp(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { +void otherMouseUp(objc.id id, objc.SEL sel, objc.id theEvent) { callSuper(id, sel, theEvent); } -void mouseMoved(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { +void mouseMoved(objc.id id, objc.SEL sel, objc.id theEvent) { callSuper(id, sel, theEvent); } -void mouseDragged(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { +void mouseDragged(objc.id id, objc.SEL sel, objc.id theEvent) { callSuper(id, sel, theEvent); } -void mouseEntered(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { +void mouseEntered(objc.id id, objc.SEL sel, objc.id theEvent) { callSuper(id, sel, theEvent); } -void mouseExited(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { +void mouseExited(objc.id id, objc.SEL sel, objc.id theEvent) { callSuper(id, sel, theEvent); } -bool menuHasKeyEquivalent_forEvent_target_action(int /*long*/ id, int /*long*/ sel, int /*long*/ menu, int /*long*/ event, int /*long*/ target, int /*long*/ action) { +bool menuHasKeyEquivalent_forEvent_target_action(objc.id id, objc.SEL sel, objc.id menu, objc.id event, objc.id target, objc.id action) { return true; } -int /*long*/ menuForEvent (int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { - objc_super super_struct = new objc_super(); +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); } -void menuNeedsUpdate(int /*long*/ id, int /*long*/ sel, int /*long*/ menu) { +void menuNeedsUpdate(objc.id id, objc.SEL sel, objc.id menu) { } -bool makeFirstResponder(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) { +bool makeFirstResponder(objc.id id, objc.SEL sel, objc.id notification) { return callSuperBoolean(id, sel, notification); } -NSRange markedRange (int /*long*/ id, int /*long*/ sel) { +NSRange markedRange (objc.id id, objc.SEL sel) { return new NSRange (); } -void menu_willHighlightItem(int /*long*/ id, int /*long*/ sel, int /*long*/ menu, int /*long*/ item) { -} - -void menuDidClose(int /*long*/ id, int /*long*/ sel, int /*long*/ menu) { +void menu_willHighlightItem(objc.id id, objc.SEL sel, objc.id menu, objc.id item) { } -void menuWillOpen(int /*long*/ id, int /*long*/ sel, int /*long*/ menu) { +void menuDidClose(objc.id id, objc.SEL sel, objc.id menu) { } -int /*long*/ numberOfRowsInTableView(int /*long*/ id, int /*long*/ sel, int /*long*/ aTableView) { - return 0; +void menuWillOpen(objc.id id, objc.SEL sel, objc.id menu) { } -int /*long*/ outlineView_child_ofItem(int /*long*/ id, int /*long*/ sel, int /*long*/ outlineView, int /*long*/ index, int /*long*/ item) { +int /*long*/ numberOfRowsInTableView(objc.id id, objc.SEL sel, objc.id aTableView) { return 0; } -void outlineView_didClickTableColumn(int /*long*/ id, int /*long*/ sel, int /*long*/ outlineView, int /*long*/ tableColumn) { +objc.id outlineView_child_ofItem(objc.id id, objc.SEL sel, objc.id outlineView, objc.id index, objc.id item) { + return null; } -int /*long*/ outlineView_objectValueForTableColumn_byItem(int /*long*/ id, int /*long*/ sel, int /*long*/ outlineView, int /*long*/ tableColumn, int /*long*/ item) { +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; } -bool outlineView_isItemExpandable(int /*long*/ id, int /*long*/ sel, int /*long*/ outlineView, int /*long*/ item) { +bool outlineView_isItemExpandable(objc.id id, objc.SEL sel, objc.id outlineView, objc.id item) { return false; } -int /*long*/ outlineView_numberOfChildrenOfItem(int /*long*/ id, int /*long*/ sel, int /*long*/ outlineView, int /*long*/ item) { +int /*long*/ outlineView_numberOfChildrenOfItem(objc.id id, objc.SEL sel, objc.id outlineView, objc.id item) { return 0; } -void outlineView_willDisplayCell_forTableColumn_item(int /*long*/ id, int /*long*/ sel, int /*long*/ outlineView, int /*long*/ cell, int /*long*/ tableColumn, int /*long*/ item) { +void outlineView_willDisplayCell_forTableColumn_item(objc.id id, objc.SEL sel, objc.id outlineView, objc.id cell, objc.id tableColumn, objc.id item) { } -bool outlineView_shouldCollapseItem(int /*long*/ id, int /*long*/ sel, int /*long*/ outlineView, int /*long*/ item) { +bool outlineView_shouldCollapseItem(objc.id id, objc.SEL sel, objc.id outlineView, objc.id item) { return false; } -bool outlineView_shouldExpandItem(int /*long*/ id, int /*long*/ sel, int /*long*/ outlineView, int /*long*/ item) { +bool outlineView_shouldExpandItem(objc.id id, objc.SEL sel, objc.id outlineView, objc.id item) { return false; } -void outlineViewColumnDidMove (int /*long*/ id, int /*long*/ sel, int /*long*/ aNotification) { +void outlineViewColumnDidMove (objc.id id, objc.SEL sel, objc.id aNotification) { } -void outlineViewColumnDidResize (int /*long*/ id, int /*long*/ sel, int /*long*/ aNotification) { +void outlineViewColumnDidResize (objc.id id, objc.SEL sel, objc.id aNotification) { } -void outlineViewItemDidExpand(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) { +void outlineViewItemDidExpand(objc.id id, objc.SEL sel, objc.id notification) { } -void outlineViewSelectionDidChange(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) { +void outlineViewSelectionDidChange(objc.id id, objc.SEL sel, objc.id notification) { } -void outlineView_setObjectValue_forTableColumn_byItem(int /*long*/ id, int /*long*/ sel, int /*long*/ outlineView, int /*long*/ object, int /*long*/ tableColumn, int /*long*/ item) { +void outlineView_setObjectValue_forTableColumn_byItem(objc.id id, objc.SEL sel, objc.id outlineView, objc.id object, objc.id tableColumn, objc.id item) { } /** @@ -955,11 +957,11 @@ sendEvent (eventType, event); } -void pageDown (int /*long*/ id, int /*long*/ sel, int /*long*/ sender) { +void pageDown (objc.id id, objc.SEL sel, objc.id sender) { callSuper(id, sel, sender); } -void pageUp (int /*long*/ id, int /*long*/ sel, int /*long*/ sender) { +void pageUp (objc.id id, objc.SEL sel, objc.id sender) { callSuper(id, sel, sender); } @@ -971,7 +973,7 @@ sendEvent (eventType, event, false); } -void reflectScrolledClipView (int /*long*/ id, int /*long*/ sel, int /*long*/ aClipView) { +void reflectScrolledClipView (objc.id id, objc.SEL sel, objc.id aClipView) { callSuper (id, sel, aClipView); } @@ -1102,11 +1104,11 @@ eventTable.unhook (DWT.Dispose, listener); } -void scrollWheel (int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { +void scrollWheel (objc.id id, objc.SEL sel, objc.id theEvent) { callSuper(id, sel, theEvent); } -NSRange selectedRange (int /*long*/ id, int /*long*/ sel) { +NSRange selectedRange (objc.id id, objc.SEL sel) { return new NSRange (); } @@ -1282,15 +1284,15 @@ } } -void setFrameOrigin (int /*long*/ id, int /*long*/ sel, NSPoint point) { - objc_super super_struct = new objc_super(); +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); } -void setFrameSize (int /*long*/ id, int /*long*/ sel, NSSize size) { - objc_super super_struct = new objc_super(); +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); @@ -1298,17 +1300,17 @@ bool setInputState (Event event, NSEvent nsEvent, int type) { if (nsEvent is null) return true; - int /*long*/ modifierFlags = nsEvent.modifierFlags(); + NSUInteger modifierFlags = nsEvent.modifierFlags(); if ((modifierFlags & OS.NSAlternateKeyMask) !is 0) event.stateMask |= DWT.ALT; if ((modifierFlags & OS.NSShiftKeyMask) !is 0) event.stateMask |= DWT.SHIFT; if ((modifierFlags & OS.NSControlKeyMask) !is 0) event.stateMask |= DWT.CONTROL; if ((modifierFlags & OS.NSCommandKeyMask) !is 0) event.stateMask |= DWT.COMMAND; //TODO multiple mouse buttons pressed - switch ((int)/*64*/nsEvent.type()) { + switch (cast(int)/*64*/nsEvent.type()) { case OS.NSLeftMouseDragged: case OS.NSRightMouseDragged: case OS.NSOtherMouseDragged: - switch ((int)/*64*/nsEvent.buttonNumber()) { + switch (cast(int)/*64*/nsEvent.buttonNumber()) { case 0: event.stateMask |= DWT.BUTTON1; break; case 1: event.stateMask |= DWT.BUTTON3; break; case 2: event.stateMask |= DWT.BUTTON2; break; @@ -1384,12 +1386,12 @@ default: if (event.keyCode is 0 || (DWT.KEYPAD_MULTIPLY <= event.keyCode && event.keyCode <= DWT.KEYPAD_CR)) { NSString chars = nsEvent.characters (); - if (chars.length() > 0) event.character = (char)chars.characterAtIndex (0); + if (chars.length() > 0) event.character = cast(char)chars.characterAtIndex (0); } if (event.keyCode is 0) { //TODO this is wrong for shifted keys like ';', '1' and non-english keyboards NSString unmodifiedChars = nsEvent.charactersIgnoringModifiers ().lowercaseString(); - if (unmodifiedChars.length() > 0) event.keyCode = (char)unmodifiedChars.characterAtIndex(0); + if (unmodifiedChars.length() > 0) event.keyCode = cast(char)unmodifiedChars.characterAtIndex(0); } } if (event.keyCode is 0 && event.character is 0) { @@ -1399,44 +1401,44 @@ return true; } -bool setMarkedText_selectedRange (int /*long*/ id, int /*long*/ sel, int /*long*/ string, int /*long*/ range) { +bool setMarkedText_selectedRange (objc.id id, objc.SEL sel, objc.id string, objc.id range) { return true; } -void tableViewColumnDidMove (int /*long*/ id, int /*long*/ sel, int /*long*/ aNotification) { +void tableViewColumnDidMove (objc.id id, objc.SEL sel, objc.id aNotification) { } -void tableViewColumnDidResize (int /*long*/ id, int /*long*/ sel, int /*long*/ aNotification) { +void tableViewColumnDidResize (objc.id id, objc.SEL sel, objc.id aNotification) { } -void tableViewSelectionDidChange (int /*long*/ id, int /*long*/ sel, int /*long*/ aNotification) { +void tableViewSelectionDidChange (objc.id id, objc.SEL sel, objc.id aNotification) { } -void tableView_didClickTableColumn(int /*long*/ id, int /*long*/ sel, int /*long*/ tableView, int /*long*/ tableColumn) { +void tableView_didClickTableColumn(objc.id id, objc.SEL sel, objc.id tableView, objc.id tableColumn) { } -int /*long*/ tableView_objectValueForTableColumn_row(int /*long*/ id, int /*long*/ sel, int /*long*/ aTableView, int /*long*/ aTableColumn, int /*long*/ rowIndex) { - return 0; +objc.id tableView_objectValueForTableColumn_row(objc.id id, objc.SEL sel, objc.id aTableView, objc.id aTableColumn, objc.id rowIndex) { + return null; } -void tableView_setObjectValue_forTableColumn_row(int /*long*/ id, int /*long*/ sel, int /*long*/ aTableView, int /*long*/ anObject, int /*long*/ aTableColumn, int /*long*/ rowIndex) { +void tableView_setObjectValue_forTableColumn_row(objc.id id, objc.SEL sel, objc.id aTableView, objc.id anObject, objc.id aTableColumn, objc.id rowIndex) { } -bool tableView_shouldEditTableColumn_row(int /*long*/ id, int /*long*/ sel, int /*long*/ aTableView, int /*long*/ aTableColumn, int /*long*/ rowIndex) { +bool tableView_shouldEditTableColumn_row(objc.id id, objc.SEL sel, objc.id aTableView, objc.id aTableColumn, objc.id rowIndex) { return true; } -void tableView_willDisplayCell_forTableColumn_row(int /*long*/ id, int /*long*/ sel, int /*long*/ aTableView, int /*long*/ aCell, int /*long*/ aTableColumn, int /*long*/ rowIndex) { +void tableView_willDisplayCell_forTableColumn_row(objc.id id, objc.SEL sel, objc.id aTableView, objc.id aCell, objc.id aTableColumn, objc.id rowIndex) { } -void textViewDidChangeSelection(int /*long*/ id, int /*long*/ sel, int /*long*/ aNotification) { +void textViewDidChangeSelection(objc.id id, objc.SEL sel, objc.id aNotification) { } -void textDidChange(int /*long*/ id, int /*long*/ sel, int /*long*/ aNotification) { +void textDidChange(objc.id id, objc.SEL sel, objc.id aNotification) { } -NSRange textView_willChangeSelectionFromCharacterRange_toCharacterRange(int /*long*/ id, int /*long*/ sel, int /*long*/ aTextView, int /*long*/ oldSelectedCharRange, int /*long*/ newSelectedCharRange) { - return new NSRange(); +NSRange textView_willChangeSelectionFromCharacterRange_toCharacterRange(objc.id id, objc.SEL sel, objc.id aTextView, objc.id oldSelectedCharRange, objc.id newSelectedCharRange) { + return NSRange(); } /** @@ -1454,37 +1456,37 @@ return getName () ~ " {" ~ string ~ "}"; } -int /*long*/ validAttributesForMarkedText (int /*long*/ id, int /*long*/ sel) { +int /*long*/ validAttributesForMarkedText (objc.id id, objc.SEL sel) { return 0; } -void tabView_didSelectTabViewItem(int /*long*/ id, int /*long*/ sel, int /*long*/ tabView, int /*long*/ tabViewItem) { +void tabView_didSelectTabViewItem(objc.id id, objc.SEL sel, objc.id tabView, objc.id tabViewItem) { } -void tabView_willSelectTabViewItem(int /*long*/ id, int /*long*/ sel, int /*long*/ tabView, int /*long*/ tabViewItem) { +void tabView_willSelectTabViewItem(objc.id id, objc.SEL sel, objc.id tabView, objc.id tabViewItem) { } -void windowDidMove(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) { +void windowDidMove(objc.id id, objc.SEL sel, objc.id notification) { } -void windowDidResize(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) { +void windowDidResize(objc.id id, objc.SEL sel, objc.id notification) { } -void windowDidResignKey(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) { +void windowDidResignKey(objc.id id, objc.SEL sel, objc.id notification) { } -void windowDidBecomeKey(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) { +void windowDidBecomeKey(objc.id id, objc.SEL sel, objc.id notification) { } -void windowSendEvent(int /*long*/ id, int /*long*/ sel, int /*long*/ event) { +void windowSendEvent(objc.id id, objc.SEL sel, objc.id event) { callSuper(id, sel, event); } -bool windowShouldClose(int /*long*/ id, int /*long*/ sel, int /*long*/ window) { +bool windowShouldClose(objc.id id, objc.SEL sel, objc.id window) { return false; } -void windowWillClose(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) { +void windowWillClose(objc.id id, objc.SEL sel, objc.id notification) { } }