Mercurial > projects > dstep
diff dstep/foundation/NSAppleEventManager.d @ 14:89f3c3ef1fd2
Added the Foundation framework
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 03 Aug 2009 15:23:15 +0200 |
parents | |
children | 7ff919f595d5 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSAppleEventManager.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,93 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Aug 3, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.foundation.NSAppleEventManager; + +import dstep.applicationservices.ApplicationServices; +import dstep.foundation.NSAppleEventDescriptor; +import dstep.foundation.NSObject; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSAppleEventManager_bindings; + +alias __NSAppleEventManagerSuspension* NSAppleEventManagerSuspensionID; + +extern (C) +{ + extern + { + const double NSAppleEventTimeOutDefault; + const double NSAppleEventTimeOutNone; + } +} + +NSString NSAppleEventManagerWillProcessFirstEventNotification; + +static this () +{ + NSAppleEventManagerWillProcessFirstEventNotification = new NSString(bindings.NSAppleEventManagerWillProcessFirstEventNotification); +} + +class NSAppleEventManager : NSObject +{ + mixin ObjcWrap; + + static NSAppleEventManager sharedAppleEventManager () + { + return invokeObjcSelfClass!(NSAppleEventManager, "sharedAppleEventManager"return result is this.objcObject ? this : (result !is null ? new NSAppleEventManager(result) : null); } + + void setEventHandler (Object handler, SEL handleEventSelector, uint eventClass, uint eventID) + { + return invokeObjcSelf!(void, "setEventHandler:andSelector:forEventClass:andEventID:", Object, SEL, uint, uint)(handler, handleEventSelector, eventClass, eventID); + } + + void removeEventHandlerForEventClass (uint eventClass, uint eventID) + { + return invokeObjcSelf!(void, "removeEventHandlerForEventClass:andEventID:", uint, uint)(eventClass, eventID); + } + + short dispatchRawAppleEvent (AppleEvent* theAppleEvent, AppleEvent* theReply, int handlerRefCon) + { + return invokeObjcSelf!(short, "dispatchRawAppleEvent:withRawReply:handlerRefCon:", AppleEvent*, AppleEvent*, int)(theAppleEvent, theReply, handlerRefCon); + } + + NSAppleEventDescriptor currentAppleEvent () + { + return invokeObjcSelf!(NSAppleEventDescriptor, "currentAppleEvent"); + } + + NSAppleEventDescriptor currentReplyAppleEvent () + { + return invokeObjcSelf!(NSAppleEventDescriptor, "currentReplyAppleEvent"); + } + + NSAppleEventManagerSuspensionID suspendCurrentAppleEvent () + { + return invokeObjcSelf!(NSAppleEventManagerSuspensionID, "suspendCurrentAppleEvent"); + } + + NSAppleEventDescriptor appleEventForSuspensionID (NSAppleEventManagerSuspensionID suspensionID) + { + return invokeObjcSelf!(NSAppleEventDescriptor, "appleEventForSuspensionID:", NSAppleEventManagerSuspensionID)(suspensionID); + } + + NSAppleEventDescriptor replyAppleEventForSuspensionID (NSAppleEventManagerSuspensionID suspensionID) + { + return invokeObjcSelf!(NSAppleEventDescriptor, "replyAppleEventForSuspensionID:", NSAppleEventManagerSuspensionID)(suspensionID); + } + + void setCurrentAppleEventAndReplyEventWithSuspensionID (NSAppleEventManagerSuspensionID suspensionID) + { + return invokeObjcSelf!(void, "setCurrentAppleEventAndReplyEventWithSuspensionID:", NSAppleEventManagerSuspensionID)(suspensionID); + } + + void resumeWithSuspensionID (NSAppleEventManagerSuspensionID suspensionID) + { + return invokeObjcSelf!(void, "resumeWithSuspensionID:", NSAppleEventManagerSuspensionID)(suspensionID); + } +} +