Mercurial > projects > dstep
annotate dstep/foundation/NSAppleEventManager.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | 7ff919f595d5 |
children | b9de51448c6b |
rev | line source |
---|---|
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 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
9 //import dstep.applicationservices.ApplicationServices; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
10 import dstep.coreservices.ae.AEDataModel; |
14 | 11 import dstep.foundation.NSAppleEventDescriptor; |
12 import dstep.foundation.NSObject; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
13 import dstep.foundation.NSString; |
14 | 14 import dstep.objc.bridge.Bridge; |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
15 import dstep.objc.objc; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
16 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
17 |
14 | 18 |
19 import bindings = dstep.foundation.NSAppleEventManager_bindings; | |
20 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
21 struct __NSAppleEventManagerSuspension; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
22 |
14 | 23 alias __NSAppleEventManagerSuspension* NSAppleEventManagerSuspensionID; |
24 | |
25 extern (C) | |
26 { | |
27 extern | |
28 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
29 double NSAppleEventTimeOutDefault; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
30 double NSAppleEventTimeOutNone; |
14 | 31 } |
32 } | |
33 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
34 private NSString NSAppleEventManagerWillProcessFirstEventNotification_; |
14 | 35 |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
36 NSString NSAppleEventManagerWillProcessFirstEventNotification () |
14 | 37 { |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
38 if (NSAppleEventManagerWillProcessFirstEventNotification_) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
39 return NSAppleEventManagerWillProcessFirstEventNotification_; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
40 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
41 return NSAppleEventManagerWillProcessFirstEventNotification_ = new NSString(bindings.NSAppleEventManagerWillProcessFirstEventNotification); |
14 | 42 } |
43 | |
44 class NSAppleEventManager : NSObject | |
45 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
46 mixin (ObjcWrap); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
47 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
48 this () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
49 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
50 super(typeof(this).alloc.init.objcObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
51 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
52 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
53 typeof(this) init () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
54 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
55 return invokeObjcSelf!(typeof(this), "init"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
56 } |
14 | 57 |
58 static NSAppleEventManager sharedAppleEventManager () | |
59 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
60 return invokeObjcSuperClass!(NSAppleEventManager, "sharedAppleEventManager"); |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
61 } |
14 | 62 |
63 void setEventHandler (Object handler, SEL handleEventSelector, uint eventClass, uint eventID) | |
64 { | |
65 return invokeObjcSelf!(void, "setEventHandler:andSelector:forEventClass:andEventID:", Object, SEL, uint, uint)(handler, handleEventSelector, eventClass, eventID); | |
66 } | |
67 | |
68 void removeEventHandlerForEventClass (uint eventClass, uint eventID) | |
69 { | |
70 return invokeObjcSelf!(void, "removeEventHandlerForEventClass:andEventID:", uint, uint)(eventClass, eventID); | |
71 } | |
72 | |
73 short dispatchRawAppleEvent (AppleEvent* theAppleEvent, AppleEvent* theReply, int handlerRefCon) | |
74 { | |
75 return invokeObjcSelf!(short, "dispatchRawAppleEvent:withRawReply:handlerRefCon:", AppleEvent*, AppleEvent*, int)(theAppleEvent, theReply, handlerRefCon); | |
76 } | |
77 | |
78 NSAppleEventDescriptor currentAppleEvent () | |
79 { | |
80 return invokeObjcSelf!(NSAppleEventDescriptor, "currentAppleEvent"); | |
81 } | |
82 | |
83 NSAppleEventDescriptor currentReplyAppleEvent () | |
84 { | |
85 return invokeObjcSelf!(NSAppleEventDescriptor, "currentReplyAppleEvent"); | |
86 } | |
87 | |
88 NSAppleEventManagerSuspensionID suspendCurrentAppleEvent () | |
89 { | |
90 return invokeObjcSelf!(NSAppleEventManagerSuspensionID, "suspendCurrentAppleEvent"); | |
91 } | |
92 | |
93 NSAppleEventDescriptor appleEventForSuspensionID (NSAppleEventManagerSuspensionID suspensionID) | |
94 { | |
95 return invokeObjcSelf!(NSAppleEventDescriptor, "appleEventForSuspensionID:", NSAppleEventManagerSuspensionID)(suspensionID); | |
96 } | |
97 | |
98 NSAppleEventDescriptor replyAppleEventForSuspensionID (NSAppleEventManagerSuspensionID suspensionID) | |
99 { | |
100 return invokeObjcSelf!(NSAppleEventDescriptor, "replyAppleEventForSuspensionID:", NSAppleEventManagerSuspensionID)(suspensionID); | |
101 } | |
102 | |
103 void setCurrentAppleEventAndReplyEventWithSuspensionID (NSAppleEventManagerSuspensionID suspensionID) | |
104 { | |
105 return invokeObjcSelf!(void, "setCurrentAppleEventAndReplyEventWithSuspensionID:", NSAppleEventManagerSuspensionID)(suspensionID); | |
106 } | |
107 | |
108 void resumeWithSuspensionID (NSAppleEventManagerSuspensionID suspensionID) | |
109 { | |
110 return invokeObjcSelf!(void, "resumeWithSuspensionID:", NSAppleEventManagerSuspensionID)(suspensionID); | |
111 } | |
112 } | |
113 |