view dstep/foundation/NSDistantObject.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.NSDistantObject;

import dstep.foundation.NSCoder;
import dstep.foundation.NSConnection;
import dstep.foundation.NSObject;
import dstep.foundation.NSProxy;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;
import dstep.objc.runtime;

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

	static NSDistantObject proxyWithTarget (Object target, NSConnection connection)
	{
		return invokeObjcSuperClass!(NSDistantObject, "proxyWithTarget:connection:", Object, NSConnection)(target, connection);
	}

	Object initWithTarget (Object target, NSConnection connection)
	{
		return invokeObjcSelf!(Object, "initWithTarget:connection:", Object, NSConnection)(target, connection);
	}

	this (Object target, NSConnection connection)
	{
		typeof(this).alloc.initWithTarget(target, connection);
	}

	static NSDistantObject proxyWithLocal (Object target, NSConnection connection)
	{
		return invokeObjcSuperClass!(NSDistantObject, "proxyWithLocal:connection:", Object, NSConnection)(target, connection);
	}

	Object initWithLocal (Object target, NSConnection connection)
	{
		return invokeObjcSelf!(Object, "initWithLocal:connection:", Object, NSConnection)(target, connection);
	}
	
	void setProtocolForProxy (Protocol proto)
	{
		return invokeObjcSelf!(void, "setProtocolForProxy:", Protocol)(proto);
	}

	NSConnection connectionForProxy ()
	{
		return invokeObjcSelf!(NSConnection, "connectionForProxy");
	}

	void encodeWithCoder (NSCoder aCoder)
	{
		return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder);
	}

	Object initWithCoder (NSCoder aDecoder)
	{
		return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder);
	}

	this (NSCoder aDecoder)
	{
		typeof(this).alloc.initWithCoder(aDecoder);		
	}
}