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

import dstep.foundation.NSCoder;
import dstep.foundation.NSDictionary;
import dstep.foundation.NSGeometry;
import dstep.foundation.NSObjCRuntime;
import dstep.foundation.NSObject;
import dstep.foundation.NSZone;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;

alias NSUInteger NSTrackingAreaOptions;

enum
{
	NSTrackingMouseEnteredAndExited = 0x01,
	NSTrackingMouseMoved = 0x02,
	NSTrackingCursorUpdate = 0x04
}

enum
{
	NSTrackingActiveWhenFirstResponder = 0x10,
	NSTrackingActiveInKeyWindow = 0x20,
	NSTrackingActiveInActiveApp = 0x40,
	NSTrackingActiveAlways = 0x80
}

enum
{
	NSTrackingAssumeInside = 0x100,
	NSTrackingInVisibleRect = 0x200,
	NSTrackingEnabledDuringMouseDrag = 0x400
}

class NSTrackingArea : NSObject, INSCopying, 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);
	}
	
	typeof(this) copyWithZone (NSZone* zone)
	{
		return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone);
	}

	NSTrackingArea initWithRect (NSRect rect, uint options, Object owner, NSDictionary userInfo)
	{
		id result = invokeObjcSelf!(id, "initWithRect:options:owner:userInfo:", NSRect, uint, Object, NSDictionary)(rect, options, owner, userInfo);
		return result is this.objcObject ? this : (result !is null ? new NSTrackingArea(result) : null);
	}

	this (NSRect rect, uint options, Object owner, NSDictionary userInfo)
	{
		super(NSTrackingArea.alloc.initWithRect(rect, options, owner, userInfo).objcObject);
	}

	NSRect rect ()
	{
		return invokeObjcSelf!(NSRect, "rect");
	}

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

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

	NSDictionary userInfo ()
	{
		return invokeObjcSelf!(NSDictionary, "userInfo");
	}

}