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

import dstep.appkit.NSColor;
import dstep.appkit.NSTabView;
import dstep.appkit.NSView;
import dstep.foundation.NSCoder;
import dstep.foundation.NSGeometry;
import dstep.foundation.NSObjCRuntime;
import dstep.foundation.NSObject;
import dstep.foundation.NSString;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;

typedef NSUInteger NSTabState;

enum : NSUInteger
{
	NSSelectedTab = 0,
	NSBackgroundTab = 1,
	NSPressedTab = 2
}

class NSTabViewItem : 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);
	}

	NSTabViewItem initWithIdentifier (Object identifier)
	{
		id result = invokeObjcSelf!(id, "initWithIdentifier:", Object)(identifier);
		return result is this.objcObject ? this : (result !is null ? new NSTabViewItem(result) : null);
	}

	this (Object identifier)
	{
		super(NSTabViewItem.alloc.initWithIdentifier(identifier).objcObject);
	}

	Object identifier ()
	{
		return invokeObjcSelf!(Object, "identifier");
	}

	Object view ()
	{
		return invokeObjcSelf!(Object, "view");
	}

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

	this ()
	{
		super(NSTabViewItem.alloc.initialFirstResponder.objcObject);
	}

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

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

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

	NSTabView tabView ()
	{
		return invokeObjcSelf!(NSTabView, "tabView");
	}

	void setIdentifier (Object identifier)
	{
		return invokeObjcSelf!(void, "setIdentifier:", Object)(identifier);
	}

	void setLabel (NSString label)
	{
		return invokeObjcSelf!(void, "setLabel:", NSString)(label);
	}

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

	void setView (NSView view)
	{
		return invokeObjcSelf!(void, "setView:", NSView)(view);
	}

	void setInitialFirstResponder (NSView view)
	{
		return invokeObjcSelf!(void, "setInitialFirstResponder:", NSView)(view);
	}

	void drawLabel (bool shouldTruncateLabel, NSRect labelRect)
	{
		return invokeObjcSelf!(void, "drawLabel:inRect:", bool, NSRect)(shouldTruncateLabel, labelRect);
	}

	NSSize sizeOfLabel (bool computeMin)
	{
		return invokeObjcSelf!(NSSize, "sizeOfLabel:", bool)(computeMin);
	}

}