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_
16 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
17 #pragma interface "prntdlgg.h"
22 #if wxUSE_PRINTING_ARCHITECTURE
24 #include "wx/dialog.h"
25 #include "wx/cmndata.h"
26 #include "wx/prntbase.h"
27 #include "wx/printdlg.h"
28 #include "wx/listctrl.h"
34 class WXDLLEXPORT wxTextCtrl
;
35 class WXDLLEXPORT wxButton
;
36 class WXDLLEXPORT wxCheckBox
;
37 class WXDLLEXPORT wxComboBox
;
38 class WXDLLEXPORT wxStaticText
;
39 class WXDLLEXPORT wxRadioBox
;
40 class WXDLLEXPORT wxPageSetupData
;
42 // ----------------------------------------------------------------------------
44 // ----------------------------------------------------------------------------
46 // This is not clear why all these enums start with 10 or 30 but do not change it
47 // without good reason to avoid some subtle backwards compatibility breakage
51 wxPRINTID_STATIC
= 10,
56 wxPRINTID_PRINTTOFILE
,
62 wxPRINTID_LEFTMARGIN
= 30,
63 wxPRINTID_RIGHTMARGIN
,
65 wxPRINTID_BOTTOMMARGIN
70 wxPRINTID_PRINTCOLOUR
= 10,
71 wxPRINTID_ORIENTATION
,
80 //----------------------------------------------------------------------------
81 // wxPostScriptNativeData
82 //----------------------------------------------------------------------------
84 class WXDLLEXPORT wxPostScriptPrintNativeData
: public wxPrintNativeDataBase
87 wxPostScriptPrintNativeData();
88 virtual ~wxPostScriptPrintNativeData();
90 virtual bool TransferTo( wxPrintData
&data
);
91 virtual bool TransferFrom( const wxPrintData
&data
);
93 virtual bool Ok() const { return true; }
95 const wxString
& GetPrinterCommand() const { return m_printerCommand
; }
96 const wxString
& GetPrinterOptions() const { return m_printerOptions
; }
97 const wxString
& GetPreviewCommand() const { return m_previewCommand
; }
98 const wxString
& GetFontMetricPath() const { return m_afmPath
; }
99 double GetPrinterScaleX() const { return m_printerScaleX
; }
100 double GetPrinterScaleY() const { return m_printerScaleY
; }
101 long GetPrinterTranslateX() const { return m_printerTranslateX
; }
102 long GetPrinterTranslateY() const { return m_printerTranslateY
; }
104 void SetPrinterCommand(const wxString
& command
) { m_printerCommand
= command
; }
105 void SetPrinterOptions(const wxString
& options
) { m_printerOptions
= options
; }
106 void SetPreviewCommand(const wxString
& command
) { m_previewCommand
= command
; }
107 void SetFontMetricPath(const wxString
& path
) { m_afmPath
= path
; }
108 void SetPrinterScaleX(double x
) { m_printerScaleX
= x
; }
109 void SetPrinterScaleY(double y
) { m_printerScaleY
= y
; }
110 void SetPrinterScaling(double x
, double y
) { m_printerScaleX
= x
; m_printerScaleY
= y
; }
111 void SetPrinterTranslateX(long x
) { m_printerTranslateX
= x
; }
112 void SetPrinterTranslateY(long y
) { m_printerTranslateY
= y
; }
113 void SetPrinterTranslation(long x
, long y
) { m_printerTranslateX
= x
; m_printerTranslateY
= y
; }
116 wxOutputStream
*GetOutputStream() { return m_outputStream
; }
117 void SetOutputStream( wxOutputStream
*output
) { m_outputStream
= output
; }
121 wxString m_printerCommand
;
122 wxString m_previewCommand
;
123 wxString m_printerOptions
;
125 double m_printerScaleX
;
126 double m_printerScaleY
;
127 long m_printerTranslateX
;
128 long m_printerTranslateY
;
130 wxOutputStream
*m_outputStream
;
134 DECLARE_DYNAMIC_CLASS(wxPostScriptPrintNativeData
)
137 // ----------------------------------------------------------------------------
138 // Simulated Print and Print Setup dialogs for non-Windows platforms (and
139 // Windows using PostScript print/preview)
140 // ----------------------------------------------------------------------------
142 class WXDLLEXPORT wxGenericPrintDialog
: public wxPrintDialogBase
145 wxGenericPrintDialog(wxWindow
*parent
,
146 wxPrintDialogData
* data
= (wxPrintDialogData
*)NULL
);
147 wxGenericPrintDialog(wxWindow
*parent
, wxPrintData
* data
);
149 virtual ~wxGenericPrintDialog();
151 void OnSetup(wxCommandEvent
& event
);
152 void OnRange(wxCommandEvent
& event
);
153 void OnOK(wxCommandEvent
& event
);
155 virtual bool TransferDataFromWindow();
156 virtual bool TransferDataToWindow();
158 virtual int ShowModal();
160 wxPrintData
& GetPrintData()
161 { return m_printDialogData
.GetPrintData(); }
163 wxPrintDialogData
& GetPrintDialogData() { return m_printDialogData
; }
167 // wxStaticText* m_printerMessage;
168 wxButton
* m_setupButton
;
169 // wxButton* m_helpButton;
170 wxRadioBox
* m_rangeRadioBox
;
171 wxTextCtrl
* m_fromText
;
172 wxTextCtrl
* m_toText
;
173 wxTextCtrl
* m_noCopiesText
;
174 wxCheckBox
* m_printToFileCheckBox
;
175 // wxCheckBox* m_collateCopiesCheckBox;
177 wxPrintDialogData m_printDialogData
;
180 void Init(wxWindow
*parent
);
183 DECLARE_EVENT_TABLE()
184 DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog
)
187 class WXDLLEXPORT wxGenericPrintSetupDialog
: public wxDialog
190 // There are no configuration options for the dialog, so we
191 // just pass the wxPrintData object (no wxPrintSetupDialogData class needed)
192 wxGenericPrintSetupDialog(wxWindow
*parent
, wxPrintData
* data
);
193 virtual ~wxGenericPrintSetupDialog();
195 void Init(wxPrintData
* data
);
197 void OnPrinter(wxListEvent
& event
);
199 virtual bool TransferDataFromWindow();
200 virtual bool TransferDataToWindow();
202 virtual wxComboBox
*CreatePaperTypeChoice();
205 wxListCtrl
* m_printerListCtrl
;
206 wxRadioBox
* m_orientationRadioBox
;
207 wxTextCtrl
* m_printerCommandText
;
208 wxTextCtrl
* m_printerOptionsText
;
209 wxCheckBox
* m_colourCheckBox
;
210 wxComboBox
* m_paperTypeChoice
;
212 wxPrintData m_printData
;
213 wxPrintData
& GetPrintData() { return m_printData
; }
215 // After pressing OK, write data here.
216 wxPrintData
* m_targetData
;
219 DECLARE_EVENT_TABLE()
220 DECLARE_CLASS(wxGenericPrintSetupDialog
)
225 class WXDLLEXPORT wxGenericPageSetupDialog
: public wxPageSetupDialogBase
228 wxGenericPageSetupDialog(wxWindow
*parent
= NULL
,
229 wxPageSetupDialogData
* data
= NULL
);
230 virtual ~wxGenericPageSetupDialog();
232 virtual bool TransferDataFromWindow();
233 virtual bool TransferDataToWindow();
235 virtual wxPageSetupDialogData
& GetPageSetupDialogData();
237 void OnPrinter(wxCommandEvent
& event
);
238 wxComboBox
*CreatePaperTypeChoice(int* x
, int* y
);
241 wxButton
* m_printerButton
;
242 wxRadioBox
* m_orientationRadioBox
;
243 wxTextCtrl
* m_marginLeftText
;
244 wxTextCtrl
* m_marginTopText
;
245 wxTextCtrl
* m_marginRightText
;
246 wxTextCtrl
* m_marginBottomText
;
247 wxComboBox
* m_paperTypeChoice
;
249 wxPageSetupDialogData m_pageData
;
252 DECLARE_EVENT_TABLE()
253 DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericPageSetupDialog
)