diff dstep/appkit/NSColorList.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 diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dstep/appkit/NSColorList.d	Sun Jan 03 22:06:11 2010 +0100
@@ -0,0 +1,134 @@
+/**
+ * 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.appkit.NSColorList;
+
+import dstep.appkit.AppKitDefines;
+import dstep.foundation.NSArray;
+import dstep.appkit.NSColor;
+import dstep.corefoundation.CFDictionary;
+import dstep.foundation.NSArray;
+import dstep.foundation.NSBundle;
+import dstep.foundation.NSCoder;
+import dstep.foundation.NSObjCRuntime;
+import dstep.foundation.NSObject;
+import dstep.foundation.NSString;
+import dstep.objc.bridge.Bridge;
+import dstep.objc.objc;
+
+import bindings = dstep.appkit.NSColorList_bindings;
+
+private
+{
+	NSString NSColorListDidChangeNotification_;
+}
+
+NSString NSColorListDidChangeNotification ()
+{
+	if (NSColorListDidChangeNotification_)
+		return NSColorListDidChangeNotification_;
+
+	return NSColorListDidChangeNotification_ = new NSString(bindings.NSColorListDidChangeNotification);
+}
+
+class NSColorList : NSObject, INSCoding
+{
+	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);
+	}
+
+	static NSArray availableColorLists ()
+	{
+		return invokeObjcSelfClass!(NSArray, "availableColorLists");
+	}
+
+	static NSColorList colorListNamed (NSString name)
+	{
+		return invokeObjcSelfClass!(NSColorList, "colorListNamed:", NSString)(name);
+	}
+
+	NSColorList initWithName (NSString name)
+	{
+		id result = invokeObjcSelf!(id, "initWithName:", NSString)(name);
+		return result is this.objcObject ? this : (result !is null ? new NSColorList(result) : null);
+	}
+
+	this (NSString name)
+	{
+		super(NSColorList.alloc.initWithName(name).objcObject);
+	}
+
+	NSColorList initWithName (NSString name, NSString path)
+	{
+		id result = invokeObjcSelf!(id, "initWithName:fromFile:", NSString, NSString)(name, path);
+		return result is this.objcObject ? this : (result !is null ? new NSColorList(result) : null);
+	}
+
+	this (NSString name, NSString path)
+	{
+		super(NSColorList.alloc.initWithName(name, path).objcObject);
+	}
+
+	NSString name ()
+	{
+		return invokeObjcSelf!(NSString, "name");
+	}
+
+	void setColor (NSColor color, NSString key)
+	{
+		return invokeObjcSelf!(void, "setColor:forKey:", NSColor, NSString)(color, key);
+	}
+
+	void insertColor (NSColor color, NSString key, NSUInteger loc)
+	{
+		return invokeObjcSelf!(void, "insertColor:key:atIndex:", NSColor, NSString, NSUInteger)(color, key, loc);
+	}
+
+	void removeColorWithKey (NSString key)
+	{
+		return invokeObjcSelf!(void, "removeColorWithKey:", NSString)(key);
+	}
+
+	NSColor colorWithKey (NSString key)
+	{
+		return invokeObjcSelf!(NSColor, "colorWithKey:", NSString)(key);
+	}
+
+	NSArray allKeys ()
+	{
+		return invokeObjcSelf!(NSArray, "allKeys");
+	}
+
+	bool isEditable ()
+	{
+		return invokeObjcSelf!(bool, "isEditable");
+	}
+
+	bool writeToFile (NSString path)
+	{
+		return invokeObjcSelf!(bool, "writeToFile:", NSString)(path);
+	}
+
+	void removeFile ()
+	{
+		return invokeObjcSelf!(void, "removeFile");
+	}
+
+}
+