1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Common GDI data classes
4 // Author: Julian Smart and others
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_CMNDATA_H_BASE_
13 #define _WX_CMNDATA_H_BASE_
17 #if wxUSE_PRINTING_ARCHITECTURE
19 #include "wx/gdicmn.h"
22 #include "wx/stream.h"
25 class WXDLLIMPEXP_FWD_CORE wxPrintNativeDataBase
;
29 * Encapsulates printer information (not printer dialog information)
46 wxPRINTBIN_LARGECAPACITY
,
48 wxPRINTBIN_FORMSOURCE
,
53 const int wxPRINTMEDIA_DEFAULT
= 0;
55 class WXDLLIMPEXP_CORE wxPrintData
: public wxObject
59 wxPrintData(const wxPrintData
& printData
);
60 virtual ~wxPrintData();
62 int GetNoCopies() const { return m_printNoCopies
; }
63 bool GetCollate() const { return m_printCollate
; }
64 wxPrintOrientation
GetOrientation() const { return m_printOrientation
; }
65 bool IsOrientationReversed() const { return m_printOrientationReversed
; }
67 // Is this data OK for showing the print dialog?
68 bool Ok() const { return IsOk(); }
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
76 // in wxPageSetupDialogData
77 wxPrintQuality
GetQuality() const { return m_printQuality
; }
78 wxPrintBin
GetBin() const { return m_bin
; }
79 wxPrintMode
GetPrintMode() const { return m_printMode
; }
80 int GetMedia() const { return m_media
; }
82 void SetNoCopies(int v
) { m_printNoCopies
= v
; }
83 void SetCollate(bool flag
) { m_printCollate
= flag
; }
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
; }
89 void SetOrientationReversed(bool reversed
) { m_printOrientationReversed
= reversed
; }
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
; }
97 void SetBin(wxPrintBin bin
) { m_bin
= bin
; }
98 void SetMedia(int media
) { m_media
= media
; }
99 void SetPrintMode(wxPrintMode printMode
) { m_printMode
= printMode
; }
101 wxString
GetFilename() const { return m_filename
; }
102 void SetFilename( const wxString
&filename
) { m_filename
= filename
; }
104 wxPrintData
& operator=(const wxPrintData
& data
);
106 char* GetPrivData() const { return m_privData
; }
107 int GetPrivDataLen() const { return m_privDataLen
; }
108 void SetPrivData( char *privData
, int len
);
111 // Convert between wxPrintData and native data
112 void ConvertToNative();
113 void ConvertFromNative();
114 // Holds the native print data
115 wxPrintNativeDataBase
*GetNativeData() const { return m_nativeData
; }
120 wxPrintMode m_printMode
;
123 wxPrintOrientation m_printOrientation
;
124 bool m_printOrientationReversed
;
127 wxString m_printerName
;
129 wxDuplexMode m_duplexMode
;
130 wxPrintQuality m_printQuality
;
131 wxPaperSize m_paperId
;
139 wxPrintNativeDataBase
*m_nativeData
;
142 DECLARE_DYNAMIC_CLASS(wxPrintData
)
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
152 class WXDLLIMPEXP_CORE wxPrintDialogData
: public wxObject
156 wxPrintDialogData(const wxPrintDialogData
& dialogData
);
157 wxPrintDialogData(const wxPrintData
& printData
);
158 virtual ~wxPrintDialogData();
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
; }
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
; }
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
; }
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
; }
190 // Is this data OK for showing the print dialog?
191 bool Ok() const { return IsOk(); }
192 bool IsOk() const { return m_printData
.IsOk() ; }
194 wxPrintData
& GetPrintData() { return m_printData
; }
195 void SetPrintData(const wxPrintData
& printData
) { m_printData
= printData
; }
197 void operator=(const wxPrintDialogData
& data
);
198 void operator=(const wxPrintData
& data
); // Sets internal m_printData member
206 bool m_printAllPages
;
209 bool m_printSelection
;
210 bool m_printEnableSelection
;
211 bool m_printEnablePageNumbers
;
212 bool m_printEnableHelp
;
213 bool m_printEnablePrintToFile
;
214 wxPrintData m_printData
;
217 DECLARE_DYNAMIC_CLASS(wxPrintDialogData
)
221 * This is the data used (and returned) by the wxPageSetupDialog.
224 // Compatibility with old name
225 #define wxPageSetupData wxPageSetupDialogData
227 class WXDLLIMPEXP_CORE wxPageSetupDialogData
: public wxObject
230 wxPageSetupDialogData();
231 wxPageSetupDialogData(const wxPageSetupDialogData
& dialogData
);
232 wxPageSetupDialogData(const wxPrintData
& printData
);
233 virtual ~wxPageSetupDialogData();
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
; }
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
; }
250 // Is this data OK for showing the page setup dialog?
251 bool Ok() const { return IsOk(); }
252 bool IsOk() const { return m_printData
.IsOk() ; }
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
);
258 void SetPaperId(wxPaperSize id
) { m_printData
.SetPaperId(id
); }
260 // Sets the wxPrintData id, plus the paper width/height if found in the paper database.
261 void SetPaperSize(wxPaperSize id
);
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
; }
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
; }
276 // Use paper size defined in this object to set the wxPrintData
278 void CalculateIdFromPaperSize();
280 // Use paper id in wxPrintData to set this object's paper size
281 void CalculatePaperSizeFromId();
283 wxPageSetupDialogData
& operator=(const wxPageSetupDialogData
& data
);
284 wxPageSetupDialogData
& operator=(const wxPrintData
& data
);
286 wxPrintData
& GetPrintData() { return m_printData
; }
287 const wxPrintData
& GetPrintData() const { return m_printData
; }
288 void SetPrintData(const wxPrintData
& printData
);
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
;
296 bool m_defaultMinMargins
;
297 bool m_enableMargins
;
298 bool m_enableOrientation
;
300 bool m_enablePrinter
;
301 bool m_getDefaultInfo
; // Equiv. to PSD_RETURNDEFAULT
303 wxPrintData m_printData
;
306 DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData
)
309 #endif // wxUSE_PRINTING_ARCHITECTURE
312 // _WX_CMNDATA_H_BASE_