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

import dstep.foundation.NSClassDescription;
import dstep.foundation.NSDictionary;
import dstep.foundation.NSScriptCommandDescription;
import dstep.foundation.NSString;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;

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

	static NSScriptClassDescription classDescriptionForClass (Class aClass)
	{
		return invokeObjcSuperClass!(NSScriptClassDescription, "classDescriptionForClass:", Class)(aClass);
	}

	Object initWithSuiteName (NSString suiteName, NSString className, NSDictionary classDeclaration)
	{
		return invokeObjcSelf!(Object, "initWithSuiteName:className:dictionary:", NSString, NSString, NSDictionary)(suiteName, className, classDeclaration);
	}

	this (NSString suiteName, NSString className, NSDictionary classDeclaration)
	{
		typeof(this).alloc.initWithSuiteName(suiteName, className, classDeclaration);
	}

	NSString suiteName ()
	{
		return invokeObjcSelf!(NSString, "suiteName");
	}

	NSString className ()
	{
		return invokeObjcSelf!(NSString, "className");
	}

	NSString implementationClassName ()
	{
		return invokeObjcSelf!(NSString, "implementationClassName");
	}

	NSScriptClassDescription superclassDescription ()
	{
		id result = invokeObjcSelf!(id, "superclassDescription");
		return result is this.objcObject ? this : (result !is null ? new NSScriptClassDescription(result) : null);
	}

	uint appleEventCode ()
	{
		return invokeObjcSelf!(uint, "appleEventCode");
	}

	bool matchesAppleEventCode (uint appleEventCode)
	{
		return invokeObjcSelf!(bool, "matchesAppleEventCode:", uint)(appleEventCode);
	}

	bool supportsCommand (NSScriptCommandDescription commandDescription)
	{
		return invokeObjcSelf!(bool, "supportsCommand:", NSScriptCommandDescription)(commandDescription);
	}

	SEL selectorForCommand (NSScriptCommandDescription commandDescription)
	{
		return invokeObjcSelf!(SEL, "selectorForCommand:", NSScriptCommandDescription)(commandDescription);
	}

	NSString typeForKey (NSString key)
	{
		return invokeObjcSelf!(NSString, "typeForKey:", NSString)(key);
	}

	NSScriptClassDescription classDescriptionForKey (NSString key)
	{
		id result = invokeObjcSelf!(id, "classDescriptionForKey:", NSString)(key);
		return result is this.objcObject ? this : (result !is null ? new NSScriptClassDescription(result) : null);
	}

	uint appleEventCodeForKey (NSString key)
	{
		return invokeObjcSelf!(uint, "appleEventCodeForKey:", NSString)(key);
	}

	NSString keyWithAppleEventCode (uint appleEventCode)
	{
		return invokeObjcSelf!(NSString, "keyWithAppleEventCode:", uint)(appleEventCode);
	}

	NSString defaultSubcontainerAttributeKey ()
	{
		return invokeObjcSelf!(NSString, "defaultSubcontainerAttributeKey");
	}

	bool isLocationRequiredToCreateForKey (NSString toManyRelationshipKey)
	{
		return invokeObjcSelf!(bool, "isLocationRequiredToCreateForKey:", NSString)(toManyRelationshipKey);
	}

	bool hasPropertyForKey (NSString key)
	{
		return invokeObjcSelf!(bool, "hasPropertyForKey:", NSString)(key);
	}

	bool hasOrderedToManyRelationshipForKey (NSString key)
	{
		return invokeObjcSelf!(bool, "hasOrderedToManyRelationshipForKey:", NSString)(key);
	}

	bool hasReadablePropertyForKey (NSString key)
	{
		return invokeObjcSelf!(bool, "hasReadablePropertyForKey:", NSString)(key);
	}

	bool hasWritablePropertyForKey (NSString key)
	{
		return invokeObjcSelf!(bool, "hasWritablePropertyForKey:", NSString)(key);
	}
}

const TNSScriptClassDescription = `

	uint classCode ()
	{
		return invokeObjcSelf!(uint, "classCode");
	}
	
	NSString className ()
	{
		return invokeObjcSelf!(NSString, "className");
	}
	
	//mixin ObjcBindMethod!(classCode, "classCode");
	//mixin ObjcBindMethod!(className, "className");
`;