Mercurial > projects > dwt-win
annotate dwt/printing/PrinterData.d @ 212:ab60f3309436
reverted the char[] to String and use the an alias.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 05 May 2008 00:12:38 +0200 |
parents | 8491a1efab40 |
children | 36f5cb12e1a2 |
rev | line source |
---|---|
150 | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2006 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module dwt.printing.PrinterData; | |
14 | |
15 | |
16 import dwt.graphics.DeviceData; | |
17 | |
18 import tango.text.convert.Format; | |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
150
diff
changeset
|
19 import dwt.dwthelper.utils; |
150 | 20 |
21 /** | |
22 * Instances of this class are descriptions of a print job | |
23 * in terms of the printer, and the scope and type of printing | |
24 * that is desired. For example, the number of pages and copies | |
25 * can be specified, as well as whether or not the print job | |
26 * should go to a file. | |
27 * <p> | |
28 * Application code does <em>not</em> need to explicitly release the | |
29 * resources managed by each instance when those instances are no longer | |
30 * required, and thus no <code>dispose()</code> method is provided. | |
31 * </p> | |
32 * | |
33 * @see Printer | |
34 * @see Printer#getPrinterList | |
35 * @see PrintDialog#open | |
36 */ | |
37 | |
38 public final class PrinterData : DeviceData { | |
39 | |
40 /** | |
41 * the printer driver | |
42 * On Windows systems, this is the name of the driver (often "winspool"). | |
43 * On Mac OSX, this is the destination type ("Printer", "Fax", "File", or "Preview"). | |
44 * On X/Window systems, this is the name of a display connection to the | |
45 * Xprt server (the default is ":1"). | |
46 * On GTK+, this is the backend type name (eg. GtkPrintBackendCups). | |
47 */ | |
48 // TODO: note that this api is not finalized for GTK+ | |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
150
diff
changeset
|
49 public String driver; |
150 | 50 |
51 /** | |
52 * the name of the printer | |
53 * On Windows systems, this is the name of the 'device'. | |
54 * On Mac OSX, X/Window systems, and GTK+, this is the printer's 'name'. | |
55 */ | |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
150
diff
changeset
|
56 public String name; |
150 | 57 |
58 /** | |
59 * the scope of the print job, expressed as one of the following values: | |
60 * <dl> | |
61 * <dt><code>ALL_PAGES</code></dt> | |
62 * <dd>Print all pages in the current document</dd> | |
63 * <dt><code>PAGE_RANGE</code></dt> | |
64 * <dd>Print the range of pages specified by startPage and endPage</dd> | |
65 * <dt><code>SELECTION</code></dt> | |
66 * <dd>Print the current selection</dd> | |
67 * </dl> | |
68 */ | |
69 public int scope_ = ALL_PAGES; | |
70 | |
71 /** | |
72 * the start page of a page range, used when scope is PAGE_RANGE. | |
73 * This value can be from 1 to the maximum number of pages for the platform. | |
74 */ | |
75 public int startPage = 0; | |
76 | |
77 /** | |
78 * the end page of a page range, used when scope is PAGE_RANGE. | |
79 * This value can be from 1 to the maximum number of pages for the platform. | |
80 */ | |
81 public int endPage = 0; | |
82 | |
83 /** | |
84 * whether or not the print job should go to a file | |
85 */ | |
86 public bool printToFile = false; | |
87 | |
88 /** | |
89 * the name of the file to print to if printToFile is true. | |
90 * Note that this field is ignored if printToFile is false. | |
91 */ | |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
150
diff
changeset
|
92 public String fileName; |
150 | 93 |
94 /** | |
95 * the number of copies to print. | |
96 * Note that this field may be controlled by the printer driver | |
97 * In other words, the printer itself may be capable of printing | |
98 * multiple copies, and if so, the value of this field will always be 1. | |
99 */ | |
100 public int copyCount = 1; | |
101 | |
102 /** | |
103 * whether or not the printer should collate the printed paper | |
104 * Note that this field may be controlled by the printer driver. | |
105 * In other words, the printer itself may be capable of doing the | |
106 * collation, and if so, the value of this field will always be false. | |
107 */ | |
108 public bool collate = false; | |
109 | |
110 /** | |
111 * <code>scope</code> field value indicating that | |
112 * all pages should be printed | |
113 */ | |
114 public static const int ALL_PAGES = 0; | |
115 | |
116 /** | |
117 * <code>scope</code> field value indicating that | |
118 * the range of pages specified by startPage and endPage | |
119 * should be printed | |
120 */ | |
121 public static const int PAGE_RANGE = 1; | |
122 | |
123 /** | |
124 * <code>scope</code> field value indicating that | |
125 * the current selection should be printed | |
126 */ | |
127 public static const int SELECTION = 2; | |
128 | |
129 /** | |
130 * private, platform-specific data | |
131 * On Windows, this contains a copy of the DEVMODE struct | |
132 * returned from the <code>PrintDialog</code>. | |
133 * This field is not currently used on the X/Window System. | |
134 */ | |
135 byte [] otherData; | |
136 | |
137 /** | |
138 * Constructs an instance of this class that can be | |
139 * used to print to the default printer. | |
140 * | |
141 * @see Printer#getDefaultPrinterData | |
142 */ | |
143 public this() { | |
144 } | |
145 | |
146 /** | |
147 * Constructs an instance of this class with the given | |
148 * printer driver and printer name. | |
149 * | |
150 * @param driver the printer driver for the printer | |
151 * @param name the name of the printer | |
152 * | |
153 * @see #driver | |
154 * @see #name | |
155 */ | |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
150
diff
changeset
|
156 public this(String driver, String name) { |
150 | 157 this.driver = driver; |
158 this.name = name; | |
159 } | |
160 | |
161 /** | |
162 * Returns a string containing a concise, human-readable | |
163 * description of the receiver. | |
164 * | |
165 * @return a string representation of the receiver | |
166 */ | |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
150
diff
changeset
|
167 public String toString() { |
150 | 168 return Format("PrinterData {{driver = {}, name = {}}", driver, name ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ |
169 } | |
170 } |