comparison dwt/internal/cocoa/NSEvent.d @ 60:62202ce0039f

Updated and fixed many modules to 3.514
author Jacob Carlborg <doob@me.com>
date Mon, 22 Dec 2008 15:10:19 +0100
parents cfa563df4fdd
children c74ba20de292
comparison
equal deleted inserted replaced
59:83b0ad9d9238 60:62202ce0039f
24 import dwt.internal.cocoa.NSWindow; 24 import dwt.internal.cocoa.NSWindow;
25 import dwt.internal.cocoa.OS; 25 import dwt.internal.cocoa.OS;
26 import dwt.internal.objc.cocoa.Cocoa; 26 import dwt.internal.objc.cocoa.Cocoa;
27 import objc = dwt.internal.objc.runtime; 27 import objc = dwt.internal.objc.runtime;
28 28
29 enum NSEventType
30 {
31 NSLeftMouseDown = 1,
32 NSLeftMouseUp = 2,
33 NSRightMouseDown = 3,
34 NSRightMouseUp = 4,
35 NSMouseMoved = 5,
36 NSLeftMouseDragged = 6,
37 NSRightMouseDragged = 7,
38 NSMouseEntered = 8,
39 NSMouseExited = 9,
40 NSKeyDown = 10,
41 NSKeyUp = 11,
42 NSFlagsChanged = 12,
43 NSAppKitDefined = 13,
44 NSSystemDefined = 14,
45 NSApplicationDefined = 15,
46 NSPeriodic = 16,
47 NSCursorUpdate = 17,
48 NSScrollWheel = 22,
49 NSTabletPoint = 23,
50 NSTabletProximity = 24,
51 NSOtherMouseDown = 25,
52 NSOtherMouseUp = 26,
53 NSOtherMouseDragged = 27
54 }
55
56 public class NSEvent : NSObject { 29 public class NSEvent : NSObject {
57 30
58 public this() { 31 public this() {
59 super(); 32 super();
60 } 33 }
66 public this(cocoa.id id) { 39 public this(cocoa.id id) {
67 super(id); 40 super(id);
68 } 41 }
69 42
70 public NSInteger buttonNumber() { 43 public NSInteger buttonNumber() {
71 return OS.objc_msgSend(this.id, OS.sel_buttonNumber); 44 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_buttonNumber);
72 } 45 }
73 46
74 public NSString characters() { 47 public NSString characters() {
75 objc.id result = OS.objc_msgSend(this.id, OS.sel_characters); 48 objc.id result = OS.objc_msgSend(this.id, OS.sel_characters);
76 return result !is null ? new NSString(result) : null; 49 return result !is null ? new NSString(result) : null;
97 return cast(ushort) OS.objc_msgSend(this.id, OS.sel_keyCode); 70 return cast(ushort) OS.objc_msgSend(this.id, OS.sel_keyCode);
98 } 71 }
99 72
100 public NSPoint locationInWindow() { 73 public NSPoint locationInWindow() {
101 NSPoint result = NSPoint(); 74 NSPoint result = NSPoint();
102 OS.objc_msgSend_stret(result, this.id, OS.sel_locationInWindow); 75 OS.objc_msgSend_stret(&result, this.id, OS.sel_locationInWindow);
103 return result; 76 return result;
104 } 77 }
105 78
106 public NSUInteger modifierFlags() { 79 public NSUInteger modifierFlags() {
107 return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_modifierFlags); 80 return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_modifierFlags);
108 } 81 }
109 82
110 public static NSPoint mouseLocation() { 83 public static NSPoint mouseLocation() {
111 NSPoint result = NSPoint(); 84 NSPoint result = NSPoint();
112 OS.objc_msgSend_stret(result, OS.class_NSEvent, OS.sel_mouseLocation); 85 OS.objc_msgSend_stret(&result, OS.class_NSEvent, OS.sel_mouseLocation);
113 return result; 86 return result;
114 } 87 }
115 88
116 public static NSEvent otherEventWithType(NSEventType type, NSPoint location, NSUInteger flags, double time, NSTimeInterval wNum, NSGraphicsContext context, short subtype, NSInteger d1, NSInteger d2) { 89 public static NSEvent otherEventWithType(NSEventType type, NSPoint location, NSUInteger flags, double time, NSTimeInterval wNum, NSGraphicsContext context, short subtype, NSInteger d1, NSInteger d2) {
117 objc.id result = OS.objc_msgSend(OS.class_NSEvent, OS.sel_otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2_, type, location, flags, time, wNum, context !is null ? context.id : null, subtype, d1, d2); 90 objc.id result = OS.objc_msgSend(OS.class_NSEvent, OS.sel_otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2_, type, location, flags, time, wNum, context !is null ? context.id : null, subtype, d1, d2);
118 return result !is null ? new NSEvent(result) : null; 91 return result !is null ? new NSEvent(result) : null;
119 } 92 }
120 93
121 public NSEventType type() { 94 public NSEventType type() {
122 return OS.objc_msgSend(this.id, OS.sel_type); 95 return cast(NSEventType) OS.objc_msgSend(this.id, OS.sel_type);
123 } 96 }
124 97
125 public NSWindow window() { 98 public NSWindow window() {
126 objc.id result = OS.objc_msgSend(this.id, OS.sel_window); 99 objc.id result = OS.objc_msgSend(this.id, OS.sel_window);
127 return result !is null ? new NSWindow(result) : null; 100 return result !is null ? new NSWindow(result) : null;