1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxGenericPrintDialog, wxGenericPrintSetupDialog,
4 // wxGenericPageSetupDialog
5 // Author: Julian Smart
9 // Copyright: (c) Julian Smart
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef __PRINTDLGH_G_
14 #define __PRINTDLGH_G_
18 #if wxUSE_PRINTING_ARCHITECTURE
20 #include "wx/dialog.h"
21 #include "wx/cmndata.h"
22 #include "wx/prntbase.h"
23 #include "wx/printdlg.h"
24 #include "wx/listctrl.h"
31 class WXDLLIMPEXP_FWD_CORE wxTextCtrl
;
32 class WXDLLIMPEXP_FWD_CORE wxButton
;
33 class WXDLLIMPEXP_FWD_CORE wxCheckBox
;
34 class WXDLLIMPEXP_FWD_CORE wxComboBox
;
35 class WXDLLIMPEXP_FWD_CORE wxStaticText
;
36 class WXDLLIMPEXP_FWD_CORE wxRadioBox
;
37 class WXDLLIMPEXP_FWD_CORE wxPageSetupData
;
39 // ----------------------------------------------------------------------------
41 // ----------------------------------------------------------------------------
43 // This is not clear why all these enums start with 10 or 30 but do not change it
44 // without good reason to avoid some subtle backwards compatibility breakage
48 wxPRINTID_STATIC
= 10,
53 wxPRINTID_PRINTTOFILE
,
59 wxPRINTID_LEFTMARGIN
= 30,
60 wxPRINTID_RIGHTMARGIN
,
62 wxPRINTID_BOTTOMMARGIN
67 wxPRINTID_PRINTCOLOUR
= 10,
68 wxPRINTID_ORIENTATION
,
77 //----------------------------------------------------------------------------
78 // wxPostScriptNativeData
79 //----------------------------------------------------------------------------
81 class WXDLLIMPEXP_CORE wxPostScriptPrintNativeData
: public wxPrintNativeDataBase
84 wxPostScriptPrintNativeData();
85 virtual ~wxPostScriptPrintNativeData();
87 virtual bool TransferTo( wxPrintData
&data
);
88 virtual bool TransferFrom( const wxPrintData
&data
);
90 virtual bool Ok() const { return IsOk(); }
91 virtual bool IsOk() const { return true; }
93 const wxString
& GetPrinterCommand() const { return m_printerCommand
; }
94 const wxString
& GetPrinterOptions() const { return m_printerOptions
; }
95 const wxString
& GetPreviewCommand() const { return m_previewCommand
; }
96 const wxString
& GetFontMetricPath() const { return m_afmPath
; }
97 double GetPrinterScaleX() const { return m_printerScaleX
; }
98 double GetPrinterScaleY() const { return m_printerScaleY
; }
99 long GetPrinterTranslateX() const { return m_printerTranslateX
; }
100 long GetPrinterTranslateY() const { return m_printerTranslateY
; }
102 void SetPrinterCommand(const wxString
& command
) { m_printerCommand
= command
; }
103 void SetPrinterOptions(const wxString
& options
) { m_printerOptions
= options
; }
104 void SetPreviewCommand(const wxString
& command
) { m_previewCommand
= command
; }
105 void SetFontMetricPath(const wxString
& path
) { m_afmPath
= path
; }
106 void SetPrinterScaleX(double x
) { m_printerScaleX
= x
; }
107 void SetPrinterScaleY(double y
) { m_printerScaleY
= y
; }
108 void SetPrinterScaling(double x
, double y
) { m_printerScaleX
= x
; m_printerScaleY
= y
; }
109 void SetPrinterTranslateX(long x
) { m_printerTranslateX
= x
; }
110 void SetPrinterTranslateY(long y
) { m_printerTranslateY
= y
; }
111 void SetPrinterTranslation(long x
, long y
) { m_printerTranslateX
= x
; m_printerTranslateY
= y
; }
114 wxOutputStream
*GetOutputStream() { return m_outputStream
; }
115 void SetOutputStream( wxOutputStream
*output
) { m_outputStream
= output
; }
119 wxString m_printerCommand
;
120 wxString m_previewCommand
;
121 wxString m_printerOptions
;
123 double m_printerScaleX
;
124 double m_printerScaleY
;
125 long m_printerTranslateX
;
126 long m_printerTranslateY
;
128 wxOutputStream
*m_outputStream
;
132 DECLARE_DYNAMIC_CLASS(wxPostScriptPrintNativeData
)
135 // ----------------------------------------------------------------------------
136 // Simulated Print and Print Setup dialogs for non-Windows platforms (and
137 // Windows using PostScript print/preview)
138 // ----------------------------------------------------------------------------
140 class WXDLLIMPEXP_CORE wxGenericPrintDialog
: public wxPrintDialogBase
143 wxGenericPrintDialog(wxWindow
*parent
,
144 wxPrintDialogData
* data
= NULL
);
145 wxGenericPrintDialog(wxWindow
*parent
, wxPrintData
* data
);
147 virtual ~wxGenericPrintDialog();
149 void OnSetup(wxCommandEvent
& event
);
150 void OnRange(wxCommandEvent
& event
);
151 void OnOK(wxCommandEvent
& event
);
153 virtual bool TransferDataFromWindow();
154 virtual bool TransferDataToWindow();
156 virtual int ShowModal();
158 wxPrintData
& GetPrintData()
159 { return m_printDialogData
.GetPrintData(); }
161 wxPrintDialogData
& GetPrintDialogData() { return m_printDialogData
; }
165 // wxStaticText* m_printerMessage;
166 wxButton
* m_setupButton
;
167 // wxButton* m_helpButton;
168 wxRadioBox
* m_rangeRadioBox
;
169 wxTextCtrl
* m_fromText
;
170 wxTextCtrl
* m_toText
;
171 wxTextCtrl
* m_noCopiesText
;
172 wxCheckBox
* m_printToFileCheckBox
;
173 // wxCheckBox* m_collateCopiesCheckBox;
175 wxPrintDialogData m_printDialogData
;
178 void Init(wxWindow
*parent
);
181 DECLARE_EVENT_TABLE()
182 DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog
)
185 class WXDLLIMPEXP_CORE wxGenericPrintSetupDialog
: public wxDialog
188 // There are no configuration options for the dialog, so we
189 // just pass the wxPrintData object (no wxPrintSetupDialogData class needed)
190 wxGenericPrintSetupDialog(wxWindow
*parent
, wxPrintData
* data
);
191 virtual ~wxGenericPrintSetupDialog();
193 void Init(wxPrintData
* data
);
195 void OnPrinter(wxListEvent
& event
);
197 virtual bool TransferDataFromWindow();
198 virtual bool TransferDataToWindow();
200 virtual wxComboBox
*CreatePaperTypeChoice();
203 wxListCtrl
* m_printerListCtrl
;
204 wxRadioBox
* m_orientationRadioBox
;
205 wxTextCtrl
* m_printerCommandText
;
206 wxTextCtrl
* m_printerOptionsText
;
207 wxCheckBox
* m_colourCheckBox
;
208 wxComboBox
* m_paperTypeChoice
;
210 wxPrintData m_printData
;
211 wxPrintData
& GetPrintData() { return m_printData
; }
213 // After pressing OK, write data here.
214 wxPrintData
* m_targetData
;
217 DECLARE_EVENT_TABLE()
218 DECLARE_CLASS(wxGenericPrintSetupDialog
)
223 class WXDLLIMPEXP_CORE wxGenericPageSetupDialog
: public wxPageSetupDialogBase
226 wxGenericPageSetupDialog(wxWindow
*parent
= NULL
,
227 wxPageSetupDialogData
* data
= NULL
);
228 virtual ~wxGenericPageSetupDialog();
230 virtual bool TransferDataFromWindow();
231 virtual bool TransferDataToWindow();
233 virtual wxPageSetupDialogData
& GetPageSetupDialogData();
235 void OnPrinter(wxCommandEvent
& event
);
236 wxComboBox
*CreatePaperTypeChoice(int* x
, int* y
);
239 wxButton
* m_printerButton
;
240 wxRadioBox
* m_orientationRadioBox
;
241 wxTextCtrl
* m_marginLeftText
;
242 wxTextCtrl
* m_marginTopText
;
243 wxTextCtrl
* m_marginRightText
;
244 wxTextCtrl
* m_marginBottomText
;
245 wxComboBox
* m_paperTypeChoice
;
247 wxPageSetupDialogData m_pageData
;
250 DECLARE_EVENT_TABLE()
251 DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericPageSetupDialog
)