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 true; }
91 const wxString
& GetPrinterCommand() const { return m_printerCommand
; }
92 const wxString
& GetPrinterOptions() const { return m_printerOptions
; }
93 const wxString
& GetPreviewCommand() const { return m_previewCommand
; }
94 const wxString
& GetFontMetricPath() const { return m_afmPath
; }
95 double GetPrinterScaleX() const { return m_printerScaleX
; }
96 double GetPrinterScaleY() const { return m_printerScaleY
; }
97 long GetPrinterTranslateX() const { return m_printerTranslateX
; }
98 long GetPrinterTranslateY() const { return m_printerTranslateY
; }
100 void SetPrinterCommand(const wxString
& command
) { m_printerCommand
= command
; }
101 void SetPrinterOptions(const wxString
& options
) { m_printerOptions
= options
; }
102 void SetPreviewCommand(const wxString
& command
) { m_previewCommand
= command
; }
103 void SetFontMetricPath(const wxString
& path
) { m_afmPath
= path
; }
104 void SetPrinterScaleX(double x
) { m_printerScaleX
= x
; }
105 void SetPrinterScaleY(double y
) { m_printerScaleY
= y
; }
106 void SetPrinterScaling(double x
, double y
) { m_printerScaleX
= x
; m_printerScaleY
= y
; }
107 void SetPrinterTranslateX(long x
) { m_printerTranslateX
= x
; }
108 void SetPrinterTranslateY(long y
) { m_printerTranslateY
= y
; }
109 void SetPrinterTranslation(long x
, long y
) { m_printerTranslateX
= x
; m_printerTranslateY
= y
; }
112 wxOutputStream
*GetOutputStream() { return m_outputStream
; }
113 void SetOutputStream( wxOutputStream
*output
) { m_outputStream
= output
; }
117 wxString m_printerCommand
;
118 wxString m_previewCommand
;
119 wxString m_printerOptions
;
121 double m_printerScaleX
;
122 double m_printerScaleY
;
123 long m_printerTranslateX
;
124 long m_printerTranslateY
;
126 wxOutputStream
*m_outputStream
;
130 DECLARE_DYNAMIC_CLASS(wxPostScriptPrintNativeData
)
133 // ----------------------------------------------------------------------------
134 // Simulated Print and Print Setup dialogs for non-Windows platforms (and
135 // Windows using PostScript print/preview)
136 // ----------------------------------------------------------------------------
138 class WXDLLEXPORT wxGenericPrintDialog
: public wxPrintDialogBase
141 wxGenericPrintDialog(wxWindow
*parent
,
142 wxPrintDialogData
* data
= (wxPrintDialogData
*)NULL
);
143 wxGenericPrintDialog(wxWindow
*parent
, wxPrintData
* data
);
145 virtual ~wxGenericPrintDialog();
147 void OnSetup(wxCommandEvent
& event
);
148 void OnRange(wxCommandEvent
& event
);
149 void OnOK(wxCommandEvent
& event
);
151 virtual bool TransferDataFromWindow();
152 virtual bool TransferDataToWindow();
154 virtual int ShowModal();
156 wxPrintData
& GetPrintData()
157 { return m_printDialogData
.GetPrintData(); }
159 wxPrintDialogData
& GetPrintDialogData() { return m_printDialogData
; }
163 // wxStaticText* m_printerMessage;
164 wxButton
* m_setupButton
;
165 // wxButton* m_helpButton;
166 wxRadioBox
* m_rangeRadioBox
;
167 wxTextCtrl
* m_fromText
;
168 wxTextCtrl
* m_toText
;
169 wxTextCtrl
* m_noCopiesText
;
170 wxCheckBox
* m_printToFileCheckBox
;
171 // wxCheckBox* m_collateCopiesCheckBox;
173 wxPrintDialogData m_printDialogData
;
176 void Init(wxWindow
*parent
);
179 DECLARE_EVENT_TABLE()
180 DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog
)
183 class WXDLLEXPORT wxGenericPrintSetupDialog
: public wxDialog
186 // There are no configuration options for the dialog, so we
187 // just pass the wxPrintData object (no wxPrintSetupDialogData class needed)
188 wxGenericPrintSetupDialog(wxWindow
*parent
, wxPrintData
* data
);
189 virtual ~wxGenericPrintSetupDialog();
191 void Init(wxPrintData
* data
);
193 void OnPrinter(wxListEvent
& event
);
195 virtual bool TransferDataFromWindow();
196 virtual bool TransferDataToWindow();
198 virtual wxComboBox
*CreatePaperTypeChoice();
201 wxListCtrl
* m_printerListCtrl
;
202 wxRadioBox
* m_orientationRadioBox
;
203 wxTextCtrl
* m_printerCommandText
;
204 wxTextCtrl
* m_printerOptionsText
;
205 wxCheckBox
* m_colourCheckBox
;
206 wxComboBox
* m_paperTypeChoice
;
208 wxPrintData m_printData
;
209 wxPrintData
& GetPrintData() { return m_printData
; }
211 // After pressing OK, write data here.
212 wxPrintData
* m_targetData
;
215 DECLARE_EVENT_TABLE()
216 DECLARE_CLASS(wxGenericPrintSetupDialog
)
221 class WXDLLEXPORT wxGenericPageSetupDialog
: public wxPageSetupDialogBase
224 wxGenericPageSetupDialog(wxWindow
*parent
= NULL
,
225 wxPageSetupDialogData
* data
= NULL
);
226 virtual ~wxGenericPageSetupDialog();
228 virtual bool TransferDataFromWindow();
229 virtual bool TransferDataToWindow();
231 virtual wxPageSetupDialogData
& GetPageSetupDialogData();
233 void OnPrinter(wxCommandEvent
& event
);
234 wxComboBox
*CreatePaperTypeChoice(int* x
, int* y
);
237 wxButton
* m_printerButton
;
238 wxRadioBox
* m_orientationRadioBox
;
239 wxTextCtrl
* m_marginLeftText
;
240 wxTextCtrl
* m_marginTopText
;
241 wxTextCtrl
* m_marginRightText
;
242 wxTextCtrl
* m_marginBottomText
;
243 wxComboBox
* m_paperTypeChoice
;
245 wxPageSetupDialogData m_pageData
;
248 DECLARE_EVENT_TABLE()
249 DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericPageSetupDialog
)