]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
ce7208d4 | 2 | // Name: wx/cmndata.h |
c801d85f KB |
3 | // Purpose: Common GDI data classes |
4 | // Author: Julian Smart and others | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) | |
65571936 | 9 | // Licence: wxWindows licence |
c801d85f KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
34138703 JS |
12 | #ifndef _WX_CMNDATA_H_BASE_ |
13 | #define _WX_CMNDATA_H_BASE_ | |
c801d85f | 14 | |
081d8d96 PC |
15 | #include "wx/defs.h" |
16 | ||
17 | #if wxUSE_PRINTING_ARCHITECTURE | |
18 | ||
8bedcdce | 19 | #include "wx/gdicmn.h" |
34138703 | 20 | |
244e5e34 VZ |
21 | #if wxUSE_STREAMS |
22 | #include "wx/stream.h" | |
23 | #endif | |
24 | ||
b5dbe15d | 25 | class WXDLLIMPEXP_FWD_CORE wxPrintNativeDataBase; |
8850cbd3 | 26 | |
c801d85f KB |
27 | /* |
28 | * wxPrintData | |
7bcb11d3 | 29 | * Encapsulates printer information (not printer dialog information) |
c801d85f | 30 | */ |
7bcb11d3 | 31 | |
60090256 VZ |
32 | enum wxPrintBin |
33 | { | |
34 | wxPRINTBIN_DEFAULT, | |
35 | ||
36 | wxPRINTBIN_ONLYONE, | |
37 | wxPRINTBIN_LOWER, | |
38 | wxPRINTBIN_MIDDLE, | |
39 | wxPRINTBIN_MANUAL, | |
40 | wxPRINTBIN_ENVELOPE, | |
41 | wxPRINTBIN_ENVMANUAL, | |
42 | wxPRINTBIN_AUTO, | |
43 | wxPRINTBIN_TRACTOR, | |
44 | wxPRINTBIN_SMALLFMT, | |
45 | wxPRINTBIN_LARGEFMT, | |
46 | wxPRINTBIN_LARGECAPACITY, | |
47 | wxPRINTBIN_CASSETTE, | |
48 | wxPRINTBIN_FORMSOURCE, | |
49 | ||
1399de55 | 50 | wxPRINTBIN_USER |
60090256 VZ |
51 | }; |
52 | ||
781609f2 | 53 | const int wxPRINTMEDIA_DEFAULT = 0; |
60090256 | 54 | |
53a2db12 | 55 | class WXDLLIMPEXP_CORE wxPrintData: public wxObject |
c801d85f | 56 | { |
eba33006 | 57 | public: |
7bcb11d3 JS |
58 | wxPrintData(); |
59 | wxPrintData(const wxPrintData& printData); | |
d3c7fc99 | 60 | virtual ~wxPrintData(); |
d6b9496a | 61 | |
dbc37e68 RR |
62 | int GetNoCopies() const { return m_printNoCopies; } |
63 | bool GetCollate() const { return m_printCollate; } | |
af7e24c3 | 64 | wxPrintOrientation GetOrientation() const { return m_printOrientation; } |
01294df0 | 65 | bool IsOrientationReversed() const { return m_printOrientationReversed; } |
d6b9496a | 66 | |
58cf0491 | 67 | // Is this data OK for showing the print dialog? |
b7cacb43 VZ |
68 | bool Ok() const { return IsOk(); } |
69 | bool IsOk() const ; | |
58cf0491 | 70 | |
d6b9496a VZ |
71 | const wxString& GetPrinterName() const { return m_printerName; } |
72 | bool GetColour() const { return m_colour; } | |
73 | wxDuplexMode GetDuplex() const { return m_duplexMode; } | |
74 | wxPaperSize GetPaperId() const { return m_paperId; } | |
75 | const wxSize& GetPaperSize() const { return m_paperSize; } // Not used yet: confusable with paper size | |
7bcb11d3 | 76 | // in wxPageSetupDialogData |
d6b9496a | 77 | wxPrintQuality GetQuality() const { return m_printQuality; } |
60090256 | 78 | wxPrintBin GetBin() const { return m_bin; } |
6038ec8e | 79 | wxPrintMode GetPrintMode() const { return m_printMode; } |
781609f2 | 80 | int GetMedia() const { return m_media; } |
7bcb11d3 | 81 | |
dbc37e68 RR |
82 | void SetNoCopies(int v) { m_printNoCopies = v; } |
83 | void SetCollate(bool flag) { m_printCollate = flag; } | |
af7e24c3 VZ |
84 | |
85 | // Please use the overloaded method below | |
86 | wxDEPRECATED_INLINE(void SetOrientation(int orient), | |
87 | m_printOrientation = (wxPrintOrientation)orient; ) | |
88 | void SetOrientation(wxPrintOrientation orient) { m_printOrientation = orient; } | |
01294df0 | 89 | void SetOrientationReversed(bool reversed) { m_printOrientationReversed = reversed; } |
7bcb11d3 | 90 | |
d6b9496a VZ |
91 | void SetPrinterName(const wxString& name) { m_printerName = name; } |
92 | void SetColour(bool colour) { m_colour = colour; } | |
93 | void SetDuplex(wxDuplexMode duplex) { m_duplexMode = duplex; } | |
94 | void SetPaperId(wxPaperSize sizeId) { m_paperId = sizeId; } | |
95 | void SetPaperSize(const wxSize& sz) { m_paperSize = sz; } | |
96 | void SetQuality(wxPrintQuality quality) { m_printQuality = quality; } | |
60090256 | 97 | void SetBin(wxPrintBin bin) { m_bin = bin; } |
781609f2 | 98 | void SetMedia(int media) { m_media = media; } |
6038ec8e | 99 | void SetPrintMode(wxPrintMode printMode) { m_printMode = printMode; } |
7bcb11d3 | 100 | |
8850cbd3 RR |
101 | wxString GetFilename() const { return m_filename; } |
102 | void SetFilename( const wxString &filename ) { m_filename = filename; } | |
ce7208d4 | 103 | |
83666e99 | 104 | wxPrintData& operator=(const wxPrintData& data); |
7bcb11d3 | 105 | |
aa96f01c RR |
106 | char* GetPrivData() const { return m_privData; } |
107 | int GetPrivDataLen() const { return m_privDataLen; } | |
108 | void SetPrivData( char *privData, int len ); | |
ce7208d4 | 109 | |
aa96f01c | 110 | |
53fa663a | 111 | // Convert between wxPrintData and native data |
7bcb11d3 JS |
112 | void ConvertToNative(); |
113 | void ConvertFromNative(); | |
53fa663a RR |
114 | // Holds the native print data |
115 | wxPrintNativeDataBase *GetNativeData() const { return m_nativeData; } | |
d6b9496a | 116 | |
7bcb11d3 | 117 | private: |
60090256 | 118 | wxPrintBin m_bin; |
781609f2 | 119 | int m_media; |
6038ec8e | 120 | wxPrintMode m_printMode; |
2b5f62a0 | 121 | |
7bcb11d3 | 122 | int m_printNoCopies; |
af7e24c3 | 123 | wxPrintOrientation m_printOrientation; |
01294df0 | 124 | bool m_printOrientationReversed; |
7bcb11d3 JS |
125 | bool m_printCollate; |
126 | ||
7bcb11d3 JS |
127 | wxString m_printerName; |
128 | bool m_colour; | |
129 | wxDuplexMode m_duplexMode; | |
130 | wxPrintQuality m_printQuality; | |
131 | wxPaperSize m_paperId; | |
132 | wxSize m_paperSize; | |
ce7208d4 | 133 | |
7bcb11d3 | 134 | wxString m_filename; |
ce7208d4 | 135 | |
aa96f01c RR |
136 | char* m_privData; |
137 | int m_privDataLen; | |
ce7208d4 | 138 | |
8850cbd3 | 139 | wxPrintNativeDataBase *m_nativeData; |
244e5e34 | 140 | |
eba33006 RR |
141 | private: |
142 | DECLARE_DYNAMIC_CLASS(wxPrintData) | |
c801d85f KB |
143 | }; |
144 | ||
145 | /* | |
7bcb11d3 JS |
146 | * wxPrintDialogData |
147 | * Encapsulates information displayed and edited in the printer dialog box. | |
148 | * Contains a wxPrintData object which is filled in according to the values retrieved | |
149 | * from the dialog. | |
c801d85f KB |
150 | */ |
151 | ||
53a2db12 | 152 | class WXDLLIMPEXP_CORE wxPrintDialogData: public wxObject |
c801d85f | 153 | { |
eba33006 | 154 | public: |
7bcb11d3 JS |
155 | wxPrintDialogData(); |
156 | wxPrintDialogData(const wxPrintDialogData& dialogData); | |
157 | wxPrintDialogData(const wxPrintData& printData); | |
d3c7fc99 | 158 | virtual ~wxPrintDialogData(); |
d6b9496a | 159 | |
47b378bd VS |
160 | int GetFromPage() const { return m_printFromPage; } |
161 | int GetToPage() const { return m_printToPage; } | |
162 | int GetMinPage() const { return m_printMinPage; } | |
163 | int GetMaxPage() const { return m_printMaxPage; } | |
164 | int GetNoCopies() const { return m_printNoCopies; } | |
165 | bool GetAllPages() const { return m_printAllPages; } | |
166 | bool GetSelection() const { return m_printSelection; } | |
167 | bool GetCollate() const { return m_printCollate; } | |
168 | bool GetPrintToFile() const { return m_printToFile; } | |
169 | ||
170 | void SetFromPage(int v) { m_printFromPage = v; } | |
171 | void SetToPage(int v) { m_printToPage = v; } | |
172 | void SetMinPage(int v) { m_printMinPage = v; } | |
173 | void SetMaxPage(int v) { m_printMaxPage = v; } | |
174 | void SetNoCopies(int v) { m_printNoCopies = v; } | |
175 | void SetAllPages(bool flag) { m_printAllPages = flag; } | |
176 | void SetSelection(bool flag) { m_printSelection = flag; } | |
177 | void SetCollate(bool flag) { m_printCollate = flag; } | |
178 | void SetPrintToFile(bool flag) { m_printToFile = flag; } | |
179 | ||
180 | void EnablePrintToFile(bool flag) { m_printEnablePrintToFile = flag; } | |
181 | void EnableSelection(bool flag) { m_printEnableSelection = flag; } | |
182 | void EnablePageNumbers(bool flag) { m_printEnablePageNumbers = flag; } | |
183 | void EnableHelp(bool flag) { m_printEnableHelp = flag; } | |
184 | ||
185 | bool GetEnablePrintToFile() const { return m_printEnablePrintToFile; } | |
186 | bool GetEnableSelection() const { return m_printEnableSelection; } | |
187 | bool GetEnablePageNumbers() const { return m_printEnablePageNumbers; } | |
188 | bool GetEnableHelp() const { return m_printEnableHelp; } | |
d6b9496a | 189 | |
58cf0491 | 190 | // Is this data OK for showing the print dialog? |
b7cacb43 VZ |
191 | bool Ok() const { return IsOk(); } |
192 | bool IsOk() const { return m_printData.Ok() ; } | |
58cf0491 | 193 | |
d6b9496a VZ |
194 | wxPrintData& GetPrintData() { return m_printData; } |
195 | void SetPrintData(const wxPrintData& printData) { m_printData = printData; } | |
7bcb11d3 JS |
196 | |
197 | void operator=(const wxPrintDialogData& data); | |
198 | void operator=(const wxPrintData& data); // Sets internal m_printData member | |
d6b9496a | 199 | |
7bcb11d3 | 200 | private: |
7bcb11d3 JS |
201 | int m_printFromPage; |
202 | int m_printToPage; | |
203 | int m_printMinPage; | |
204 | int m_printMaxPage; | |
205 | int m_printNoCopies; | |
206 | bool m_printAllPages; | |
207 | bool m_printCollate; | |
208 | bool m_printToFile; | |
5360828d | 209 | bool m_printSelection; |
7bcb11d3 JS |
210 | bool m_printEnableSelection; |
211 | bool m_printEnablePageNumbers; | |
212 | bool m_printEnableHelp; | |
213 | bool m_printEnablePrintToFile; | |
7bcb11d3 | 214 | wxPrintData m_printData; |
eba33006 | 215 | |
68379eaf | 216 | private: |
eba33006 | 217 | DECLARE_DYNAMIC_CLASS(wxPrintDialogData) |
7bcb11d3 JS |
218 | }; |
219 | ||
220 | /* | |
221 | * This is the data used (and returned) by the wxPageSetupDialog. | |
222 | */ | |
223 | ||
224 | // Compatibility with old name | |
225 | #define wxPageSetupData wxPageSetupDialogData | |
c801d85f | 226 | |
53a2db12 | 227 | class WXDLLIMPEXP_CORE wxPageSetupDialogData: public wxObject |
7bcb11d3 | 228 | { |
7bcb11d3 JS |
229 | public: |
230 | wxPageSetupDialogData(); | |
231 | wxPageSetupDialogData(const wxPageSetupDialogData& dialogData); | |
232 | wxPageSetupDialogData(const wxPrintData& printData); | |
d3c7fc99 | 233 | virtual ~wxPageSetupDialogData(); |
7bcb11d3 | 234 | |
47b378bd VS |
235 | wxSize GetPaperSize() const { return m_paperSize; } |
236 | wxPaperSize GetPaperId() const { return m_printData.GetPaperId(); } | |
237 | wxPoint GetMinMarginTopLeft() const { return m_minMarginTopLeft; } | |
238 | wxPoint GetMinMarginBottomRight() const { return m_minMarginBottomRight; } | |
239 | wxPoint GetMarginTopLeft() const { return m_marginTopLeft; } | |
240 | wxPoint GetMarginBottomRight() const { return m_marginBottomRight; } | |
241 | ||
242 | bool GetDefaultMinMargins() const { return m_defaultMinMargins; } | |
243 | bool GetEnableMargins() const { return m_enableMargins; } | |
244 | bool GetEnableOrientation() const { return m_enableOrientation; } | |
245 | bool GetEnablePaper() const { return m_enablePaper; } | |
246 | bool GetEnablePrinter() const { return m_enablePrinter; } | |
247 | bool GetDefaultInfo() const { return m_getDefaultInfo; } | |
248 | bool GetEnableHelp() const { return m_enableHelp; } | |
7bcb11d3 | 249 | |
58cf0491 | 250 | // Is this data OK for showing the page setup dialog? |
b7cacb43 VZ |
251 | bool Ok() const { return IsOk(); } |
252 | bool IsOk() const { return m_printData.Ok() ; } | |
58cf0491 | 253 | |
7bcb11d3 JS |
254 | // If a corresponding paper type is found in the paper database, will set the m_printData |
255 | // paper size id member as well. | |
256 | void SetPaperSize(const wxSize& sz); | |
257 | ||
47b378bd | 258 | void SetPaperId(wxPaperSize id) { m_printData.SetPaperId(id); } |
69157f8b | 259 | |
7bcb11d3 JS |
260 | // Sets the wxPrintData id, plus the paper width/height if found in the paper database. |
261 | void SetPaperSize(wxPaperSize id); | |
262 | ||
47b378bd VS |
263 | void SetMinMarginTopLeft(const wxPoint& pt) { m_minMarginTopLeft = pt; } |
264 | void SetMinMarginBottomRight(const wxPoint& pt) { m_minMarginBottomRight = pt; } | |
265 | void SetMarginTopLeft(const wxPoint& pt) { m_marginTopLeft = pt; } | |
266 | void SetMarginBottomRight(const wxPoint& pt) { m_marginBottomRight = pt; } | |
267 | void SetDefaultMinMargins(bool flag) { m_defaultMinMargins = flag; } | |
268 | void SetDefaultInfo(bool flag) { m_getDefaultInfo = flag; } | |
269 | ||
270 | void EnableMargins(bool flag) { m_enableMargins = flag; } | |
271 | void EnableOrientation(bool flag) { m_enableOrientation = flag; } | |
272 | void EnablePaper(bool flag) { m_enablePaper = flag; } | |
273 | void EnablePrinter(bool flag) { m_enablePrinter = flag; } | |
274 | void EnableHelp(bool flag) { m_enableHelp = flag; } | |
d6b9496a | 275 | |
7bcb11d3 JS |
276 | // Use paper size defined in this object to set the wxPrintData |
277 | // paper id | |
278 | void CalculateIdFromPaperSize(); | |
d6b9496a | 279 | |
7bcb11d3 JS |
280 | // Use paper id in wxPrintData to set this object's paper size |
281 | void CalculatePaperSizeFromId(); | |
d6b9496a | 282 | |
5e472c1f GD |
283 | wxPageSetupDialogData& operator=(const wxPageSetupData& data); |
284 | wxPageSetupDialogData& operator=(const wxPrintData& data); | |
7bcb11d3 | 285 | |
d6b9496a | 286 | wxPrintData& GetPrintData() { return m_printData; } |
f415cab9 | 287 | const wxPrintData& GetPrintData() const { return m_printData; } |
24c5243d | 288 | void SetPrintData(const wxPrintData& printData); |
c801d85f | 289 | |
7bcb11d3 | 290 | private: |
7bcb11d3 JS |
291 | wxSize m_paperSize; // The dimensions selected by the user (on return, same as in wxPrintData?) |
292 | wxPoint m_minMarginTopLeft; | |
293 | wxPoint m_minMarginBottomRight; | |
294 | wxPoint m_marginTopLeft; | |
295 | wxPoint m_marginBottomRight; | |
7bcb11d3 JS |
296 | bool m_defaultMinMargins; |
297 | bool m_enableMargins; | |
298 | bool m_enableOrientation; | |
299 | bool m_enablePaper; | |
300 | bool m_enablePrinter; | |
301 | bool m_getDefaultInfo; // Equiv. to PSD_RETURNDEFAULT | |
302 | bool m_enableHelp; | |
7bcb11d3 | 303 | wxPrintData m_printData; |
68379eaf | 304 | |
eba33006 RR |
305 | private: |
306 | DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData) | |
7bcb11d3 | 307 | }; |
c801d85f | 308 | |
88ac883a VZ |
309 | #endif // wxUSE_PRINTING_ARCHITECTURE |
310 | ||
c801d85f | 311 | #endif |
7bcb11d3 | 312 | // _WX_CMNDATA_H_BASE_ |