Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSPrintInfo.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 | 62202ce0039f |
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.NSPrintInfo; | 14 module dwt.internal.cocoa.NSPrintInfo; |
15 | 15 |
16 import dwt.internal.cocoa.CGFloat; | 16 import dwt.dwthelper.utils; |
17 import dwt.internal.cocoa.id; | 17 import cocoa = dwt.internal.cocoa.id; |
18 import dwt.internal.cocoa.NSDictionary; | 18 import dwt.internal.cocoa.NSDictionary; |
19 import dwt.internal.cocoa.NSMutableDictionary; | 19 import dwt.internal.cocoa.NSMutableDictionary; |
20 import dwt.internal.cocoa.NSObject; | 20 import dwt.internal.cocoa.NSObject; |
21 import dwt.internal.cocoa.NSPrinter; | 21 import dwt.internal.cocoa.NSPrinter; |
22 import dwt.internal.cocoa.NSRect; | 22 import dwt.internal.cocoa.NSRect; |
23 import dwt.internal.cocoa.NSSize; | 23 import dwt.internal.cocoa.NSSize; |
24 import dwt.internal.cocoa.NSString; | 24 import dwt.internal.cocoa.NSString; |
25 import dwt.internal.cocoa.OS; | 25 import dwt.internal.cocoa.OS; |
26 import objc = dwt.internal.objc.runtime; | 26 import objc = dwt.internal.objc.runtime; |
27 | 27 |
28 enum NSPrintingPaginationMode | 28 public class NSPrintInfo : NSObject { |
29 { | 29 |
30 NSAutoPagination = 0, | 30 public this() { |
31 NSFitPagination = 1, | 31 super(); |
32 NSClipPagination = 2 | |
33 } | 32 } |
34 | 33 |
35 alias NSPrintingPaginationMode.NSAutoPagination NSAutoPagination; | 34 public this(objc.id id) { |
36 alias NSPrintingPaginationMode.NSFitPagination NSFitPagination; | 35 super(id); |
37 alias NSPrintingPaginationMode.NSClipPagination NSClipPagination; | |
38 | |
39 enum NSPrintingOrientation | |
40 { | |
41 NSPortraitOrientation = 0, | |
42 NSLandscapeOrientation = 1 | |
43 } | 36 } |
44 | 37 |
45 alias NSPrintingOrientation.NSPortraitOrientation NSPortraitOrientation; | 38 public this(cocoa.id id) { |
46 alias NSPrintingOrientation.NSLandscapeOrientation NSLandscapeOrientation; | 39 super(id); |
40 } | |
47 | 41 |
48 public class NSPrintInfo : NSObject | 42 public static NSPrinter defaultPrinter() { |
49 { | 43 objc.id result = OS.objc_msgSend(OS.class_NSPrintInfo, OS.sel_defaultPrinter); |
44 return result !is null ? new NSPrinter(result) : null; | |
45 } | |
50 | 46 |
51 public this () | 47 public NSMutableDictionary dictionary() { |
52 { | 48 objc.id result = OS.objc_msgSend(this.id, OS.sel_dictionary); |
53 super(); | 49 return result !is null ? new NSMutableDictionary(result) : null; |
54 } | 50 } |
55 | 51 |
56 public this (objc.id id) | 52 public NSRect imageablePageBounds() { |
57 { | 53 NSRect result = NSRect(); |
58 super(id); | 54 OS.objc_msgSend_stret(result, this.id, OS.sel_imageablePageBounds); |
59 } | 55 return result; |
56 } | |
60 | 57 |
61 public void* PMPageFormat () | 58 public NSPrintInfo initWithDictionary(NSDictionary attributes) { |
62 { | 59 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithDictionary_, attributes !is null ? attributes.id : null); |
63 return cast(void*) OS.objc_msgSend(this.id_, OS.sel_PMPageFormat); | 60 return result is this.id ? this : (result !is null ? new NSPrintInfo(result) : null); |
64 } | 61 } |
65 | 62 |
66 public void* PMPrintSession () | 63 public NSString jobDisposition() { |
67 { | 64 objc.id result = OS.objc_msgSend(this.id, OS.sel_jobDisposition); |
68 return cast(void*) OS.objc_msgSend(this.id_, OS.sel_PMPrintSession); | 65 return result !is null ? new NSString(result) : null; |
69 } | 66 } |
70 | 67 |
71 public void* PMPrintSettings () | 68 public NSSize paperSize() { |
72 { | 69 NSSize result = NSSize(); |
73 return cast(void*) OS.objc_msgSend(this.id_, OS.sel_PMPrintSettings); | 70 OS.objc_msgSend_stret(result, this.id, OS.sel_paperSize); |
74 } | 71 return result; |
72 } | |
75 | 73 |
76 public CGFloat bottomMargin () | 74 public NSPrinter printer() { |
77 { | 75 objc.id result = OS.objc_msgSend(this.id, OS.sel_printer); |
78 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_bottomMargin); | 76 return result !is null ? new NSPrinter(result) : null; |
79 } | 77 } |
80 | 78 |
81 public static NSPrinter defaultPrinter () | 79 public void setJobDisposition(NSString disposition) { |
82 { | 80 OS.objc_msgSend(this.id, OS.sel_setJobDisposition_, disposition !is null ? disposition.id : null); |
83 objc.id result = OS.objc_msgSend(OS.class_NSPrintInfo, OS.sel_defaultPrinter); | 81 } |
84 return result !is null ? new NSPrinter(result) : null; | |
85 } | |
86 | 82 |
87 public NSMutableDictionary dictionary () | 83 public void setPrinter(NSPrinter printer) { |
88 { | 84 OS.objc_msgSend(this.id, OS.sel_setPrinter_, printer !is null ? printer.id : null); |
89 objc.id result = OS.objc_msgSend(this.id_, OS.sel_dictionary); | 85 } |
90 return result !is null ? new NSMutableDictionary(result) : null; | |
91 } | |
92 | 86 |
93 public NSPrintingPaginationMode horizontalPagination () | 87 public void setUpPrintOperationDefaultValues() { |
94 { | 88 OS.objc_msgSend(this.id, OS.sel_setUpPrintOperationDefaultValues); |
95 return cast(NSPrintingPaginationMode) OS.objc_msgSend(this.id_, OS.sel_horizontalPagination); | 89 } |
96 } | |
97 | 90 |
98 public NSRect imageablePageBounds () | 91 public static NSPrintInfo sharedPrintInfo() { |
99 { | 92 objc.id result = OS.objc_msgSend(OS.class_NSPrintInfo, OS.sel_sharedPrintInfo); |
100 NSRect result; | 93 return result !is null ? new NSPrintInfo(result) : null; |
101 OS.objc_msgSend_stret(&result, this.id_, OS.sel_imageablePageBounds); | 94 } |
102 return result; | |
103 } | |
104 | |
105 public id initWithDictionary (NSDictionary attributes) | |
106 { | |
107 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithDictionary_1, attributes !is null ? attributes.id_ : null); | |
108 return result !is null ? new id(result) : null; | |
109 } | |
110 | |
111 public bool isHorizontallyCentered () | |
112 { | |
113 return OS.objc_msgSend(this.id_, OS.sel_isHorizontallyCentered) !is null; | |
114 } | |
115 | |
116 public bool isVerticallyCentered () | |
117 { | |
118 return OS.objc_msgSend(this.id_, OS.sel_isVerticallyCentered) !is null; | |
119 } | |
120 | |
121 public NSString jobDisposition () | |
122 { | |
123 objc.id result = OS.objc_msgSend(this.id_, OS.sel_jobDisposition); | |
124 return result !is null ? new NSString(result) : null; | |
125 } | |
126 | |
127 public CGFloat leftMargin () | |
128 { | |
129 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_leftMargin); | |
130 } | |
131 | |
132 public NSString localizedPaperName () | |
133 { | |
134 objc.id result = OS.objc_msgSend(this.id_, OS.sel_localizedPaperName); | |
135 return result !is null ? new NSString(result) : null; | |
136 } | |
137 | |
138 public NSPrintingOrientation orientation () | |
139 { | |
140 return cast(NSPrintingOrientation) OS.objc_msgSend(this.id_, OS.sel_orientation); | |
141 } | |
142 | |
143 public NSString paperName () | |
144 { | |
145 objc.id result = OS.objc_msgSend(this.id_, OS.sel_paperName); | |
146 return result !is null ? new NSString(result) : null; | |
147 } | |
148 | |
149 public NSSize paperSize () | |
150 { | |
151 NSSize result; | |
152 OS.objc_msgSend_stret(&result, this.id_, OS.sel_paperSize); | |
153 return result; | |
154 } | |
155 | |
156 public NSMutableDictionary printSettings () | |
157 { | |
158 objc.id result = OS.objc_msgSend(this.id_, OS.sel_printSettings); | |
159 return result !is null ? new NSMutableDictionary(result) : null; | |
160 } | |
161 | |
162 public NSPrinter printer () | |
163 { | |
164 objc.id result = OS.objc_msgSend(this.id_, OS.sel_printer); | |
165 return result !is null ? new NSPrinter(result) : null; | |
166 } | |
167 | |
168 public CGFloat rightMargin () | |
169 { | |
170 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_rightMargin); | |
171 } | |
172 | |
173 public void setBottomMargin (CGFloat margin) | |
174 { | |
175 OS.objc_msgSend(this.id_, OS.sel_setBottomMargin_1, margin); | |
176 } | |
177 | |
178 public static void setDefaultPrinter (NSPrinter printer) | |
179 { | |
180 OS.objc_msgSend(OS.class_NSPrintInfo, OS.sel_setDefaultPrinter_1, printer !is null ? printer.id_ : null); | |
181 } | |
182 | |
183 public void setHorizontalPagination (NSPrintingPaginationMode mode) | |
184 { | |
185 OS.objc_msgSend(this.id_, OS.sel_setHorizontalPagination_1, mode); | |
186 } | |
187 | |
188 public void setHorizontallyCentered (bool flag) | |
189 { | |
190 OS.objc_msgSend(this.id_, OS.sel_setHorizontallyCentered_1, flag); | |
191 } | |
192 | |
193 public void setJobDisposition (NSString disposition) | |
194 { | |
195 OS.objc_msgSend(this.id_, OS.sel_setJobDisposition_1, disposition !is null ? disposition.id_ : null); | |
196 } | |
197 | |
198 public void setLeftMargin (CGFloat margin) | |
199 { | |
200 OS.objc_msgSend(this.id_, OS.sel_setLeftMargin_1, margin); | |
201 } | |
202 | |
203 public void setOrientation (NSPrintingOrientation orientation) | |
204 { | |
205 OS.objc_msgSend(this.id_, OS.sel_setOrientation_1, orientation); | |
206 } | |
207 | |
208 public void setPaperName (NSString name) | |
209 { | |
210 OS.objc_msgSend(this.id_, OS.sel_setPaperName_1, name !is null ? name.id_ : null); | |
211 } | |
212 | |
213 public void setPaperSize (NSSize size) | |
214 { | |
215 OS.objc_msgSend(this.id_, OS.sel_setPaperSize_1, size); | |
216 } | |
217 | |
218 public void setPrinter (NSPrinter printer) | |
219 { | |
220 OS.objc_msgSend(this.id_, OS.sel_setPrinter_1, printer !is null ? printer.id_ : null); | |
221 } | |
222 | |
223 public void setRightMargin (CGFloat margin) | |
224 { | |
225 OS.objc_msgSend(this.id_, OS.sel_setRightMargin_1, margin); | |
226 } | |
227 | |
228 public static void setSharedPrintInfo (NSPrintInfo printInfo) | |
229 { | |
230 OS.objc_msgSend(OS.class_NSPrintInfo, OS.sel_setSharedPrintInfo_1, printInfo !is null ? printInfo.id_ : null); | |
231 } | |
232 | |
233 public void setTopMargin (CGFloat margin) | |
234 { | |
235 OS.objc_msgSend(this.id_, OS.sel_setTopMargin_1, margin); | |
236 } | |
237 | |
238 public void setUpPrintOperationDefaultValues () | |
239 { | |
240 OS.objc_msgSend(this.id_, OS.sel_setUpPrintOperationDefaultValues); | |
241 } | |
242 | |
243 public void setVerticalPagination (NSPrintingPaginationMode mode) | |
244 { | |
245 OS.objc_msgSend(this.id_, OS.sel_setVerticalPagination_1, mode); | |
246 } | |
247 | |
248 public void setVerticallyCentered (bool flag) | |
249 { | |
250 OS.objc_msgSend(this.id_, OS.sel_setVerticallyCentered_1, flag); | |
251 } | |
252 | |
253 public static NSPrintInfo sharedPrintInfo () | |
254 { | |
255 objc.id result = OS.objc_msgSend(OS.class_NSPrintInfo, OS.sel_sharedPrintInfo); | |
256 return result !is null ? new NSPrintInfo(result) : null; | |
257 } | |
258 | |
259 public static NSSize sizeForPaperName (NSString name) | |
260 { | |
261 NSSize result; | |
262 OS.objc_msgSend_stret(&result, OS.class_NSPrintInfo, OS.sel_sizeForPaperName_1, name !is null ? name.id_ : null); | |
263 return result; | |
264 } | |
265 | |
266 public CGFloat topMargin () | |
267 { | |
268 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_topMargin); | |
269 } | |
270 | |
271 public void updateFromPMPageFormat () | |
272 { | |
273 OS.objc_msgSend(this.id_, OS.sel_updateFromPMPageFormat); | |
274 } | |
275 | |
276 public void updateFromPMPrintSettings () | |
277 { | |
278 OS.objc_msgSend(this.id_, OS.sel_updateFromPMPrintSettings); | |
279 } | |
280 | |
281 public NSPrintingPaginationMode verticalPagination () | |
282 { | |
283 return cast(NSPrintingPaginationMode) OS.objc_msgSend(this.id_, OS.sel_verticalPagination); | |
284 } | |
285 | 95 |
286 } | 96 } |