Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSEvent.d @ 1:8b48be5454ce
The internal cocoa classes compile now
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Tue, 19 Aug 2008 17:35:17 +0200 |
parents | 380af2bdd8e5 |
children | f565d3a95c0a |
line wrap: on
line diff
--- a/dwt/internal/cocoa/NSEvent.d Sat Aug 09 17:00:02 2008 +0200 +++ b/dwt/internal/cocoa/NSEvent.d Tue Aug 19 17:35:17 2008 +0200 @@ -13,9 +13,10 @@ *******************************************************************************/ module dwt.internal.cocoa.NSEvent; -import dwt.internal.cocoa.id; import dwt.internal.cocoa.CGEventTypes; import dwt.internal.cocoa.CGFloat; +import dwt.internal.cocoa.id; +import dwt.internal.cocoa.IOLLEvent; import dwt.internal.cocoa.NSDate : NSTimeInterval; import dwt.internal.cocoa.NSGraphicsContext; import dwt.internal.cocoa.NSInteger; @@ -54,6 +55,30 @@ NSOtherMouseDragged = 27 } +alias NSEventType.NSLeftMouseDown NSLeftMouseDown; +alias NSEventType.NSLeftMouseUp NSLeftMouseUp; +alias NSEventType.NSRightMouseDown NSRightMouseDown; +alias NSEventType.NSRightMouseUp NSRightMouseUp; +alias NSEventType.NSMouseMoved NSMouseMoved; +alias NSEventType.NSLeftMouseDragged NSLeftMouseDragged; +alias NSEventType.NSRightMouseDragged NSRightMouseDragged; +alias NSEventType.NSMouseEntered NSMouseEntered; +alias NSEventType.NSMouseExited NSMouseExited; +alias NSEventType.NSKeyDown NSKeyDown; +alias NSEventType.NSKeyUp NSKeyUp; +alias NSEventType.NSFlagsChanged NSFlagsChanged; +alias NSEventType.NSAppKitDefined NSAppKitDefined; +alias NSEventType.NSSystemDefined NSSystemDefined; +alias NSEventType.NSApplicationDefined NSApplicationDefined; +alias NSEventType.NSPeriodic NSPeriodic; +alias NSEventType.NSCursorUpdate NSCursorUpdate; +alias NSEventType.NSScrollWheel NSScrollWheel; +alias NSEventType.NSTabletPoint NSTabletPoint; +alias NSEventType.NSTabletProximity NSTabletProximity; +alias NSEventType.NSOtherMouseDown NSOtherMouseDown; +alias NSEventType.NSOtherMouseUp NSOtherMouseUp; +alias NSEventType.NSOtherMouseDragged NSOtherMouseDragged; + enum NSPointingDeviceType { NSUnknownPointingDevice = NX_TABLET_POINTER_UNKNOWN, @@ -62,6 +87,11 @@ NSEraserPointingDevice = NX_TABLET_POINTER_ERASER } +alias NSPointingDeviceType.NSUnknownPointingDevice NSUnknownPointingDevice; +alias NSPointingDeviceType.NSPenPointingDevice NSPenPointingDevice; +alias NSPointingDeviceType.NSCursorPointingDevice NSCursorPointingDevice; +alias NSPointingDeviceType.NSEraserPointingDevice NSEraserPointingDevice; + public class NSEvent : NSObject { public this () @@ -76,90 +106,90 @@ public CGEventRef CGEvent () { - return OS.objc_msgSend(this.id, OS.sel_CGEvent); + return cast(CGEventRef) OS.objc_msgSend(this.id_, OS.sel_CGEvent); } public NSInteger absoluteX () { - return OS.objc_msgSend(this.id, OS.sel_absoluteX); + return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_absoluteX); } public NSInteger absoluteY () { - return OS.objc_msgSend(this.id, OS.sel_absoluteY); + return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_absoluteY); } public NSInteger absoluteZ () { - return OS.objc_msgSend(this.id, OS.sel_absoluteZ); + return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_absoluteZ); } public NSUInteger buttonMask () { - return OS.objc_msgSend(this.id, OS.sel_buttonMask); + return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_buttonMask); } public NSInteger buttonNumber () { - return OS.objc_msgSend(this.id, OS.sel_buttonNumber); + return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_buttonNumber); } public NSUInteger capabilityMask () { - return OS.objc_msgSend(this.id, OS.sel_capabilityMask); + return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_capabilityMask); } public NSString characters () { - objc.id result = OS.objc_msgSend(this.id, OS.sel_characters); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_characters); return result !is null ? new NSString(result) : null; } public NSString charactersIgnoringModifiers () { - objc.id result = OS.objc_msgSend(this.id, OS.sel_charactersIgnoringModifiers); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_charactersIgnoringModifiers); return result !is null ? new NSString(result) : null; } public NSInteger clickCount () { - return OS.objc_msgSend(this.id, OS.sel_clickCount); + return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_clickCount); } public NSGraphicsContext context () { - objc.id result = OS.objc_msgSend(this.id, OS.sel_context); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_context); return result !is null ? new NSGraphicsContext(result) : null; } public NSInteger data1 () { - return OS.objc_msgSend(this.id, OS.sel_data1); + return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_data1); } public NSInteger data2 () { - return OS.objc_msgSend(this.id, OS.sel_data2); + return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_data2); } public CGFloat deltaX () { - return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_deltaX); + return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_deltaX); } public CGFloat deltaY () { - return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_deltaY); + return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_deltaY); } public CGFloat deltaZ () { - return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_deltaZ); + return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_deltaZ); } public NSUInteger deviceID () { - return OS.objc_msgSend(this.id, OS.sel_deviceID); + return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_deviceID); } public static NSEvent enterExitEventWithType (objc.id type, NSPoint location, NSUInteger flags, NSTimeInterval time, NSInteger wNum, @@ -167,21 +197,21 @@ { objc.id result = OS.objc_msgSend(OS.class_NSEvent, OS.sel_enterExitEventWithType_1location_1modifierFlags_1timestamp_1windowNumber_1context_1eventNumber_1trackingNumber_1userData_1, - type, location, flags, time, wNum, context !is null ? context.id : null, eNum, tNum, data); + type, location, flags, time, wNum, context !is null ? context.id_ : null, eNum, tNum, data); return result !is null ? new NSEvent(result) : null; } public NSInteger eventNumber () { - return OS.objc_msgSend(this.id, OS.sel_eventNumber); + return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_eventNumber); } public /*const*/void* eventRef () { - return OS.objc_msgSend(this.id, OS.sel_eventRef); + return OS.objc_msgSend(this.id_, OS.sel_eventRef); } - public static NSEvent eventWithCGEvent (CGEvent cgEvent) + public static NSEvent eventWithCGEvent (CGEventRef cgEvent) { objc.id result = OS.objc_msgSend(OS.class_NSEvent, OS.sel_eventWithCGEvent_1, cgEvent); return result !is null ? new NSEvent(result) : null; @@ -195,12 +225,12 @@ public bool isARepeat () { - return OS.objc_msgSend(this.id, OS.sel_isARepeat) !is null; + return OS.objc_msgSend(this.id_, OS.sel_isARepeat) !is null; } public bool isEnteringProximity () { - return OS.objc_msgSend(this.id, OS.sel_isEnteringProximity) !is null; + return OS.objc_msgSend(this.id_, OS.sel_isEnteringProximity) !is null; } public static bool isMouseCoalescingEnabled () @@ -210,7 +240,7 @@ public short keyCode () { - return cast(short) OS.objc_msgSend(this.id, OS.sel_keyCode); + return cast(short) OS.objc_msgSend(this.id_, OS.sel_keyCode); } public static NSEvent keyEventWithType (NSEventType type, NSPoint location, NSUInteger flags, NSTimeInterval time, NSInteger wNum, @@ -220,21 +250,21 @@ result = OS.objc_msgSend( OS.class_NSEvent, OS.sel_keyEventWithType_1location_1modifierFlags_1timestamp_1windowNumber_1context_1characters_1charactersIgnoringModifiers_1isARepeat_1keyCode_1, - type, location, flags, time, wNum, context !is null ? context.id : null, keys !is null ? keys.id : null, - ukeys !is null ? ukeys.id : null, flag, code); + type, location, flags, time, wNum, context !is null ? context.id_ : null, keys !is null ? keys.id_ : null, + ukeys !is null ? ukeys.id_ : null, flag, code); return result !is null ? new NSEvent(result) : null; } public NSPoint locationInWindow () { NSPoint result; - OS.objc_msgSend_struct(result, this.id, OS.sel_locationInWindow); + OS.objc_msgSend_struct(&result, this.id_, OS.sel_locationInWindow); return result; } public NSUInteger modifierFlags () { - return OS.objc_msgSend(this.id, OS.sel_modifierFlags); + return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_modifierFlags); } public static NSEvent mouseEventWithType (NSEventType type, NSPoint location, NSUInteger flags, NSTimeInterval time, NSInteger wNum, @@ -242,14 +272,14 @@ { objc.id result = OS.objc_msgSend(OS.class_NSEvent, OS.sel_mouseEventWithType_1location_1modifierFlags_1timestamp_1windowNumber_1context_1eventNumber_1clickCount_1pressure_1, type, - location, flags, time, wNum, context !is null ? context.id : null, eNum, cNum, pressure); + location, flags, time, wNum, context !is null ? context.id_ : null, eNum, cNum, pressure); return result !is null ? new NSEvent(result) : null; } public static NSPoint mouseLocation () { NSPoint result; - OS.objc_msgSend_struct(result, OS.class_NSEvent, OS.sel_mouseLocation); + OS.objc_msgSend_struct(&result, OS.class_NSEvent, OS.sel_mouseLocation); return result; } @@ -258,33 +288,33 @@ { objc.id result = OS.objc_msgSend(OS.class_NSEvent, OS.sel_otherEventWithType_1location_1modifierFlags_1timestamp_1windowNumber_1context_1subtype_1data1_1data2_1, type, location, flags, - time, wNum, context !is null ? context.id : null, subtype, d1, d2); + time, wNum, context !is null ? context.id_ : null, subtype, d1, d2); return result !is null ? new NSEvent(result) : null; } public NSUInteger pointingDeviceID () { - return OS.objc_msgSend(this.id, OS.sel_pointingDeviceID); + return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_pointingDeviceID); } public NSUInteger pointingDeviceSerialNumber () { - return OS.objc_msgSend(this.id, OS.sel_pointingDeviceSerialNumber); + return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_pointingDeviceSerialNumber); } public NSPointingDeviceType pointingDeviceType () { - return OS.objc_msgSend(this.id, OS.sel_pointingDeviceType); + return cast(NSPointingDeviceType) OS.objc_msgSend(this.id_, OS.sel_pointingDeviceType); } public float pressure () { - return cast(float) OS.objc_msgSend_fpret(this.id, OS.sel_pressure); + return cast(float) OS.objc_msgSend_fpret(this.id_, OS.sel_pressure); } public float rotation () { - return cast(float) OS.objc_msgSend_fpret(this.id, OS.sel_rotation); + return cast(float) OS.objc_msgSend_fpret(this.id_, OS.sel_rotation); } public static void setMouseCoalescingEnabled (bool flag) @@ -304,87 +334,87 @@ public short subtype () { - return cast(short) OS.objc_msgSend(this.id, OS.sel_subtype); + return cast(short) OS.objc_msgSend(this.id_, OS.sel_subtype); } public NSUInteger systemTabletID () { - return OS.objc_msgSend(this.id, OS.sel_systemTabletID); + return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_systemTabletID); } public NSUInteger tabletID () { - return OS.objc_msgSend(this.id, OS.sel_tabletID); + return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_tabletID); } public float tangentialPressure () { - return cast(float) OS.objc_msgSend_fpret(this.id, OS.sel_tangentialPressure); + return cast(float) OS.objc_msgSend_fpret(this.id_, OS.sel_tangentialPressure); } public NSPoint tilt () { NSPoint result; - OS.objc_msgSend_stret(result, this.id, OS.sel_tilt); + OS.objc_msgSend_stret(&result, this.id_, OS.sel_tilt); return result; } public NSTimeInterval timestamp () { - return OS.objc_msgSend_fpret(this.id, OS.sel_timestamp); + return OS.objc_msgSend_fpret(this.id_, OS.sel_timestamp); } public NSTrackingArea trackingArea () { - objc.id result = OS.objc_msgSend(this.id, OS.sel_trackingArea); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_trackingArea); return result !is null ? new NSTrackingArea(result) : null; } public NSInteger trackingNumber () { - return OS.objc_msgSend(this.id, OS.sel_trackingNumber); + return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_trackingNumber); } public NSEventType type () { - return OS.objc_msgSend(this.id, OS.sel_type); + return cast(NSEventType) OS.objc_msgSend(this.id_, OS.sel_type); } public long uniqueID () { - return cast(long) OS.objc_msgSend(this.id, OS.sel_uniqueID); + return cast(long) OS.objc_msgSend(this.id_, OS.sel_uniqueID); } public void* userData () { - return OS.objc_msgSend(this.id, OS.sel_userData); + return OS.objc_msgSend(this.id_, OS.sel_userData); } public id vendorDefined () { - objc.id result = OS.objc_msgSend(this.id, OS.sel_vendorDefined); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_vendorDefined); return result !is null ? new id(result) : null; } public NSUInteger vendorID () { - return OS.objc_msgSend(this.id, OS.sel_vendorID); + return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_vendorID); } public NSUInteger vendorPointingDeviceType () { - return OS.objc_msgSend(this.id, OS.sel_vendorPointingDeviceType); + return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_vendorPointingDeviceType); } public NSWindow window () { - objc.id result = OS.objc_msgSend(this.id, OS.sel_window); + objc.id result = OS.objc_msgSend(this.id_, OS.sel_window); return result !is null ? new NSWindow(result) : null; } public NSInteger windowNumber () { - return OS.objc_msgSend(this.id, OS.sel_windowNumber); + return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_windowNumber); } }