]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/prntdlgg.h
Allow MSW Base be usable in other ports than wxMSW (ie. wxTVision in windows console...
[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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
17 #pragma interface "prntdlgg.h"
18 #endif
19
20 #include "wx/defs.h"
21
22 #if wxUSE_PRINTING_ARCHITECTURE
23
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"
29
30 #if wxUSE_POSTSCRIPT
31 #include "wx/dcps.h"
32 #endif
33
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;
41
42 // ----------------------------------------------------------------------------
43 // constants
44 // ----------------------------------------------------------------------------
45
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
48
49 enum
50 {
51 wxPRINTID_STATIC = 10,
52 wxPRINTID_RANGE,
53 wxPRINTID_FROM,
54 wxPRINTID_TO,
55 wxPRINTID_COPIES,
56 wxPRINTID_PRINTTOFILE,
57 wxPRINTID_SETUP
58 };
59
60 enum
61 {
62 wxPRINTID_LEFTMARGIN = 30,
63 wxPRINTID_RIGHTMARGIN,
64 wxPRINTID_TOPMARGIN,
65 wxPRINTID_BOTTOMMARGIN
66 };
67
68 enum
69 {
70 wxPRINTID_PRINTCOLOUR = 10,
71 wxPRINTID_ORIENTATION,
72 wxPRINTID_COMMAND,
73 wxPRINTID_OPTIONS,
74 wxPRINTID_PAPERSIZE,
75 wxPRINTID_PRINTER
76 };
77
78 #if wxUSE_POSTSCRIPT
79
80 //----------------------------------------------------------------------------
81 // wxPostScriptNativeData
82 //----------------------------------------------------------------------------
83
84 class WXDLLEXPORT wxPostScriptPrintNativeData: public wxPrintNativeDataBase
85 {
86 public:
87 wxPostScriptPrintNativeData();
88 virtual ~wxPostScriptPrintNativeData();
89
90 virtual bool TransferTo( wxPrintData &data );
91 virtual bool TransferFrom( const wxPrintData &data );
92
93 virtual bool Ok() const { return true; }
94
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; }
103
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; }
114
115 #if wxUSE_STREAMS
116 wxOutputStream *GetOutputStream() { return m_outputStream; }
117 void SetOutputStream( wxOutputStream *output ) { m_outputStream = output; }
118 #endif
119
120 private:
121 wxString m_printerCommand;
122 wxString m_previewCommand;
123 wxString m_printerOptions;
124 wxString m_afmPath;
125 double m_printerScaleX;
126 double m_printerScaleY;
127 long m_printerTranslateX;
128 long m_printerTranslateY;
129 #if wxUSE_STREAMS
130 wxOutputStream *m_outputStream;
131 #endif
132
133 private:
134 DECLARE_DYNAMIC_CLASS(wxPostScriptPrintNativeData)
135 };
136
137 // ----------------------------------------------------------------------------
138 // Simulated Print and Print Setup dialogs for non-Windows platforms (and
139 // Windows using PostScript print/preview)
140 // ----------------------------------------------------------------------------
141
142 class WXDLLEXPORT wxGenericPrintDialog : public wxPrintDialogBase
143 {
144 public:
145 wxGenericPrintDialog(wxWindow *parent,
146 wxPrintDialogData* data = (wxPrintDialogData*)NULL);
147 wxGenericPrintDialog(wxWindow *parent, wxPrintData* data);
148
149 virtual ~wxGenericPrintDialog();
150
151 void OnSetup(wxCommandEvent& event);
152 void OnRange(wxCommandEvent& event);
153 void OnOK(wxCommandEvent& event);
154
155 virtual bool TransferDataFromWindow();
156 virtual bool TransferDataToWindow();
157
158 virtual int ShowModal();
159
160 wxPrintData& GetPrintData()
161 { return m_printDialogData.GetPrintData(); }
162
163 wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; }
164 wxDC *GetPrintDC();
165
166 public:
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;
176
177 wxPrintDialogData m_printDialogData;
178
179 protected:
180 void Init(wxWindow *parent);
181
182 private:
183 DECLARE_EVENT_TABLE()
184 DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog)
185 };
186
187 class WXDLLEXPORT wxGenericPrintSetupDialog : public wxDialog
188 {
189 public:
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();
194
195 void Init(wxPrintData* data);
196
197 void OnPrinter(wxListEvent& event);
198
199 virtual bool TransferDataFromWindow();
200 virtual bool TransferDataToWindow();
201
202 virtual wxComboBox *CreatePaperTypeChoice();
203
204 public:
205 wxListCtrl* m_printerListCtrl;
206 wxRadioBox* m_orientationRadioBox;
207 wxTextCtrl* m_printerCommandText;
208 wxTextCtrl* m_printerOptionsText;
209 wxCheckBox* m_colourCheckBox;
210 wxComboBox* m_paperTypeChoice;
211
212 wxPrintData m_printData;
213 wxPrintData& GetPrintData() { return m_printData; }
214
215 // After pressing OK, write data here.
216 wxPrintData* m_targetData;
217
218 private:
219 DECLARE_EVENT_TABLE()
220 DECLARE_CLASS(wxGenericPrintSetupDialog)
221 };
222 #endif
223 // wxUSE_POSTSCRIPT
224
225 class WXDLLEXPORT wxGenericPageSetupDialog : public wxPageSetupDialogBase
226 {
227 public:
228 wxGenericPageSetupDialog(wxWindow *parent = NULL,
229 wxPageSetupDialogData* data = NULL);
230 virtual ~wxGenericPageSetupDialog();
231
232 virtual bool TransferDataFromWindow();
233 virtual bool TransferDataToWindow();
234
235 virtual wxPageSetupDialogData& GetPageSetupDialogData();
236
237 void OnPrinter(wxCommandEvent& event);
238 wxComboBox *CreatePaperTypeChoice(int* x, int* y);
239
240 public:
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;
248
249 wxPageSetupDialogData m_pageData;
250
251 private:
252 DECLARE_EVENT_TABLE()
253 DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericPageSetupDialog)
254 };
255
256 #endif
257
258 #endif
259 // __PRINTDLGH_G_