Mercurial > projects > dwt-mac
comparison 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 |
comparison
equal
deleted
inserted
replaced
44:ca5e494f2bbf | 45:d8635bb48c7c |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2007 IBM Corporation and others. | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
8 * Contributors: | 8 * Contributors: |
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 * | 10 * |
11 * Port to the D programming language: | 11 * Port to the D programming language: |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | 12 * Jacob Carlborg <doob@me.com> |
13 *******************************************************************************/ | 13 *******************************************************************************/ |
14 module dwt.internal.cocoa.NSPrinter; | 14 module dwt.internal.cocoa.NSPrinter; |
15 | 15 |
16 import dwt.dwthelper.utils; | |
17 import cocoa = dwt.internal.cocoa.id; | |
16 import dwt.internal.cocoa.NSArray; | 18 import dwt.internal.cocoa.NSArray; |
17 import dwt.internal.cocoa.NSDictionary; | |
18 import dwt.internal.cocoa.NSInteger; | |
19 import dwt.internal.cocoa.NSObject; | 19 import dwt.internal.cocoa.NSObject; |
20 import dwt.internal.cocoa.NSRect; | |
21 import dwt.internal.cocoa.NSSize; | |
22 import dwt.internal.cocoa.NSString; | 20 import dwt.internal.cocoa.NSString; |
23 import dwt.internal.cocoa.OS; | 21 import dwt.internal.cocoa.OS; |
24 import objc = dwt.internal.objc.runtime; | 22 import objc = dwt.internal.objc.runtime; |
25 | 23 |
26 enum NSPrinterTableStatus | 24 public class NSPrinter : NSObject { |
27 { | 25 |
28 NSPrinterTableOK = 0, | 26 public this() { |
29 NSPrinterTableNotFound = 1, | 27 super(); |
30 NSPrinterTableError = 2 | |
31 } | 28 } |
32 | 29 |
33 alias NSPrinterTableStatus.NSPrinterTableOK NSPrinterTableOK; | 30 public this(objc.id id) { |
34 alias NSPrinterTableStatus.NSPrinterTableNotFound NSPrinterTableNotFound; | 31 super(id); |
35 alias NSPrinterTableStatus.NSPrinterTableError NSPrinterTableError; | 32 } |
36 | 33 |
37 public class NSPrinter : NSObject | 34 public this(cocoa.id id) { |
38 { | 35 super(id); |
36 } | |
39 | 37 |
40 public this () | 38 public NSString name() { |
41 { | 39 objc.id result = OS.objc_msgSend(this.id, OS.sel_name); |
42 super(); | 40 return result !is null ? new NSString(result) : null; |
43 } | 41 } |
44 | 42 |
45 public this (objc.id id) | 43 public static NSArray printerNames() { |
46 { | 44 objc.id result = OS.objc_msgSend(OS.class_NSPrinter, OS.sel_printerNames); |
47 super(id); | 45 return result !is null ? new NSArray(result) : null; |
48 } | 46 } |
49 | 47 |
50 public bool acceptsBinary () | 48 public static NSPrinter printerWithName(NSString name) { |
51 { | 49 objc.id result = OS.objc_msgSend(OS.class_NSPrinter, OS.sel_printerWithName_, name !is null ? name.id : null); |
52 return OS.objc_msgSend(this.id_, OS.sel_acceptsBinary) !is null; | 50 return result !is null ? new NSPrinter(result) : null; |
53 } | 51 } |
54 | |
55 public bool booleanForKey (NSString key, NSString table) | |
56 { | |
57 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; | |
58 } | |
59 | |
60 public NSDictionary deviceDescription () | |
61 { | |
62 objc.id result = OS.objc_msgSend(this.id_, OS.sel_deviceDescription); | |
63 return result !is null ? new NSDictionary(result) : null; | |
64 } | |
65 | |
66 public NSString domain () | |
67 { | |
68 objc.id result = OS.objc_msgSend(this.id_, OS.sel_domain); | |
69 return result !is null ? new NSString(result) : null; | |
70 } | |
71 | |
72 public float floatForKey (NSString key, NSString table) | |
73 { | |
74 return cast(float) OS.objc_msgSend_fpret(this.id_, OS.sel_floatForKey_1inTable_1, key !is null ? key.id_ : null, | |
75 table !is null ? table.id_ : null); | |
76 } | |
77 | |
78 public NSString host () | |
79 { | |
80 objc.id result = OS.objc_msgSend(this.id_, OS.sel_host); | |
81 return result !is null ? new NSString(result) : null; | |
82 } | |
83 | |
84 public NSRect imageRectForPaper (NSString paperName) | |
85 { | |
86 NSRect result; | |
87 OS.objc_msgSend_stret(&result, this.id_, OS.sel_imageRectForPaper_1, paperName !is null ? paperName.id_ : null); | |
88 return result; | |
89 } | |
90 | |
91 public int intForKey (NSString key, NSString table) | |
92 { | |
93 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); | |
94 } | |
95 | |
96 public bool isColor () | |
97 { | |
98 return OS.objc_msgSend(this.id_, OS.sel_isColor) !is null; | |
99 } | |
100 | |
101 public bool isFontAvailable (NSString faceName) | |
102 { | |
103 return OS.objc_msgSend(this.id_, OS.sel_isFontAvailable_1, faceName !is null ? faceName.id_ : null) !is null; | |
104 } | |
105 | |
106 public bool isKey (NSString key, NSString table) | |
107 { | |
108 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; | |
109 } | |
110 | |
111 public bool isOutputStackInReverseOrder () | |
112 { | |
113 return OS.objc_msgSend(this.id_, OS.sel_isOutputStackInReverseOrder) !is null; | |
114 } | |
115 | |
116 public NSInteger languageLevel () | |
117 { | |
118 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_languageLevel); | |
119 } | |
120 | |
121 public NSString name () | |
122 { | |
123 objc.id result = OS.objc_msgSend(this.id_, OS.sel_name); | |
124 return result !is null ? new NSString(result) : null; | |
125 } | |
126 | |
127 public NSString note () | |
128 { | |
129 objc.id result = OS.objc_msgSend(this.id_, OS.sel_note); | |
130 return result !is null ? new NSString(result) : null; | |
131 } | |
132 | |
133 public NSSize pageSizeForPaper (NSString paperName) | |
134 { | |
135 NSSize result; | |
136 OS.objc_msgSend_stret(&result, this.id_, OS.sel_pageSizeForPaper_1, paperName !is null ? paperName.id_ : null); | |
137 return result; | |
138 } | |
139 | |
140 public static NSArray printerNames () | |
141 { | |
142 objc.id result = OS.objc_msgSend(OS.class_NSPrinter, OS.sel_printerNames); | |
143 return result !is null ? new NSArray(result) : null; | |
144 } | |
145 | |
146 public static NSArray printerTypes () | |
147 { | |
148 objc.id result = OS.objc_msgSend(OS.class_NSPrinter, OS.sel_printerTypes); | |
149 return result !is null ? new NSArray(result) : null; | |
150 } | |
151 | |
152 public static NSPrinter static_printerWithName_ (NSString name) | |
153 { | |
154 objc.id result = OS.objc_msgSend(OS.class_NSPrinter, OS.sel_printerWithName_1, name !is null ? name.id_ : null); | |
155 return result !is null ? new NSPrinter(result) : null; | |
156 } | |
157 | |
158 public static NSPrinter static_printerWithName_domain_includeUnavailable_ (NSString name, NSString domain, bool flag) | |
159 { | |
160 objc.id result = OS.objc_msgSend(OS.class_NSPrinter, OS.sel_printerWithName_1domain_1includeUnavailable_1, name !is null ? name.id_ : null, | |
161 domain !is null ? domain.id_ : null, flag); | |
162 return result !is null ? new NSPrinter(result) : null; | |
163 } | |
164 | |
165 public static NSPrinter printerWithType (NSString type) | |
166 { | |
167 objc.id result = OS.objc_msgSend(OS.class_NSPrinter, OS.sel_printerWithType_1, type !is null ? type.id_ : null); | |
168 return result !is null ? new NSPrinter(result) : null; | |
169 } | |
170 | |
171 public NSRect rectForKey (NSString key, NSString table) | |
172 { | |
173 NSRect result; | |
174 OS.objc_msgSend_stret(&result, this.id_, OS.sel_rectForKey_1inTable_1, key !is null ? key.id_ : null, table !is null ? table.id_ : null); | |
175 return result; | |
176 } | |
177 | |
178 public NSSize sizeForKey (NSString key, NSString table) | |
179 { | |
180 NSSize result; | |
181 OS.objc_msgSend_stret(&result, this.id_, OS.sel_sizeForKey_1inTable_1, key !is null ? key.id_ : null, table !is null ? table.id_ : null); | |
182 return result; | |
183 } | |
184 | |
185 public NSPrinterTableStatus statusForTable (NSString tableName) | |
186 { | |
187 return cast(NSPrinterTableStatus) OS.objc_msgSend(this.id_, OS.sel_statusForTable_1, tableName !is null ? tableName.id_ : null); | |
188 } | |
189 | |
190 public NSString stringForKey (NSString key, NSString table) | |
191 { | |
192 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); | |
193 return result !is null ? new NSString(result) : null; | |
194 } | |
195 | |
196 public NSArray stringListForKey (NSString key, NSString table) | |
197 { | |
198 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); | |
199 return result !is null ? new NSArray(result) : null; | |
200 } | |
201 | |
202 public NSString type () | |
203 { | |
204 objc.id result = OS.objc_msgSend(this.id_, OS.sel_type); | |
205 return result !is null ? new NSString(result) : null; | |
206 } | |
207 | 52 |
208 } | 53 } |