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

import dstep.foundation.NSArray;
import dstep.foundation.NSCoder;
import dstep.foundation.NSDictionary;
import dstep.foundation.NSString;
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;

typedef NSUInteger NSPrinterTableStatus;

enum : NSUInteger
{
	NSPrinterTableOK = 0,
	NSPrinterTableNotFound = 1,
	NSPrinterTableError = 2
}

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

	static NSArray printerNames ()
	{
		return invokeObjcSelfClass!(NSArray, "printerNames");
	}

	static NSArray printerTypes ()
	{
		return invokeObjcSelfClass!(NSArray, "printerTypes");
	}

	static NSPrinter printerWithName (NSString name)
	{
		return invokeObjcSelfClass!(NSPrinter, "printerWithName:", NSString)(name);
	}

	static NSPrinter printerWithType (NSString type)
	{
		return invokeObjcSelfClass!(NSPrinter, "printerWithType:", NSString)(type);
	}

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

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

	NSInteger languageLevel ()
	{
		return invokeObjcSelf!(NSInteger, "languageLevel");
	}

	NSSize pageSizeForPaper (NSString paperName)
	{
		return invokeObjcSelf!(NSSize, "pageSizeForPaper:", NSString)(paperName);
	}

	uint statusForTable (NSString tableName)
	{
		return invokeObjcSelf!(uint, "statusForTable:", NSString)(tableName);
	}

	bool isKey (NSString key, NSString table)
	{
		return invokeObjcSelf!(bool, "isKey:inTable:", NSString, NSString)(key, table);
	}

	bool booleanForKey (NSString key, NSString table)
	{
		return invokeObjcSelf!(bool, "booleanForKey:inTable:", NSString, NSString)(key, table);
	}

	float floatForKey (NSString key, NSString table)
	{
		return invokeObjcSelf!(float, "floatForKey:inTable:", NSString, NSString)(key, table);
	}

	int intForKey (NSString key, NSString table)
	{
		return invokeObjcSelf!(int, "intForKey:inTable:", NSString, NSString)(key, table);
	}

	NSRect rectForKey (NSString key, NSString table)
	{
		return invokeObjcSelf!(NSRect, "rectForKey:inTable:", NSString, NSString)(key, table);
	}

	NSSize sizeForKey (NSString key, NSString table)
	{
		return invokeObjcSelf!(NSSize, "sizeForKey:inTable:", NSString, NSString)(key, table);
	}

	NSString stringForKey (NSString key, NSString table)
	{
		return invokeObjcSelf!(NSString, "stringForKey:inTable:", NSString, NSString)(key, table);
	}

	NSArray stringListForKey (NSString key, NSString table)
	{
		return invokeObjcSelf!(NSArray, "stringListForKey:inTable:", NSString, NSString)(key, table);
	}

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

}