]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/prntdlgg.h
non-pch universal build fix: combo.h should not include combobox.h
[wxWidgets.git] / include / wx / generic / prntdlgg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: prntdlgg.h
3 // Purpose: wxGenericPrintDialog, wxGenericPrintSetupDialog,
4 // wxGenericPageSetupDialog
5 // Author: Julian Smart
6 // Modified by:
7 // Created: 01/02/97
8 // RCS-ID: $Id$
9 // Copyright: (c) Julian Smart
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
12
13 #ifndef __PRINTDLGH_G_
14 #define __PRINTDLGH_G_
15
16 #include "wx/defs.h"
17
18 #if wxUSE_PRINTING_ARCHITECTURE
19
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"
25
26 #if wxUSE_POSTSCRIPT
27 #include "wx/dcps.h"
28 #endif
29
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;
37
38 // ----------------------------------------------------------------------------
39 // constants
40 // ----------------------------------------------------------------------------
41
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
44
45 enum
46 {
47 wxPRINTID_STATIC = 10,
48 wxPRINTID_RANGE,
49 wxPRINTID_FROM,
50 wxPRINTID_TO,
51 wxPRINTID_COPIES,
52 wxPRINTID_PRINTTOFILE,
53 wxPRINTID_SETUP
54 };
55
56 enum
57 {
58 wxPRINTID_LEFTMARGIN = 30,
59 wxPRINTID_RIGHTMARGIN,
60 wxPRINTID_TOPMARGIN,
61 wxPRINTID_BOTTOMMARGIN
62 };
63
64 enum
65 {
66 wxPRINTID_PRINTCOLOUR = 10,
67 wxPRINTID_ORIENTATION,
68 wxPRINTID_COMMAND,
69 wxPRINTID_OPTIONS,
70 wxPRINTID_PAPERSIZE,
71 wxPRINTID_PRINTER
72 };
73
74 #if wxUSE_POSTSCRIPT
75
76 //----------------------------------------------------------------------------
77 // wxPostScriptNativeData
78 //----------------------------------------------------------------------------
79
80 class WXDLLEXPORT wxPostScriptPrintNativeData: public wxPrintNativeDataBase
81 {
82 public:
83 wxPostScriptPrintNativeData();
84 virtual ~wxPostScriptPrintNativeData();
85
86 virtual bool TransferTo( wxPrintData &data );
87 virtual bool TransferFrom( const wxPrintData &data );
88
89 virtual bool Ok() const { return true; }
90
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; }
99
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; }
110
111 #if wxUSE_STREAMS
112 wxOutputStream *GetOutputStream() { return m_outputStream; }
113 void SetOutputStream( wxOutputStream *output ) { m_outputStream = output; }
114 #endif
115
116 private:
117 wxString m_printerCommand;
118 wxString m_previewCommand;
119 wxString m_printerOptions;
120 wxString m_afmPath;
121 double m_printerScaleX;
122 double m_printerScaleY;
123 long m_printerTranslateX;
124 long m_printerTranslateY;
125 #if wxUSE_STREAMS
126 wxOutputStream *m_outputStream;
127 #endif
128
129 private:
130 DECLARE_DYNAMIC_CLASS(wxPostScriptPrintNativeData)
131 };
132
133 // ----------------------------------------------------------------------------
134 // Simulated Print and Print Setup dialogs for non-Windows platforms (and
135 // Windows using PostScript print/preview)
136 // ----------------------------------------------------------------------------
137
138 class WXDLLEXPORT wxGenericPrintDialog : public wxPrintDialogBase
139 {
140 public:
141 wxGenericPrintDialog(wxWindow *parent,
142 wxPrintDialogData* data = (wxPrintDialogData*)NULL);
143 wxGenericPrintDialog(wxWindow *parent, wxPrintData* data);
144
145 virtual ~wxGenericPrintDialog();
146
147 void OnSetup(wxCommandEvent& event);
148 void OnRange(wxCommandEvent& event);
149 void OnOK(wxCommandEvent& event);
150
151 virtual bool TransferDataFromWindow();
152 virtual bool TransferDataToWindow();
153
154 virtual int ShowModal();
155
156 wxPrintData& GetPrintData()
157 { return m_printDialogData.GetPrintData(); }
158
159 wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; }
160 wxDC *GetPrintDC();
161
162 public:
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;
172
173 wxPrintDialogData m_printDialogData;
174
175 protected:
176 void Init(wxWindow *parent);
177
178 private:
179 DECLARE_EVENT_TABLE()
180 DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog)
181 };
182
183 class WXDLLEXPORT wxGenericPrintSetupDialog : public wxDialog
184 {
185 public:
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();
190
191 void Init(wxPrintData* data);
192
193 void OnPrinter(wxListEvent& event);
194
195 virtual bool TransferDataFromWindow();
196 virtual bool TransferDataToWindow();
197
198 virtual wxComboBox *CreatePaperTypeChoice();
199
200 public:
201 wxListCtrl* m_printerListCtrl;
202 wxRadioBox* m_orientationRadioBox;
203 wxTextCtrl* m_printerCommandText;
204 wxTextCtrl* m_printerOptionsText;
205 wxCheckBox* m_colourCheckBox;
206 wxComboBox* m_paperTypeChoice;
207
208 wxPrintData m_printData;
209 wxPrintData& GetPrintData() { return m_printData; }
210
211 // After pressing OK, write data here.
212 wxPrintData* m_targetData;
213
214 private:
215 DECLARE_EVENT_TABLE()
216 DECLARE_CLASS(wxGenericPrintSetupDialog)
217 };
218 #endif
219 // wxUSE_POSTSCRIPT
220
221 class WXDLLEXPORT wxGenericPageSetupDialog : public wxPageSetupDialogBase
222 {
223 public:
224 wxGenericPageSetupDialog(wxWindow *parent = NULL,
225 wxPageSetupDialogData* data = NULL);
226 virtual ~wxGenericPageSetupDialog();
227
228 virtual bool TransferDataFromWindow();
229 virtual bool TransferDataToWindow();
230
231 virtual wxPageSetupDialogData& GetPageSetupDialogData();
232
233 void OnPrinter(wxCommandEvent& event);
234 wxComboBox *CreatePaperTypeChoice(int* x, int* y);
235
236 public:
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;
244
245 wxPageSetupDialogData m_pageData;
246
247 private:
248 DECLARE_EVENT_TABLE()
249 DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericPageSetupDialog)
250 };
251
252 #endif
253
254 #endif
255 // __PRINTDLGH_G_