view dstep/quartzcore/CIFilterGenerator.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
children b9de51448c6b
line wrap: on
line source

/**
 * Copyright: Copyright (c) 2009 Jacob Carlborg.
 * Authors: Jacob Carlborg
 * Version: Initial created: Sep 24, 2009 
 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
 */
module dstep.quartzcore.CIFilterGenerator;

import dstep.foundation.NSCoder;
import dstep.foundation.NSDictionary;
import dstep.foundation.NSObject;
import dstep.foundation.NSString;
import dstep.foundation.NSURL;
import dstep.foundation.NSZone;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;
import dstep.quartzcore.CIFilter;

import bindings = dstep.quartzcore.CIFilterGenerator_bindings;

private
{
	NSString kCIFilterGeneratorExportedKey_;
	NSString kCIFilterGeneratorExportedKeyTargetObject_;
	NSString kCIFilterGeneratorExportedKeyName_;
}

NSString kCIFilterGeneratorExportedKey ()
{
	if (kCIFilterGeneratorExportedKey_)
		return kCIFilterGeneratorExportedKey_;

	return kCIFilterGeneratorExportedKey_ = new NSString(bindings.kCIFilterGeneratorExportedKey);
}

NSString kCIFilterGeneratorExportedKeyTargetObject ()
{
	if (kCIFilterGeneratorExportedKeyTargetObject_)
		return kCIFilterGeneratorExportedKeyTargetObject_;

	return kCIFilterGeneratorExportedKeyTargetObject_ = new NSString(bindings.kCIFilterGeneratorExportedKeyTargetObject);
}

NSString kCIFilterGeneratorExportedKeyName ()
{
	if (kCIFilterGeneratorExportedKeyName_)
		return kCIFilterGeneratorExportedKeyName_;

	return kCIFilterGeneratorExportedKeyName_ = new NSString(bindings.kCIFilterGeneratorExportedKeyName);
}

class CIFilterGenerator : NSObject, INSCoding, INSCopying
{
	mixin (ObjcWrap);
	
	this (NSCoder aDecoder)
	{
		super(typeof(this).alloc.initWithCoder(aDecoder).objcObject);
	}
	
	void encodeWithCoder (NSCoder aCoder)
	{
		return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder);
	}
	
	typeof(this) initWithCoder (NSCoder aDecoder)
	{
		return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder);
	}
	
	typeof(this) copyWithZone (NSZone* zone)
	{
		return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone);
	}

	static CIFilterGenerator filterGenerator ()
	{
		return invokeObjcSelfClass!(CIFilterGenerator, "filterGenerator");
	}

	static CIFilterGenerator filterGeneratorWithContentsOfURL (NSURL aURL)
	{
		return invokeObjcSelfClass!(CIFilterGenerator, "filterGeneratorWithContentsOfURL:", NSURL)(aURL);
	}

	CIFilterGenerator initWithContentsOfURL (NSURL aURL)
	{
		id result = invokeObjcSelf!(id, "initWithContentsOfURL:", NSURL)(aURL);
		return result is this.objcObject ? this : (result !is null ? new CIFilterGenerator(result) : null);
	}

	this (NSURL aURL)
	{
		super(CIFilterGenerator.alloc.initWithContentsOfURL(aURL).objcObject);
	}

	void connectObject (Object sourceObject, NSString sourceKey, Object targetObject, NSString targetKey)
	{
		return invokeObjcSelf!(void, "connectObject:withKey:toObject:withKey:", Object, NSString, Object, NSString)(sourceObject, sourceKey, targetObject, targetKey);
	}

	void disconnectObject (Object sourceObject, NSString key, Object targetObject, NSString targetKey)
	{
		return invokeObjcSelf!(void, "disconnectObject:withKey:toObject:withKey:", Object, NSString, Object, NSString)(sourceObject, key, targetObject, targetKey);
	}

	void exportKey (NSString key, Object targetObject, NSString exportedKeyName)
	{
		return invokeObjcSelf!(void, "exportKey:fromObject:withName:", NSString, Object, NSString)(key, targetObject, exportedKeyName);
	}

	void removeExportedKey (NSString exportedKeyName)
	{
		return invokeObjcSelf!(void, "removeExportedKey:", NSString)(exportedKeyName);
	}

	NSDictionary exportedKeys ()
	{
		return invokeObjcSelf!(NSDictionary, "exportedKeys");
	}

	void setAttributes (NSDictionary attributes, NSString key)
	{
		return invokeObjcSelf!(void, "setAttributes:forExportedKey:", NSDictionary, NSString)(attributes, key);
	}

	NSDictionary classAttributes ()
	{
		return invokeObjcSelf!(NSDictionary, "classAttributes");
	}

	void setClassAttributes (NSDictionary attributes)
	{
		return invokeObjcSelf!(void, "setClassAttributes:", NSDictionary)(attributes);
	}

	CIFilter filter ()
	{
		return invokeObjcSelf!(CIFilter, "filter");
	}

	void registerFilterName (NSString name)
	{
		return invokeObjcSelf!(void, "registerFilterName:", NSString)(name);
	}

	bool writeToURL (NSURL aURL, bool flag)
	{
		return invokeObjcSelf!(bool, "writeToURL:atomically:", NSURL, bool)(aURL, flag);
	}

}