diff dwt/internal/cocoa/NSPrinter.d @ 45:d8635bb48c7c

Merge with SWT 3.5
author Jacob Carlborg <doob@me.com>
date Mon, 01 Dec 2008 17:07:00 +0100
parents f565d3a95c0a
children
line wrap: on
line diff
--- a/dwt/internal/cocoa/NSPrinter.d	Tue Oct 21 15:20:04 2008 +0200
+++ b/dwt/internal/cocoa/NSPrinter.d	Mon Dec 01 17:07:00 2008 +0100
@@ -1,208 +1,53 @@
 /*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 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
+ *    IBM Corporation - initial API and implementation
  *     
  * Port to the D programming language:
- *     Jacob Carlborg <jacob.carlborg@gmail.com>
+ *    Jacob Carlborg <doob@me.com>
  *******************************************************************************/
 module dwt.internal.cocoa.NSPrinter;
 
+import dwt.dwthelper.utils;
+import cocoa = dwt.internal.cocoa.id;
 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
+public class NSPrinter : NSObject {
+
+public this() {
+    super();
+}
+
+public this(objc.id id) {
+    super(id);
+}
+
+public this(cocoa.id id) {
+    super(id);
 }
 
-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 NSString name() {
+    objc.id result = OS.objc_msgSend(this.id, OS.sel_name);
+    return result !is null ? new NSString(result) : 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 NSArray printerNames() {
+    objc.id result = OS.objc_msgSend(OS.class_NSPrinter, OS.sel_printerNames);
+    return result !is null ? new NSArray(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;
-    }
+public static NSPrinter printerWithName(NSString name) {
+    objc.id result = OS.objc_msgSend(OS.class_NSPrinter, OS.sel_printerWithName_, name !is null ? name.id : null);
+    return result !is null ? new NSPrinter(result) : null;
+}
 
 }