view 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
line wrap: on
line source

/**
 * 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.coreservices.ae.AEDataModel;
import dstep.foundation.NSAppleEventDescriptor;
import dstep.foundation.NSObject;
import dstep.foundation.NSString;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;



import bindings = dstep.foundation.NSAppleEventManager_bindings;

struct __NSAppleEventManagerSuspension;

alias __NSAppleEventManagerSuspension* NSAppleEventManagerSuspensionID;

extern (C)
{
	extern
	{
		double NSAppleEventTimeOutDefault;
		double NSAppleEventTimeOutNone;
	}
}

private NSString NSAppleEventManagerWillProcessFirstEventNotification_;

NSString NSAppleEventManagerWillProcessFirstEventNotification ()
{
	if (NSAppleEventManagerWillProcessFirstEventNotification_)
		return NSAppleEventManagerWillProcessFirstEventNotification_;
	
	return NSAppleEventManagerWillProcessFirstEventNotification_ = new NSString(bindings.NSAppleEventManagerWillProcessFirstEventNotification);
}

class NSAppleEventManager : NSObject
{
	mixin (ObjcWrap);
	
	this ()
	{
		super(typeof(this).alloc.init.objcObject);
	}
	
	typeof(this) init ()
	{
		return invokeObjcSelf!(typeof(this), "init");
	}

	static NSAppleEventManager sharedAppleEventManager ()
	{
		return invokeObjcSuperClass!(NSAppleEventManager, "sharedAppleEventManager");
	}

	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);
	}
}