]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/prntdlgg.h
correcting import/export (_adv gave linking errors)
[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 WXDLLIMPEXP_FWD_CORE wxTextCtrl;
31 class WXDLLIMPEXP_FWD_CORE wxButton;
32 class WXDLLIMPEXP_FWD_CORE wxCheckBox;
33 class WXDLLIMPEXP_FWD_CORE wxComboBox;
34 class WXDLLIMPEXP_FWD_CORE wxStaticText;
35 class WXDLLIMPEXP_FWD_CORE wxRadioBox;
36 class WXDLLIMPEXP_FWD_CORE 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 IsOk(); }
90 virtual bool IsOk() const { return true; }
91
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; }
100
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; }
111
112 #if wxUSE_STREAMS
113 wxOutputStream *GetOutputStream() { return m_outputStream; }
114 void SetOutputStream( wxOutputStream *output ) { m_outputStream = output; }
115 #endif
116
117 private:
118 wxString m_printerCommand;
119 wxString m_previewCommand;
120 wxString m_printerOptions;
121 wxString m_afmPath;
122 double m_printerScaleX;
123 double m_printerScaleY;
124 long m_printerTranslateX;
125 long m_printerTranslateY;
126 #if wxUSE_STREAMS
127 wxOutputStream *m_outputStream;
128 #endif
129
130 private:
131 DECLARE_DYNAMIC_CLASS(wxPostScriptPrintNativeData)
132 };
133
134 // ----------------------------------------------------------------------------
135 // Simulated Print and Print Setup dialogs for non-Windows platforms (and
136 // Windows using PostScript print/preview)
137 // ----------------------------------------------------------------------------
138
139 class WXDLLEXPORT wxGenericPrintDialog : public wxPrintDialogBase
140 {
141 public:
142 wxGenericPrintDialog(wxWindow *parent,
143 wxPrintDialogData* data = (wxPrintDialogData*)NULL);
144 wxGenericPrintDialog(wxWindow *parent, wxPrintData* data);
145
146 virtual ~wxGenericPrintDialog();
147
148 void OnSetup(wxCommandEvent& event);
149 void OnRange(wxCommandEvent& event);
150 void OnOK(wxCommandEvent& event);
151
152 virtual bool TransferDataFromWindow();
153 virtual bool TransferDataToWindow();
154
155 virtual int ShowModal();
156
157 wxPrintData& GetPrintData()
158 { return m_printDialogData.GetPrintData(); }
159
160 wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; }
161 wxDC *GetPrintDC();
162
163 public:
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;
173
174 wxPrintDialogData m_printDialogData;
175
176 protected:
177 void Init(wxWindow *parent);
178
179 private:
180 DECLARE_EVENT_TABLE()
181 DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog)
182 };
183
184 class WXDLLEXPORT wxGenericPrintSetupDialog : public wxDialog
185 {
186 public:
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();
191
192 void Init(wxPrintData* data);
193
194 void OnPrinter(wxListEvent& event);
195
196 virtual bool TransferDataFromWindow();
197 virtual bool TransferDataToWindow();
198
199 virtual wxComboBox *CreatePaperTypeChoice();
200
201 public:
202 wxListCtrl* m_printerListCtrl;
203 wxRadioBox* m_orientationRadioBox;
204 wxTextCtrl* m_printerCommandText;
205 wxTextCtrl* m_printerOptionsText;
206 wxCheckBox* m_colourCheckBox;
207 wxComboBox* m_paperTypeChoice;
208
209 wxPrintData m_printData;
210 wxPrintData& GetPrintData() { return m_printData; }
211
212 // After pressing OK, write data here.
213 wxPrintData* m_targetData;
214
215 private:
216 DECLARE_EVENT_TABLE()
217 DECLARE_CLASS(wxGenericPrintSetupDialog)
218 };
219 #endif
220 // wxUSE_POSTSCRIPT
221
222 class WXDLLEXPORT wxGenericPageSetupDialog : public wxPageSetupDialogBase
223 {
224 public:
225 wxGenericPageSetupDialog(wxWindow *parent = NULL,
226 wxPageSetupDialogData* data = NULL);
227 virtual ~wxGenericPageSetupDialog();
228
229 virtual bool TransferDataFromWindow();
230 virtual bool TransferDataToWindow();
231
232 virtual wxPageSetupDialogData& GetPageSetupDialogData();
233
234 void OnPrinter(wxCommandEvent& event);
235 wxComboBox *CreatePaperTypeChoice(int* x, int* y);
236
237 public:
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;
245
246 wxPageSetupDialogData m_pageData;
247
248 private:
249 DECLARE_EVENT_TABLE()
250 DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericPageSetupDialog)
251 };
252
253 #endif
254
255 #endif
256 // __PRINTDLGH_G_