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

import dstep.appkit.NSColor;
import dstep.appkit.NSControl;
import dstep.appkit.NSText;
import dstep.appkit.NSTextFieldCell;
import dstep.appkit.NSUserInterfaceValidation;
import dstep.foundation.NSNotification;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;

const TNSTextFieldAttributedStringMethods = `

	bool allowsEditingTextAttributes ()
	{
		return invokeObjcSelf!(bool, "allowsEditingTextAttributes");
	}

	void setAllowsEditingTextAttributes (bool flag)
	{
		return invokeObjcSelf!(void, "setAllowsEditingTextAttributes:", bool)(flag);
	}

	bool importsGraphics ()
	{
		return invokeObjcSelf!(bool, "importsGraphics");
	}

	void setImportsGraphics (bool flag)
	{
		return invokeObjcSelf!(void, "setImportsGraphics:", bool)(flag);
	}

	//mixin ObjcBindMethod!(allowsEditingTextAttributes, "allowsEditingTextAttributes");
	//mixin ObjcBindMethod!(setAllowsEditingTextAttributes, "setAllowsEditingTextAttributes:");
	//mixin ObjcBindMethod!(importsGraphics, "importsGraphics");
	//mixin ObjcBindMethod!(setImportsGraphics, "setImportsGraphics:");

`;

class NSTextField : NSControl, INSUserInterfaceValidations
{
	mixin (ObjcWrap);

	void setBackgroundColor (NSColor color)
	{
		return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color);
	}

	NSColor backgroundColor ()
	{
		return invokeObjcSelf!(NSColor, "backgroundColor");
	}

	void setDrawsBackground (bool flag)
	{
		return invokeObjcSelf!(void, "setDrawsBackground:", bool)(flag);
	}

	bool drawsBackground ()
	{
		return invokeObjcSelf!(bool, "drawsBackground");
	}

	void setTextColor (NSColor color)
	{
		return invokeObjcSelf!(void, "setTextColor:", NSColor)(color);
	}

	NSColor textColor ()
	{
		return invokeObjcSelf!(NSColor, "textColor");
	}

	bool isBordered ()
	{
		return invokeObjcSelf!(bool, "isBordered");
	}

	void setBordered (bool flag)
	{
		return invokeObjcSelf!(void, "setBordered:", bool)(flag);
	}

	bool isBezeled ()
	{
		return invokeObjcSelf!(bool, "isBezeled");
	}

	void setBezeled (bool flag)
	{
		return invokeObjcSelf!(void, "setBezeled:", bool)(flag);
	}

	bool isEditable ()
	{
		return invokeObjcSelf!(bool, "isEditable");
	}

	void setEditable (bool flag)
	{
		return invokeObjcSelf!(void, "setEditable:", bool)(flag);
	}

	bool isSelectable ()
	{
		return invokeObjcSelf!(bool, "isSelectable");
	}

	void setSelectable (bool flag)
	{
		return invokeObjcSelf!(void, "setSelectable:", bool)(flag);
	}

	void selectText (Object sender)
	{
		return invokeObjcSelf!(void, "selectText:", Object)(sender);
	}

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

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

	bool textShouldBeginEditing (NSText textObject)
	{
		return invokeObjcSelf!(bool, "textShouldBeginEditing:", NSText)(textObject);
	}

	bool textShouldEndEditing (NSText textObject)
	{
		return invokeObjcSelf!(bool, "textShouldEndEditing:", NSText)(textObject);
	}

	void textDidBeginEditing (NSNotification notification)
	{
		return invokeObjcSelf!(void, "textDidBeginEditing:", NSNotification)(notification);
	}

	void textDidEndEditing (NSNotification notification)
	{
		return invokeObjcSelf!(void, "textDidEndEditing:", NSNotification)(notification);
	}

	void textDidChange (NSNotification notification)
	{
		return invokeObjcSelf!(void, "textDidChange:", NSNotification)(notification);
	}

	bool acceptsFirstResponder ()
	{
		return invokeObjcSelf!(bool, "acceptsFirstResponder");
	}

	void setBezelStyle (uint style)
	{
		return invokeObjcSelf!(void, "setBezelStyle:", uint)(style);
	}

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

	bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem)
	{
		return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(anItem);
	}
	
	// NSTextFieldAttributedStringMethods
	bool allowsEditingTextAttributes ()
	{
		return invokeObjcSelf!(bool, "allowsEditingTextAttributes");
	}

	void setAllowsEditingTextAttributes (bool flag)
	{
		return invokeObjcSelf!(void, "setAllowsEditingTextAttributes:", bool)(flag);
	}

	bool importsGraphics ()
	{
		return invokeObjcSelf!(bool, "importsGraphics");
	}

	void setImportsGraphics (bool flag)
	{
		return invokeObjcSelf!(void, "setImportsGraphics:", bool)(flag);
	}
}