Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSPrinter.d @ 1:8b48be5454ce
The internal cocoa classes compile now
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Tue, 19 Aug 2008 17:35:17 +0200 |
parents | 380af2bdd8e5 |
children | f565d3a95c0a |
line wrap: on
line source
/******************************************************************************* * Copyright (c) 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * * Port to the D Programming language: * Jacob Carlborg <jacob.carlborg@gmail.com> *******************************************************************************/ module dwt.internal.cocoa.NSPrinter; import dwt.internal.cocoa.NSArray; import dwt.internal.cocoa.NSDictionary; import dwt.internal.cocoa.NSInteger; import dwt.internal.cocoa.NSObject; import dwt.internal.cocoa.NSRect; import dwt.internal.cocoa.NSSize; import dwt.internal.cocoa.NSString; import dwt.internal.cocoa.OS; import objc = dwt.internal.objc.runtime; enum NSPrinterTableStatus { NSPrinterTableOK = 0, NSPrinterTableNotFound = 1, NSPrinterTableError = 2 } alias NSPrinterTableStatus.NSPrinterTableOK NSPrinterTableOK; alias NSPrinterTableStatus.NSPrinterTableNotFound NSPrinterTableNotFound; alias NSPrinterTableStatus.NSPrinterTableError NSPrinterTableError; public class NSPrinter : NSObject { public this () { super(); } public this (objc.id id) { super(id); } public bool acceptsBinary () { return OS.objc_msgSend(this.id_, OS.sel_acceptsBinary) !is null; } public bool booleanForKey (NSString key, NSString table) { return OS.objc_msgSend(this.id_, OS.sel_booleanForKey_1inTable_1, key !is null ? key.id_ : null, table !is null ? table.id_ : null) !is null; } public NSDictionary deviceDescription () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_deviceDescription); return result !is null ? new NSDictionary(result) : null; } public NSString domain () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_domain); return result !is null ? new NSString(result) : null; } public float floatForKey (NSString key, NSString table) { return cast(float) OS.objc_msgSend_fpret(this.id_, OS.sel_floatForKey_1inTable_1, key !is null ? key.id_ : null, table !is null ? table.id_ : null); } public NSString host () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_host); return result !is null ? new NSString(result) : null; } public NSRect imageRectForPaper (NSString paperName) { NSRect result; OS.objc_msgSend_stret(&result, this.id_, OS.sel_imageRectForPaper_1, paperName !is null ? paperName.id_ : null); return result; } public int intForKey (NSString key, NSString table) { return cast(int) OS.objc_msgSend(this.id_, OS.sel_intForKey_1inTable_1, key !is null ? key.id_ : null, table !is null ? table.id_ : null); } public bool isColor () { return OS.objc_msgSend(this.id_, OS.sel_isColor) !is null; } public bool isFontAvailable (NSString faceName) { return OS.objc_msgSend(this.id_, OS.sel_isFontAvailable_1, faceName !is null ? faceName.id_ : null) !is null; } public bool isKey (NSString key, NSString table) { return OS.objc_msgSend(this.id_, OS.sel_isKey_1inTable_1, key !is null ? key.id_ : null, table !is null ? table.id_ : null) !is null; } public bool isOutputStackInReverseOrder () { return OS.objc_msgSend(this.id_, OS.sel_isOutputStackInReverseOrder) !is null; } public NSInteger languageLevel () { return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_languageLevel); } public NSString name () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_name); return result !is null ? new NSString(result) : null; } public NSString note () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_note); return result !is null ? new NSString(result) : null; } public NSSize pageSizeForPaper (NSString paperName) { NSSize result; OS.objc_msgSend_stret(&result, this.id_, OS.sel_pageSizeForPaper_1, paperName !is null ? paperName.id_ : null); return result; } public static NSArray printerNames () { objc.id result = OS.objc_msgSend(OS.class_NSPrinter, OS.sel_printerNames); return result !is null ? new NSArray(result) : null; } public static NSArray printerTypes () { objc.id result = OS.objc_msgSend(OS.class_NSPrinter, OS.sel_printerTypes); return result !is null ? new NSArray(result) : null; } public static NSPrinter static_printerWithName_ (NSString name) { objc.id result = OS.objc_msgSend(OS.class_NSPrinter, OS.sel_printerWithName_1, name !is null ? name.id_ : null); return result !is null ? new NSPrinter(result) : null; } public static NSPrinter static_printerWithName_domain_includeUnavailable_ (NSString name, NSString domain, bool flag) { objc.id result = OS.objc_msgSend(OS.class_NSPrinter, OS.sel_printerWithName_1domain_1includeUnavailable_1, name !is null ? name.id_ : null, domain !is null ? domain.id_ : null, flag); return result !is null ? new NSPrinter(result) : null; } public static NSPrinter printerWithType (NSString type) { objc.id result = OS.objc_msgSend(OS.class_NSPrinter, OS.sel_printerWithType_1, type !is null ? type.id_ : null); return result !is null ? new NSPrinter(result) : null; } public NSRect rectForKey (NSString key, NSString table) { NSRect result; OS.objc_msgSend_stret(&result, this.id_, OS.sel_rectForKey_1inTable_1, key !is null ? key.id_ : null, table !is null ? table.id_ : null); return result; } public NSSize sizeForKey (NSString key, NSString table) { NSSize result; OS.objc_msgSend_stret(&result, this.id_, OS.sel_sizeForKey_1inTable_1, key !is null ? key.id_ : null, table !is null ? table.id_ : null); return result; } public NSPrinterTableStatus statusForTable (NSString tableName) { return cast(NSPrinterTableStatus) OS.objc_msgSend(this.id_, OS.sel_statusForTable_1, tableName !is null ? tableName.id_ : null); } public NSString stringForKey (NSString key, NSString table) { objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringForKey_1inTable_1, key !is null ? key.id_ : null, table !is null ? table.id_ : null); return result !is null ? new NSString(result) : null; } public NSArray stringListForKey (NSString key, NSString table) { objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringListForKey_1inTable_1, key !is null ? key.id_ : null, table !is null ? table.id_ : null); return result !is null ? new NSArray(result) : null; } public NSString type () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_type); return result !is null ? new NSString(result) : null; } }