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"
30 class WXDLLEXPORT wxTextCtrl
;
31 class WXDLLEXPORT wxButton
;
32 class WXDLLEXPORT wxCheckBox
;
33 class WXDLLEXPORT wxComboBox
;
34 class WXDLLEXPORT wxStaticText
;
35 class WXDLLEXPORT wxRadioBox
;
36 class WXDLLEXPORT wxPageSetupData
;
38 // ----------------------------------------------------------------------------
40 // ----------------------------------------------------------------------------
42 // This is not clear why all these enums start with 10 or 30 but do not change it
43 // without good reason to avoid some subtle backwards compatibility breakage
47 wxPRINTID_STATIC
= 10,
52 wxPRINTID_PRINTTOFILE
,
58 wxPRINTID_LEFTMARGIN
= 30,
59 wxPRINTID_RIGHTMARGIN
,
61 wxPRINTID_BOTTOMMARGIN
66 wxPRINTID_PRINTCOLOUR
= 10,
67 wxPRINTID_ORIENTATION
,
76 //----------------------------------------------------------------------------
77 // wxPostScriptNativeData
78 //----------------------------------------------------------------------------
80 class WXDLLEXPORT wxPostScriptPrintNativeData
: public wxPrintNativeDataBase
83 wxPostScriptPrintNativeData();
84 virtual ~wxPostScriptPrintNativeData();
86 virtual bool TransferTo( wxPrintData
&data
);
87 virtual bool TransferFrom( const wxPrintData
&data
);
89 virtual bool Ok() const { return IsOk(); }
90 virtual bool IsOk() const { return true; }
92 const wxString
& GetPrinterCommand() const { return m_printerCommand
; }
93 const wxString
& GetPrinterOptions() const { return m_printerOptions
; }
94 const wxString
& GetPreviewCommand() const { return m_previewCommand
; }
95 const wxString
& GetFontMetricPath() const { return m_afmPath
; }
96 double GetPrinterScaleX() const { return m_printerScaleX
; }
97 double GetPrinterScaleY() const { return m_printerScaleY
; }
98 long GetPrinterTranslateX() const { return m_printerTranslateX
; }
99 long GetPrinterTranslateY() const { return m_printerTranslateY
; }
101 void SetPrinterCommand(const wxString
& command
) { m_printerCommand
= command
; }
102 void SetPrinterOptions(const wxString
& options
) { m_printerOptions
= options
; }
103 void SetPreviewCommand(const wxString
& command
) { m_previewCommand
= command
; }
104 void SetFontMetricPath(const wxString
& path
) { m_afmPath
= path
; }
105 void SetPrinterScaleX(double x
) { m_printerScaleX
= x
; }
106 void SetPrinterScaleY(double y
) { m_printerScaleY
= y
; }
107 void SetPrinterScaling(double x
, double y
) { m_printerScaleX
= x
; m_printerScaleY
= y
; }
108 void SetPrinterTranslateX(long x
) { m_printerTranslateX
= x
; }
109 void SetPrinterTranslateY(long y
) { m_printerTranslateY
= y
; }
110 void SetPrinterTranslation(long x
, long y
) { m_printerTranslateX
= x
; m_printerTranslateY
= y
; }
113 wxOutputStream
*GetOutputStream() { return m_outputStream
; }
114 void SetOutputStream( wxOutputStream
*output
) { m_outputStream
= output
; }
118 wxString m_printerCommand
;
119 wxString m_previewCommand
;
120 wxString m_printerOptions
;
122 double m_printerScaleX
;
123 double m_printerScaleY
;
124 long m_printerTranslateX
;
125 long m_printerTranslateY
;
127 wxOutputStream
*m_outputStream
;
131 DECLARE_DYNAMIC_CLASS(wxPostScriptPrintNativeData
)
134 // ----------------------------------------------------------------------------
135 // Simulated Print and Print Setup dialogs for non-Windows platforms (and
136 // Windows using PostScript print/preview)
137 // ----------------------------------------------------------------------------
139 class WXDLLEXPORT wxGenericPrintDialog
: public wxPrintDialogBase
142 wxGenericPrintDialog(wxWindow
*parent
,
143 wxPrintDialogData
* data
= (wxPrintDialogData
*)NULL
);
144 wxGenericPrintDialog(wxWindow
*parent
, wxPrintData
* data
);
146 virtual ~wxGenericPrintDialog();
148 void OnSetup(wxCommandEvent
& event
);
149 void OnRange(wxCommandEvent
& event
);
150 void OnOK(wxCommandEvent
& event
);
152 virtual bool TransferDataFromWindow();
153 virtual bool TransferDataToWindow();
155 virtual int ShowModal();
157 wxPrintData
& GetPrintData()
158 { return m_printDialogData
.GetPrintData(); }
160 wxPrintDialogData
& GetPrintDialogData() { return m_printDialogData
; }
164 // wxStaticText* m_printerMessage;
165 wxButton
* m_setupButton
;
166 // wxButton* m_helpButton;
167 wxRadioBox
* m_rangeRadioBox
;
168 wxTextCtrl
* m_fromText
;
169 wxTextCtrl
* m_toText
;
170 wxTextCtrl
* m_noCopiesText
;
171 wxCheckBox
* m_printToFileCheckBox
;
172 // wxCheckBox* m_collateCopiesCheckBox;
174 wxPrintDialogData m_printDialogData
;
177 void Init(wxWindow
*parent
);
180 DECLARE_EVENT_TABLE()
181 DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog
)
184 class WXDLLEXPORT wxGenericPrintSetupDialog
: public wxDialog
187 // There are no configuration options for the dialog, so we
188 // just pass the wxPrintData object (no wxPrintSetupDialogData class needed)
189 wxGenericPrintSetupDialog(wxWindow
*parent
, wxPrintData
* data
);
190 virtual ~wxGenericPrintSetupDialog();
192 void Init(wxPrintData
* data
);
194 void OnPrinter(wxListEvent
& event
);
196 virtual bool TransferDataFromWindow();
197 virtual bool TransferDataToWindow();
199 virtual wxComboBox
*CreatePaperTypeChoice();
202 wxListCtrl
* m_printerListCtrl
;
203 wxRadioBox
* m_orientationRadioBox
;
204 wxTextCtrl
* m_printerCommandText
;
205 wxTextCtrl
* m_printerOptionsText
;
206 wxCheckBox
* m_colourCheckBox
;
207 wxComboBox
* m_paperTypeChoice
;
209 wxPrintData m_printData
;
210 wxPrintData
& GetPrintData() { return m_printData
; }
212 // After pressing OK, write data here.
213 wxPrintData
* m_targetData
;
216 DECLARE_EVENT_TABLE()
217 DECLARE_CLASS(wxGenericPrintSetupDialog
)
222 class WXDLLEXPORT wxGenericPageSetupDialog
: public wxPageSetupDialogBase
225 wxGenericPageSetupDialog(wxWindow
*parent
= NULL
,
226 wxPageSetupDialogData
* data
= NULL
);
227 virtual ~wxGenericPageSetupDialog();
229 virtual bool TransferDataFromWindow();
230 virtual bool TransferDataToWindow();
232 virtual wxPageSetupDialogData
& GetPageSetupDialogData();
234 void OnPrinter(wxCommandEvent
& event
);
235 wxComboBox
*CreatePaperTypeChoice(int* x
, int* y
);
238 wxButton
* m_printerButton
;
239 wxRadioBox
* m_orientationRadioBox
;
240 wxTextCtrl
* m_marginLeftText
;
241 wxTextCtrl
* m_marginTopText
;
242 wxTextCtrl
* m_marginRightText
;
243 wxTextCtrl
* m_marginBottomText
;
244 wxComboBox
* m_paperTypeChoice
;
246 wxPageSetupDialogData m_pageData
;
249 DECLARE_EVENT_TABLE()
250 DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericPageSetupDialog
)