view dstep/appkit/NSTokenFieldCell.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.appkit.NSTokenFieldCell;

import dstep.appkit.NSTextContainer;
import dstep.appkit.NSTextFieldCell;
import dstep.foundation.Foundation;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;

alias NSUInteger NSTokenStyle;

enum
{
	NSDefaultTokenStyle,
	NSPlainTextTokenStyle,
	NSRoundedTokenStyle
}

class NSTokenFieldCell : NSTextFieldCell
{
	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");
	}

	void setDelegate (Object anObject)
	{
		return invokeObjcSelf!(void, "setDelegate:", Object)(anObject);
	}

	Object delegate_ ()
	{
		return invokeObjcSelf!(Object, "delegate");
	}
}

const TNSTokenFieldCellDelegate = `

	NSArray tokenFieldCell (NSTokenFieldCell tokenFieldCell, NSString substring, NSInteger tokenIndex, NSInteger* selectedIndex)
	{
		return invokeObjcSelf!(NSArray, "tokenFieldCell:completionsForSubstring:indexOfToken:indexOfSelectedItem:", NSTokenFieldCell, NSString, NSInteger, NSInteger*)(tokenFieldCell, substring, tokenIndex, selectedIndex);
	}

	NSArray tokenFieldCell (NSTokenFieldCell tokenFieldCell, NSArray tokens, NSUInteger index)
	{
		return invokeObjcSelf!(NSArray, "tokenFieldCell:shouldAddObjects:atIndex:", NSTokenFieldCell, NSArray, NSUInteger)(tokenFieldCell, tokens, index);
	}

	NSString tokenFieldCell (NSTokenFieldCell tokenFieldCell, Object representedObject)
	{
		return invokeObjcSelf!(NSString, "tokenFieldCell:displayStringForRepresentedObject:", NSTokenFieldCell, Object)(tokenFieldCell, representedObject);
	}

	NSString tokenFieldCell (NSTokenFieldCell tokenFieldCell, Object representedObject)
	{
		return invokeObjcSelf!(NSString, "tokenFieldCell:editingStringForRepresentedObject:", NSTokenFieldCell, Object)(tokenFieldCell, representedObject);
	}

	Object tokenFieldCell (NSTokenFieldCell tokenFieldCell, NSString editingString)
	{
		return invokeObjcSelf!(Object, "tokenFieldCell:representedObjectForEditingString:", NSTokenFieldCell, NSString)(tokenFieldCell, editingString);
	}

	bool tokenFieldCell (NSTokenFieldCell tokenFieldCell, NSArray objects, NSPasteboard pboard)
	{
		return invokeObjcSelf!(bool, "tokenFieldCell:writeRepresentedObjects:toPasteboard:", NSTokenFieldCell, NSArray, NSPasteboard)(tokenFieldCell, objects, pboard);
	}

	NSArray tokenFieldCell (NSTokenFieldCell tokenFieldCell, NSPasteboard pboard)
	{
		return invokeObjcSelf!(NSArray, "tokenFieldCell:readFromPasteboard:", NSTokenFieldCell, NSPasteboard)(tokenFieldCell, pboard);
	}

	NSMenu tokenFieldCell (NSTokenFieldCell tokenFieldCell, Object representedObject)
	{
		return invokeObjcSelf!(NSMenu, "tokenFieldCell:menuForRepresentedObject:", NSTokenFieldCell, Object)(tokenFieldCell, representedObject);
	}

	bool tokenFieldCell (NSTokenFieldCell tokenFieldCell, Object representedObject)
	{
		return invokeObjcSelf!(bool, "tokenFieldCell:hasMenuForRepresentedObject:", NSTokenFieldCell, Object)(tokenFieldCell, representedObject);
	}

	uint tokenFieldCell (NSTokenFieldCell tokenFieldCell, Object representedObject)
	{
		return invokeObjcSelf!(uint, "tokenFieldCell:styleForRepresentedObject:", NSTokenFieldCell, Object)(tokenFieldCell, representedObject);
	}

	//mixin ObjcBindMethod!(tokenFieldCell, "tokenFieldCell:completionsForSubstring:indexOfToken:indexOfSelectedItem:");
	//mixin ObjcBindMethod!(tokenFieldCell, "tokenFieldCell:shouldAddObjects:atIndex:");
	//mixin ObjcBindMethod!(tokenFieldCell, "tokenFieldCell:displayStringForRepresentedObject:");
	//mixin ObjcBindMethod!(tokenFieldCell, "tokenFieldCell:editingStringForRepresentedObject:");
	//mixin ObjcBindMethod!(tokenFieldCell, "tokenFieldCell:representedObjectForEditingString:");
	//mixin ObjcBindMethod!(tokenFieldCell, "tokenFieldCell:writeRepresentedObjects:toPasteboard:");
	//mixin ObjcBindMethod!(tokenFieldCell, "tokenFieldCell:readFromPasteboard:");
	//mixin ObjcBindMethod!(tokenFieldCell, "tokenFieldCell:menuForRepresentedObject:");
	//mixin ObjcBindMethod!(tokenFieldCell, "tokenFieldCell:hasMenuForRepresentedObject:");
	//mixin ObjcBindMethod!(tokenFieldCell, "tokenFieldCell:styleForRepresentedObject:");

`;