14
|
1 /**
|
|
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
|
|
3 * Authors: Jacob Carlborg
|
|
4 * Version: Initial created: Aug 3, 2009
|
|
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
|
|
6 */
|
|
7 module dstep.foundation.NSAppleEventManager;
|
|
8
|
|
9 import dstep.applicationservices.ApplicationServices;
|
|
10 import dstep.foundation.NSAppleEventDescriptor;
|
|
11 import dstep.foundation.NSObject;
|
|
12 import dstep.objc.bridge.Bridge;
|
|
13 import dstep.objc.objc : id;
|
|
14
|
|
15 import bindings = dstep.foundation.NSAppleEventManager_bindings;
|
|
16
|
|
17 alias __NSAppleEventManagerSuspension* NSAppleEventManagerSuspensionID;
|
|
18
|
|
19 extern (C)
|
|
20 {
|
|
21 extern
|
|
22 {
|
|
23 const double NSAppleEventTimeOutDefault;
|
|
24 const double NSAppleEventTimeOutNone;
|
|
25 }
|
|
26 }
|
|
27
|
|
28 NSString NSAppleEventManagerWillProcessFirstEventNotification;
|
|
29
|
|
30 static this ()
|
|
31 {
|
|
32 NSAppleEventManagerWillProcessFirstEventNotification = new NSString(bindings.NSAppleEventManagerWillProcessFirstEventNotification);
|
|
33 }
|
|
34
|
|
35 class NSAppleEventManager : NSObject
|
|
36 {
|
|
37 mixin ObjcWrap;
|
|
38
|
|
39 static NSAppleEventManager sharedAppleEventManager ()
|
|
40 {
|
|
41 return invokeObjcSelfClass!(NSAppleEventManager, "sharedAppleEventManager"return result is this.objcObject ? this : (result !is null ? new NSAppleEventManager(result) : null); }
|
|
42
|
|
43 void setEventHandler (Object handler, SEL handleEventSelector, uint eventClass, uint eventID)
|
|
44 {
|
|
45 return invokeObjcSelf!(void, "setEventHandler:andSelector:forEventClass:andEventID:", Object, SEL, uint, uint)(handler, handleEventSelector, eventClass, eventID);
|
|
46 }
|
|
47
|
|
48 void removeEventHandlerForEventClass (uint eventClass, uint eventID)
|
|
49 {
|
|
50 return invokeObjcSelf!(void, "removeEventHandlerForEventClass:andEventID:", uint, uint)(eventClass, eventID);
|
|
51 }
|
|
52
|
|
53 short dispatchRawAppleEvent (AppleEvent* theAppleEvent, AppleEvent* theReply, int handlerRefCon)
|
|
54 {
|
|
55 return invokeObjcSelf!(short, "dispatchRawAppleEvent:withRawReply:handlerRefCon:", AppleEvent*, AppleEvent*, int)(theAppleEvent, theReply, handlerRefCon);
|
|
56 }
|
|
57
|
|
58 NSAppleEventDescriptor currentAppleEvent ()
|
|
59 {
|
|
60 return invokeObjcSelf!(NSAppleEventDescriptor, "currentAppleEvent");
|
|
61 }
|
|
62
|
|
63 NSAppleEventDescriptor currentReplyAppleEvent ()
|
|
64 {
|
|
65 return invokeObjcSelf!(NSAppleEventDescriptor, "currentReplyAppleEvent");
|
|
66 }
|
|
67
|
|
68 NSAppleEventManagerSuspensionID suspendCurrentAppleEvent ()
|
|
69 {
|
|
70 return invokeObjcSelf!(NSAppleEventManagerSuspensionID, "suspendCurrentAppleEvent");
|
|
71 }
|
|
72
|
|
73 NSAppleEventDescriptor appleEventForSuspensionID (NSAppleEventManagerSuspensionID suspensionID)
|
|
74 {
|
|
75 return invokeObjcSelf!(NSAppleEventDescriptor, "appleEventForSuspensionID:", NSAppleEventManagerSuspensionID)(suspensionID);
|
|
76 }
|
|
77
|
|
78 NSAppleEventDescriptor replyAppleEventForSuspensionID (NSAppleEventManagerSuspensionID suspensionID)
|
|
79 {
|
|
80 return invokeObjcSelf!(NSAppleEventDescriptor, "replyAppleEventForSuspensionID:", NSAppleEventManagerSuspensionID)(suspensionID);
|
|
81 }
|
|
82
|
|
83 void setCurrentAppleEventAndReplyEventWithSuspensionID (NSAppleEventManagerSuspensionID suspensionID)
|
|
84 {
|
|
85 return invokeObjcSelf!(void, "setCurrentAppleEventAndReplyEventWithSuspensionID:", NSAppleEventManagerSuspensionID)(suspensionID);
|
|
86 }
|
|
87
|
|
88 void resumeWithSuspensionID (NSAppleEventManagerSuspensionID suspensionID)
|
|
89 {
|
|
90 return invokeObjcSelf!(void, "resumeWithSuspensionID:", NSAppleEventManagerSuspensionID)(suspensionID);
|
|
91 }
|
|
92 }
|
|
93
|