]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cmndata.h
wxRTC: fixed guidelines overwriting adjacent cell borders; corrected capitalisation...
[wxWidgets.git] / include / wx / cmndata.h
CommitLineData
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
c801d85f 7// Copyright: (c)
65571936 8// Licence: wxWindows licence
c801d85f
KB
9/////////////////////////////////////////////////////////////////////////////
10
34138703
JS
11#ifndef _WX_CMNDATA_H_BASE_
12#define _WX_CMNDATA_H_BASE_
c801d85f 13
081d8d96
PC
14#include "wx/defs.h"
15
16#if wxUSE_PRINTING_ARCHITECTURE
17
8bedcdce 18#include "wx/gdicmn.h"
34138703 19
244e5e34
VZ
20#if wxUSE_STREAMS
21#include "wx/stream.h"
22#endif
23
b5dbe15d 24class WXDLLIMPEXP_FWD_CORE wxPrintNativeDataBase;
8850cbd3 25
c801d85f
KB
26/*
27 * wxPrintData
7bcb11d3 28 * Encapsulates printer information (not printer dialog information)
c801d85f 29 */
7bcb11d3 30
60090256
VZ
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
1399de55 49 wxPRINTBIN_USER
60090256
VZ
50};
51
781609f2 52const int wxPRINTMEDIA_DEFAULT = 0;
60090256 53
53a2db12 54class WXDLLIMPEXP_CORE wxPrintData: public wxObject
c801d85f 55{
eba33006 56public:
7bcb11d3
JS
57 wxPrintData();
58 wxPrintData(const wxPrintData& printData);
d3c7fc99 59 virtual ~wxPrintData();
d6b9496a 60
dbc37e68
RR
61 int GetNoCopies() const { return m_printNoCopies; }
62 bool GetCollate() const { return m_printCollate; }
af7e24c3 63 wxPrintOrientation GetOrientation() const { return m_printOrientation; }
01294df0 64 bool IsOrientationReversed() const { return m_printOrientationReversed; }
d6b9496a 65
58cf0491 66 // Is this data OK for showing the print dialog?
b7cacb43
VZ
67 bool Ok() const { return IsOk(); }
68 bool IsOk() const ;
58cf0491 69
d6b9496a
VZ
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
7bcb11d3 75 // in wxPageSetupDialogData
d6b9496a 76 wxPrintQuality GetQuality() const { return m_printQuality; }
60090256 77 wxPrintBin GetBin() const { return m_bin; }
6038ec8e 78 wxPrintMode GetPrintMode() const { return m_printMode; }
781609f2 79 int GetMedia() const { return m_media; }
7bcb11d3 80
dbc37e68
RR
81 void SetNoCopies(int v) { m_printNoCopies = v; }
82 void SetCollate(bool flag) { m_printCollate = flag; }
af7e24c3
VZ
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; }
01294df0 88 void SetOrientationReversed(bool reversed) { m_printOrientationReversed = reversed; }
7bcb11d3 89
d6b9496a
VZ
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; }
60090256 96 void SetBin(wxPrintBin bin) { m_bin = bin; }
781609f2 97 void SetMedia(int media) { m_media = media; }
6038ec8e 98 void SetPrintMode(wxPrintMode printMode) { m_printMode = printMode; }
7bcb11d3 99
8850cbd3
RR
100 wxString GetFilename() const { return m_filename; }
101 void SetFilename( const wxString &filename ) { m_filename = filename; }
ce7208d4 102
83666e99 103 wxPrintData& operator=(const wxPrintData& data);
7bcb11d3 104
aa96f01c
RR
105 char* GetPrivData() const { return m_privData; }
106 int GetPrivDataLen() const { return m_privDataLen; }
107 void SetPrivData( char *privData, int len );
ce7208d4 108
aa96f01c 109
53fa663a 110 // Convert between wxPrintData and native data
7bcb11d3
JS
111 void ConvertToNative();
112 void ConvertFromNative();
53fa663a
RR
113 // Holds the native print data
114 wxPrintNativeDataBase *GetNativeData() const { return m_nativeData; }
d6b9496a 115
7bcb11d3 116private:
60090256 117 wxPrintBin m_bin;
781609f2 118 int m_media;
6038ec8e 119 wxPrintMode m_printMode;
2b5f62a0 120
7bcb11d3 121 int m_printNoCopies;
af7e24c3 122 wxPrintOrientation m_printOrientation;
01294df0 123 bool m_printOrientationReversed;
7bcb11d3
JS
124 bool m_printCollate;
125
7bcb11d3
JS
126 wxString m_printerName;
127 bool m_colour;
128 wxDuplexMode m_duplexMode;
129 wxPrintQuality m_printQuality;
130 wxPaperSize m_paperId;
131 wxSize m_paperSize;
ce7208d4 132
7bcb11d3 133 wxString m_filename;
ce7208d4 134
aa96f01c
RR
135 char* m_privData;
136 int m_privDataLen;
ce7208d4 137
8850cbd3 138 wxPrintNativeDataBase *m_nativeData;
244e5e34 139
eba33006
RR
140private:
141 DECLARE_DYNAMIC_CLASS(wxPrintData)
c801d85f
KB
142};
143
144/*
7bcb11d3
JS
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.
c801d85f
KB
149 */
150
53a2db12 151class WXDLLIMPEXP_CORE wxPrintDialogData: public wxObject
c801d85f 152{
eba33006 153public:
7bcb11d3
JS
154 wxPrintDialogData();
155 wxPrintDialogData(const wxPrintDialogData& dialogData);
156 wxPrintDialogData(const wxPrintData& printData);
d3c7fc99 157 virtual ~wxPrintDialogData();
d6b9496a 158
47b378bd
VS
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; }
d6b9496a 188
58cf0491 189 // Is this data OK for showing the print dialog?
b7cacb43 190 bool Ok() const { return IsOk(); }
a1b806b9 191 bool IsOk() const { return m_printData.IsOk() ; }
58cf0491 192
d6b9496a
VZ
193 wxPrintData& GetPrintData() { return m_printData; }
194 void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
7bcb11d3
JS
195
196 void operator=(const wxPrintDialogData& data);
197 void operator=(const wxPrintData& data); // Sets internal m_printData member
d6b9496a 198
7bcb11d3 199private:
7bcb11d3
JS
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;
5360828d 208 bool m_printSelection;
7bcb11d3
JS
209 bool m_printEnableSelection;
210 bool m_printEnablePageNumbers;
211 bool m_printEnableHelp;
212 bool m_printEnablePrintToFile;
7bcb11d3 213 wxPrintData m_printData;
eba33006 214
68379eaf 215private:
eba33006 216 DECLARE_DYNAMIC_CLASS(wxPrintDialogData)
7bcb11d3
JS
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
c801d85f 225
53a2db12 226class WXDLLIMPEXP_CORE wxPageSetupDialogData: public wxObject
7bcb11d3 227{
7bcb11d3
JS
228public:
229 wxPageSetupDialogData();
230 wxPageSetupDialogData(const wxPageSetupDialogData& dialogData);
231 wxPageSetupDialogData(const wxPrintData& printData);
d3c7fc99 232 virtual ~wxPageSetupDialogData();
7bcb11d3 233
47b378bd
VS
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; }
7bcb11d3 248
58cf0491 249 // Is this data OK for showing the page setup dialog?
b7cacb43 250 bool Ok() const { return IsOk(); }
a1b806b9 251 bool IsOk() const { return m_printData.IsOk() ; }
58cf0491 252
7bcb11d3
JS
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
47b378bd 257 void SetPaperId(wxPaperSize id) { m_printData.SetPaperId(id); }
69157f8b 258
7bcb11d3
JS
259 // Sets the wxPrintData id, plus the paper width/height if found in the paper database.
260 void SetPaperSize(wxPaperSize id);
261
47b378bd
VS
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; }
d6b9496a 274
7bcb11d3
JS
275 // Use paper size defined in this object to set the wxPrintData
276 // paper id
277 void CalculateIdFromPaperSize();
d6b9496a 278
7bcb11d3
JS
279 // Use paper id in wxPrintData to set this object's paper size
280 void CalculatePaperSizeFromId();
d6b9496a 281
7193abfb 282 wxPageSetupDialogData& operator=(const wxPageSetupDialogData& data);
5e472c1f 283 wxPageSetupDialogData& operator=(const wxPrintData& data);
7bcb11d3 284
d6b9496a 285 wxPrintData& GetPrintData() { return m_printData; }
f415cab9 286 const wxPrintData& GetPrintData() const { return m_printData; }
24c5243d 287 void SetPrintData(const wxPrintData& printData);
c801d85f 288
7bcb11d3 289private:
7bcb11d3
JS
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;
7bcb11d3
JS
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;
7bcb11d3 302 wxPrintData m_printData;
68379eaf 303
eba33006
RR
304private:
305 DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData)
7bcb11d3 306};
c801d85f 307
88ac883a
VZ
308#endif // wxUSE_PRINTING_ARCHITECTURE
309
c801d85f 310#endif
7bcb11d3 311// _WX_CMNDATA_H_BASE_