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