Mercurial > projects > dstep
diff dstep/coreservices/ae/AppleEvents.d @ 11:07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sat, 01 Aug 2009 15:03:28 +0200 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/coreservices/ae/AppleEvents.d Sat Aug 01 15:03:28 2009 +0200 @@ -0,0 +1,163 @@ +/** + * Copyright: Copyright (c) 2009 Jacob Carlborg. + * Authors: Jacob Carlborg + * Version: Initial created: Jul 21, 2009 + * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) + */ +module dstep.coreservices.ae.AppleEvents; + +//import dstep.AvailabilityMacros; +import dstep.coreservices.ae.AEDataModel; +import dstep.coreservices.carboncore.CarbonCore; +import dstep.corefoundation.CoreFoundation; +import dstep.objc.bridge.TypeEncoding; + +struct AERemoteProcessResolver; + +alias byte AEEventSource; +alias AERemoteProcessResolver* AERemoteProcessResolverRef; + +extern (C) +{ + alias void function (AERemoteProcessResolverRef, void*) AERemoteProcessResolverCallback; +} + +extern (C) +{ + extern + { + const CFStringRef kAERemoteProcessURLKey; + const CFStringRef kAERemoteProcessNameKey; + const CFStringRef kAERemoteProcessUserIDKey; + const CFStringRef kAERemoteProcessProcessIDKey; + } +} + +// This is needed otherwise the enums will fail compiling with gdc +version (GNU) +{ + private + { + const __keyDirectObject = getOSType!("----"); + const __keyErrorNumber = getOSType!("errn"); + const __keyErrorString = getOSType!("errs"); + const __keyProcessSerialNumber = getOSType!("psn "); + const __keyPreDispatch = getOSType!("phac"); + const __keySelectProc = getOSType!("selh"); + const __keyAERecorderCount = getOSType!("recr"); + const __keyAEVersion = getOSType!("vers"); + + } +} + +// This is needed otherwise the enums will fail compiling with gdc +version (GNU) +{ + private + { + const __kCoreEventClass = getOSType!("aevt"); + + } +} + +// This is needed otherwise the enums will fail compiling with gdc +version (GNU) +{ + private + { + const __kAEOpenApplication = getOSType!("oapp"); + const __kAEOpenDocuments = getOSType!("odoc"); + const __kAEPrintDocuments = getOSType!("pdoc"); + const __kAEOpenContents = getOSType!("ocon"); + const __kAEQuitApplication = getOSType!("quit"); + const __kAEAnswer = getOSType!("ansr"); + const __kAEApplicationDied = getOSType!("obit"); + const __kAEShowPreferences = getOSType!("pref"); + + } +} + +// This is needed otherwise the enums will fail compiling with gdc +version (GNU) +{ + private + { + const __kAEStartRecording = getOSType!("reca"); + const __kAEStopRecording = getOSType!("recc"); + const __kAENotifyStartRecording = getOSType!("rec1"); + const __kAENotifyStopRecording = getOSType!("rec0"); + const __kAENotifyRecording = getOSType!("recr"); + + } +} + +enum +{ + keyDirectObject = getOSType!("----"), + keyErrorNumber = getOSType!("errn"), + keyErrorString = getOSType!("errs"), + keyProcessSerialNumber = getOSType!("psn "), + keyPreDispatch = getOSType!("phac"), + keySelectProc = getOSType!("selh"), + keyAERecorderCount = getOSType!("recr"), + keyAEVersion = getOSType!("vers") +} + +enum +{ + kCoreEventClass = getOSType!("aevt") +} + +enum +{ + kAEOpenApplication = getOSType!("oapp"), + kAEOpenDocuments = getOSType!("odoc"), + kAEPrintDocuments = getOSType!("pdoc"), + kAEOpenContents = getOSType!("ocon"), + kAEQuitApplication = getOSType!("quit"), + kAEAnswer = getOSType!("ansr"), + kAEApplicationDied = getOSType!("obit"), + kAEShowPreferences = getOSType!("pref") +} + +enum +{ + kAEStartRecording = getOSType!("reca"), + kAEStopRecording = getOSType!("recc"), + kAENotifyStartRecording = getOSType!("rec1"), + kAENotifyStopRecording = getOSType!("rec0"), + kAENotifyRecording = getOSType!("recr") +} + +enum +{ + kAEUnknownSource = 0, + kAEDirectCall = 1, + kAESameProcess = 2, + kAELocalProcess = 3, + kAERemoteProcess = 4 +} + +struct AERemoteProcessResolverContext +{ + int version_; + void* info; + CFAllocatorRetainCallBack retain; + CFAllocatorReleaseCallBack release; + CFAllocatorCopyDescriptionCallBack copyDescription; +} + +extern (C) +{ + short AEInstallEventHandler (uint theAEEventClass, uint theAEEventID, AEEventHandlerUPP handler, int handlerRefcon, ubyte isSysHandler); + short AERemoveEventHandler (uint theAEEventClass, uint theAEEventID, AEEventHandlerUPP handler, ubyte isSysHandler); + short AEGetEventHandler (uint theAEEventClass, uint theAEEventID, AEEventHandlerUPP* handler, SRefCon* handlerRefcon, ubyte isSysHandler); + short AEInstallSpecialHandler (uint functionClass, AEEventHandlerUPP handler, ubyte isSysHandler); + short AERemoveSpecialHandler (uint functionClass, AEEventHandlerUPP handler, ubyte isSysHandler); + short AEGetSpecialHandler (uint functionClass, AEEventHandlerUPP* handler, ubyte isSysHandler); + short AEManagerInfo (uint keyWord, long* result); + AERemoteProcessResolverRef AECreateRemoteProcessResolver (CFAllocatorRef allocator, CFURLRef url); + void AEDisposeRemoteProcessResolver (AERemoteProcessResolverRef ref_); + CFArrayRef AERemoteProcessResolverGetProcesses (AERemoteProcessResolverRef ref_, CFStreamError* outError); + void AERemoteProcessResolverScheduleWithRunLoop (AERemoteProcessResolverRef ref_, CFRunLoopRef runLoop, CFStringRef runLoopMode, AERemoteProcessResolverCallback callback, AERemoteProcessResolverContext* ctx); +} \ No newline at end of file