diff dstep/appkit/NSTokenField.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/NSTokenField.d	Sun Jan 03 22:06:11 2010 +0100
@@ -0,0 +1,125 @@
+/**
+ * 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.NSTokenField;
+
+import dstep.appkit.NSTextContainer;
+import dstep.appkit.NSTextField;
+import dstep.appkit.NSTokenFieldCell;
+import dstep.foundation.Foundation;
+import dstep.objc.bridge.Bridge;
+import dstep.objc.objc;
+
+class NSTokenField : NSTextField
+{
+	mixin (ObjcWrap);
+
+	void setTokenStyle (uint style)
+	{
+		return invokeObjcSelf!(void, "setTokenStyle:", uint)(style);
+	}
+
+	uint tokenStyle ()
+	{
+		return invokeObjcSelf!(uint, "tokenStyle");
+	}
+
+	void setCompletionDelay (double delay)
+	{
+		return invokeObjcSelf!(void, "setCompletionDelay:", double)(delay);
+	}
+
+	double completionDelay ()
+	{
+		return invokeObjcSelf!(double, "completionDelay");
+	}
+
+	static double defaultCompletionDelay ()
+	{
+		return invokeObjcSelfClass!(double, "defaultCompletionDelay");
+	}
+
+	void setTokenizingCharacterSet (NSCharacterSet characterSet)
+	{
+		return invokeObjcSelf!(void, "setTokenizingCharacterSet:", NSCharacterSet)(characterSet);
+	}
+
+	NSCharacterSet tokenizingCharacterSet ()
+	{
+		return invokeObjcSelf!(NSCharacterSet, "tokenizingCharacterSet");
+	}
+
+	static NSCharacterSet defaultTokenizingCharacterSet ()
+	{
+		return invokeObjcSelfClass!(NSCharacterSet, "defaultTokenizingCharacterSet");
+	}
+}
+
+const TNSTokenFieldDelegate = `
+
+	NSArray tokenField (NSTokenField tokenField, NSString substring, NSInteger tokenIndex, NSInteger* selectedIndex)
+	{
+		return invokeObjcSelf!(NSArray, "tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem:", NSTokenField, NSString, NSInteger, NSInteger*)(tokenField, substring, tokenIndex, selectedIndex);
+	}
+
+	NSArray tokenField (NSTokenField tokenField, NSArray tokens, NSUInteger index)
+	{
+		return invokeObjcSelf!(NSArray, "tokenField:shouldAddObjects:atIndex:", NSTokenField, NSArray, NSUInteger)(tokenField, tokens, index);
+	}
+
+	NSString tokenField (NSTokenField tokenField, Object representedObject)
+	{
+		return invokeObjcSelf!(NSString, "tokenField:displayStringForRepresentedObject:", NSTokenField, Object)(tokenField, representedObject);
+	}
+
+	NSString tokenField (NSTokenField tokenField, Object representedObject)
+	{
+		return invokeObjcSelf!(NSString, "tokenField:editingStringForRepresentedObject:", NSTokenField, Object)(tokenField, representedObject);
+	}
+
+	Object tokenField (NSTokenField tokenField, NSString editingString)
+	{
+		return invokeObjcSelf!(Object, "tokenField:representedObjectForEditingString:", NSTokenField, NSString)(tokenField, editingString);
+	}
+
+	bool tokenField (NSTokenField tokenField, NSArray objects, NSPasteboard pboard)
+	{
+		return invokeObjcSelf!(bool, "tokenField:writeRepresentedObjects:toPasteboard:", NSTokenField, NSArray, NSPasteboard)(tokenField, objects, pboard);
+	}
+
+	NSArray tokenField (NSTokenField tokenField, NSPasteboard pboard)
+	{
+		return invokeObjcSelf!(NSArray, "tokenField:readFromPasteboard:", NSTokenField, NSPasteboard)(tokenField, pboard);
+	}
+
+	NSMenu tokenField (NSTokenField tokenField, Object representedObject)
+	{
+		return invokeObjcSelf!(NSMenu, "tokenField:menuForRepresentedObject:", NSTokenField, Object)(tokenField, representedObject);
+	}
+
+	bool tokenField (NSTokenField tokenField, Object representedObject)
+	{
+		return invokeObjcSelf!(bool, "tokenField:hasMenuForRepresentedObject:", NSTokenField, Object)(tokenField, representedObject);
+	}
+
+	uint tokenField (NSTokenField tokenField, Object representedObject)
+	{
+		return invokeObjcSelf!(uint, "tokenField:styleForRepresentedObject:", NSTokenField, Object)(tokenField, representedObject);
+	}
+
+	//mixin ObjcBindMethod!(tokenField, "tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem:");
+	//mixin ObjcBindMethod!(tokenField, "tokenField:shouldAddObjects:atIndex:");
+	//mixin ObjcBindMethod!(tokenField, "tokenField:displayStringForRepresentedObject:");
+	//mixin ObjcBindMethod!(tokenField, "tokenField:editingStringForRepresentedObject:");
+	//mixin ObjcBindMethod!(tokenField, "tokenField:representedObjectForEditingString:");
+	//mixin ObjcBindMethod!(tokenField, "tokenField:writeRepresentedObjects:toPasteboard:");
+	//mixin ObjcBindMethod!(tokenField, "tokenField:readFromPasteboard:");
+	//mixin ObjcBindMethod!(tokenField, "tokenField:menuForRepresentedObject:");
+	//mixin ObjcBindMethod!(tokenField, "tokenField:hasMenuForRepresentedObject:");
+	//mixin ObjcBindMethod!(tokenField, "tokenField:styleForRepresentedObject:");
+
+`;
+