1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Common GDI data classes
4 // Author: Julian Smart and others
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_CMNDATA_H_BASE_
12 #define _WX_CMNDATA_H_BASE_
16 #if wxUSE_PRINTING_ARCHITECTURE
18 #include "wx/gdicmn.h"
21 #include "wx/stream.h"
24 class WXDLLIMPEXP_FWD_CORE wxPrintNativeDataBase
;
28 * Encapsulates printer information (not printer dialog information)
45 wxPRINTBIN_LARGECAPACITY
,
47 wxPRINTBIN_FORMSOURCE
,
52 const int wxPRINTMEDIA_DEFAULT
= 0;
54 class WXDLLIMPEXP_CORE wxPrintData
: public wxObject
58 wxPrintData(const wxPrintData
& printData
);
59 virtual ~wxPrintData();
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
; }
66 // Is this data OK for showing the print dialog?
67 bool Ok() const { return IsOk(); }
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
; }
81 void SetNoCopies(int v
) { m_printNoCopies
= v
; }
82 void SetCollate(bool flag
) { m_printCollate
= flag
; }
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
; }
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
; }
100 wxString
GetFilename() const { return m_filename
; }
101 void SetFilename( const wxString
&filename
) { m_filename
= filename
; }
103 wxPrintData
& operator=(const wxPrintData
& data
);
105 char* GetPrivData() const { return m_privData
; }
106 int GetPrivDataLen() const { return m_privDataLen
; }
107 void SetPrivData( char *privData
, int len
);
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
; }
119 wxPrintMode m_printMode
;
122 wxPrintOrientation m_printOrientation
;
123 bool m_printOrientationReversed
;
126 wxString m_printerName
;
128 wxDuplexMode m_duplexMode
;
129 wxPrintQuality m_printQuality
;
130 wxPaperSize m_paperId
;
138 wxPrintNativeDataBase
*m_nativeData
;
141 DECLARE_DYNAMIC_CLASS(wxPrintData
)
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
151 class WXDLLIMPEXP_CORE wxPrintDialogData
: public wxObject
155 wxPrintDialogData(const wxPrintDialogData
& dialogData
);
156 wxPrintDialogData(const wxPrintData
& printData
);
157 virtual ~wxPrintDialogData();
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
; }
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
; }
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
; }
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
; }
189 // Is this data OK for showing the print dialog?
190 bool Ok() const { return IsOk(); }
191 bool IsOk() const { return m_printData
.IsOk() ; }
193 wxPrintData
& GetPrintData() { return m_printData
; }
194 void SetPrintData(const wxPrintData
& printData
) { m_printData
= printData
; }
196 void operator=(const wxPrintDialogData
& data
);
197 void operator=(const wxPrintData
& data
); // Sets internal m_printData member
205 bool m_printAllPages
;
208 bool m_printSelection
;
209 bool m_printEnableSelection
;
210 bool m_printEnablePageNumbers
;
211 bool m_printEnableHelp
;
212 bool m_printEnablePrintToFile
;
213 wxPrintData m_printData
;
216 DECLARE_DYNAMIC_CLASS(wxPrintDialogData
)
220 * This is the data used (and returned) by the wxPageSetupDialog.
223 // Compatibility with old name
224 #define wxPageSetupData wxPageSetupDialogData
226 class WXDLLIMPEXP_CORE wxPageSetupDialogData
: public wxObject
229 wxPageSetupDialogData();
230 wxPageSetupDialogData(const wxPageSetupDialogData
& dialogData
);
231 wxPageSetupDialogData(const wxPrintData
& printData
);
232 virtual ~wxPageSetupDialogData();
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
; }
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
; }
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() ; }
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
);
257 void SetPaperId(wxPaperSize id
) { m_printData
.SetPaperId(id
); }
259 // Sets the wxPrintData id, plus the paper width/height if found in the paper database.
260 void SetPaperSize(wxPaperSize id
);
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
; }
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
; }
275 // Use paper size defined in this object to set the wxPrintData
277 void CalculateIdFromPaperSize();
279 // Use paper id in wxPrintData to set this object's paper size
280 void CalculatePaperSizeFromId();
282 wxPageSetupDialogData
& operator=(const wxPageSetupDialogData
& data
);
283 wxPageSetupDialogData
& operator=(const wxPrintData
& data
);
285 wxPrintData
& GetPrintData() { return m_printData
; }
286 const wxPrintData
& GetPrintData() const { return m_printData
; }
287 void SetPrintData(const wxPrintData
& printData
);
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
;
299 bool m_enablePrinter
;
300 bool m_getDefaultInfo
; // Equiv. to PSD_RETURNDEFAULT
302 wxPrintData m_printData
;
305 DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData
)
308 #endif // wxUSE_PRINTING_ARCHITECTURE
311 // _WX_CMNDATA_H_BASE_