]>
Commit | Line | Data |
---|---|---|
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 | #include "wx/dc.h" | |
27 | #if wxUSE_POSTSCRIPT | |
28 | #include "wx/dcps.h" | |
29 | #endif | |
30 | ||
31 | class WXDLLIMPEXP_FWD_CORE wxTextCtrl; | |
32 | class WXDLLIMPEXP_FWD_CORE wxButton; | |
33 | class WXDLLIMPEXP_FWD_CORE wxCheckBox; | |
34 | class WXDLLIMPEXP_FWD_CORE wxComboBox; | |
35 | class WXDLLIMPEXP_FWD_CORE wxStaticText; | |
36 | class WXDLLIMPEXP_FWD_CORE wxRadioBox; | |
37 | class WXDLLIMPEXP_FWD_CORE wxPageSetupData; | |
38 | ||
39 | // ---------------------------------------------------------------------------- | |
40 | // constants | |
41 | // ---------------------------------------------------------------------------- | |
42 | ||
43 | // This is not clear why all these enums start with 10 or 30 but do not change it | |
44 | // without good reason to avoid some subtle backwards compatibility breakage | |
45 | ||
46 | enum | |
47 | { | |
48 | wxPRINTID_STATIC = 10, | |
49 | wxPRINTID_RANGE, | |
50 | wxPRINTID_FROM, | |
51 | wxPRINTID_TO, | |
52 | wxPRINTID_COPIES, | |
53 | wxPRINTID_PRINTTOFILE, | |
54 | wxPRINTID_SETUP | |
55 | }; | |
56 | ||
57 | enum | |
58 | { | |
59 | wxPRINTID_LEFTMARGIN = 30, | |
60 | wxPRINTID_RIGHTMARGIN, | |
61 | wxPRINTID_TOPMARGIN, | |
62 | wxPRINTID_BOTTOMMARGIN | |
63 | }; | |
64 | ||
65 | enum | |
66 | { | |
67 | wxPRINTID_PRINTCOLOUR = 10, | |
68 | wxPRINTID_ORIENTATION, | |
69 | wxPRINTID_COMMAND, | |
70 | wxPRINTID_OPTIONS, | |
71 | wxPRINTID_PAPERSIZE, | |
72 | wxPRINTID_PRINTER | |
73 | }; | |
74 | ||
75 | #if wxUSE_POSTSCRIPT | |
76 | ||
77 | //---------------------------------------------------------------------------- | |
78 | // wxPostScriptNativeData | |
79 | //---------------------------------------------------------------------------- | |
80 | ||
81 | class WXDLLEXPORT wxPostScriptPrintNativeData: public wxPrintNativeDataBase | |
82 | { | |
83 | public: | |
84 | wxPostScriptPrintNativeData(); | |
85 | virtual ~wxPostScriptPrintNativeData(); | |
86 | ||
87 | virtual bool TransferTo( wxPrintData &data ); | |
88 | virtual bool TransferFrom( const wxPrintData &data ); | |
89 | ||
90 | virtual bool Ok() const { return IsOk(); } | |
91 | virtual bool IsOk() const { return true; } | |
92 | ||
93 | const wxString& GetPrinterCommand() const { return m_printerCommand; } | |
94 | const wxString& GetPrinterOptions() const { return m_printerOptions; } | |
95 | const wxString& GetPreviewCommand() const { return m_previewCommand; } | |
96 | const wxString& GetFontMetricPath() const { return m_afmPath; } | |
97 | double GetPrinterScaleX() const { return m_printerScaleX; } | |
98 | double GetPrinterScaleY() const { return m_printerScaleY; } | |
99 | long GetPrinterTranslateX() const { return m_printerTranslateX; } | |
100 | long GetPrinterTranslateY() const { return m_printerTranslateY; } | |
101 | ||
102 | void SetPrinterCommand(const wxString& command) { m_printerCommand = command; } | |
103 | void SetPrinterOptions(const wxString& options) { m_printerOptions = options; } | |
104 | void SetPreviewCommand(const wxString& command) { m_previewCommand = command; } | |
105 | void SetFontMetricPath(const wxString& path) { m_afmPath = path; } | |
106 | void SetPrinterScaleX(double x) { m_printerScaleX = x; } | |
107 | void SetPrinterScaleY(double y) { m_printerScaleY = y; } | |
108 | void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; } | |
109 | void SetPrinterTranslateX(long x) { m_printerTranslateX = x; } | |
110 | void SetPrinterTranslateY(long y) { m_printerTranslateY = y; } | |
111 | void SetPrinterTranslation(long x, long y) { m_printerTranslateX = x; m_printerTranslateY = y; } | |
112 | ||
113 | #if wxUSE_STREAMS | |
114 | wxOutputStream *GetOutputStream() { return m_outputStream; } | |
115 | void SetOutputStream( wxOutputStream *output ) { m_outputStream = output; } | |
116 | #endif | |
117 | ||
118 | private: | |
119 | wxString m_printerCommand; | |
120 | wxString m_previewCommand; | |
121 | wxString m_printerOptions; | |
122 | wxString m_afmPath; | |
123 | double m_printerScaleX; | |
124 | double m_printerScaleY; | |
125 | long m_printerTranslateX; | |
126 | long m_printerTranslateY; | |
127 | #if wxUSE_STREAMS | |
128 | wxOutputStream *m_outputStream; | |
129 | #endif | |
130 | ||
131 | private: | |
132 | DECLARE_DYNAMIC_CLASS(wxPostScriptPrintNativeData) | |
133 | }; | |
134 | ||
135 | // ---------------------------------------------------------------------------- | |
136 | // Simulated Print and Print Setup dialogs for non-Windows platforms (and | |
137 | // Windows using PostScript print/preview) | |
138 | // ---------------------------------------------------------------------------- | |
139 | ||
140 | class WXDLLEXPORT wxGenericPrintDialog : public wxPrintDialogBase | |
141 | { | |
142 | public: | |
143 | wxGenericPrintDialog(wxWindow *parent, | |
144 | wxPrintDialogData* data = (wxPrintDialogData*)NULL); | |
145 | wxGenericPrintDialog(wxWindow *parent, wxPrintData* data); | |
146 | ||
147 | virtual ~wxGenericPrintDialog(); | |
148 | ||
149 | void OnSetup(wxCommandEvent& event); | |
150 | void OnRange(wxCommandEvent& event); | |
151 | void OnOK(wxCommandEvent& event); | |
152 | ||
153 | virtual bool TransferDataFromWindow(); | |
154 | virtual bool TransferDataToWindow(); | |
155 | ||
156 | virtual int ShowModal(); | |
157 | ||
158 | wxPrintData& GetPrintData() | |
159 | { return m_printDialogData.GetPrintData(); } | |
160 | ||
161 | wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; } | |
162 | wxDC *GetPrintDC(); | |
163 | ||
164 | public: | |
165 | // wxStaticText* m_printerMessage; | |
166 | wxButton* m_setupButton; | |
167 | // wxButton* m_helpButton; | |
168 | wxRadioBox* m_rangeRadioBox; | |
169 | wxTextCtrl* m_fromText; | |
170 | wxTextCtrl* m_toText; | |
171 | wxTextCtrl* m_noCopiesText; | |
172 | wxCheckBox* m_printToFileCheckBox; | |
173 | // wxCheckBox* m_collateCopiesCheckBox; | |
174 | ||
175 | wxPrintDialogData m_printDialogData; | |
176 | ||
177 | protected: | |
178 | void Init(wxWindow *parent); | |
179 | ||
180 | private: | |
181 | DECLARE_EVENT_TABLE() | |
182 | DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog) | |
183 | }; | |
184 | ||
185 | class WXDLLEXPORT wxGenericPrintSetupDialog : public wxDialog | |
186 | { | |
187 | public: | |
188 | // There are no configuration options for the dialog, so we | |
189 | // just pass the wxPrintData object (no wxPrintSetupDialogData class needed) | |
190 | wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data); | |
191 | virtual ~wxGenericPrintSetupDialog(); | |
192 | ||
193 | void Init(wxPrintData* data); | |
194 | ||
195 | void OnPrinter(wxListEvent& event); | |
196 | ||
197 | virtual bool TransferDataFromWindow(); | |
198 | virtual bool TransferDataToWindow(); | |
199 | ||
200 | virtual wxComboBox *CreatePaperTypeChoice(); | |
201 | ||
202 | public: | |
203 | wxListCtrl* m_printerListCtrl; | |
204 | wxRadioBox* m_orientationRadioBox; | |
205 | wxTextCtrl* m_printerCommandText; | |
206 | wxTextCtrl* m_printerOptionsText; | |
207 | wxCheckBox* m_colourCheckBox; | |
208 | wxComboBox* m_paperTypeChoice; | |
209 | ||
210 | wxPrintData m_printData; | |
211 | wxPrintData& GetPrintData() { return m_printData; } | |
212 | ||
213 | // After pressing OK, write data here. | |
214 | wxPrintData* m_targetData; | |
215 | ||
216 | private: | |
217 | DECLARE_EVENT_TABLE() | |
218 | DECLARE_CLASS(wxGenericPrintSetupDialog) | |
219 | }; | |
220 | #endif | |
221 | // wxUSE_POSTSCRIPT | |
222 | ||
223 | class WXDLLEXPORT wxGenericPageSetupDialog : public wxPageSetupDialogBase | |
224 | { | |
225 | public: | |
226 | wxGenericPageSetupDialog(wxWindow *parent = NULL, | |
227 | wxPageSetupDialogData* data = NULL); | |
228 | virtual ~wxGenericPageSetupDialog(); | |
229 | ||
230 | virtual bool TransferDataFromWindow(); | |
231 | virtual bool TransferDataToWindow(); | |
232 | ||
233 | virtual wxPageSetupDialogData& GetPageSetupDialogData(); | |
234 | ||
235 | void OnPrinter(wxCommandEvent& event); | |
236 | wxComboBox *CreatePaperTypeChoice(int* x, int* y); | |
237 | ||
238 | public: | |
239 | wxButton* m_printerButton; | |
240 | wxRadioBox* m_orientationRadioBox; | |
241 | wxTextCtrl* m_marginLeftText; | |
242 | wxTextCtrl* m_marginTopText; | |
243 | wxTextCtrl* m_marginRightText; | |
244 | wxTextCtrl* m_marginBottomText; | |
245 | wxComboBox* m_paperTypeChoice; | |
246 | ||
247 | wxPageSetupDialogData m_pageData; | |
248 | ||
249 | private: | |
250 | DECLARE_EVENT_TABLE() | |
251 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericPageSetupDialog) | |
252 | }; | |
253 | ||
254 | #endif | |
255 | ||
256 | #endif | |
257 | // __PRINTDLGH_G_ |