]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
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$ | |
99d80019 | 9 | // Copyright: (c) Julian Smart |
65571936 | 10 | // Licence: wxWindows licence |
c801d85f KB |
11 | ///////////////////////////////////////////////////////////////////////////// |
12 | ||
13 | #ifndef __PRINTDLGH_G_ | |
14 | #define __PRINTDLGH_G_ | |
15 | ||
12028905 | 16 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
d6b9496a | 17 | #pragma interface "prntdlgg.h" |
c801d85f KB |
18 | #endif |
19 | ||
20 | #include "wx/defs.h" | |
ce4169a4 RR |
21 | |
22 | #if wxUSE_PRINTING_ARCHITECTURE | |
23 | ||
bf38cbff | 24 | #include "wx/dialog.h" |
d7a7bd6d | 25 | #include "wx/cmndata.h" |
8850cbd3 | 26 | #include "wx/prntbase.h" |
c061373d | 27 | #include "wx/printdlg.h" |
2c84e0c2 | 28 | #include "wx/listctrl.h" |
bf38cbff JS |
29 | |
30 | #if wxUSE_POSTSCRIPT | |
d6b9496a | 31 | #include "wx/dcps.h" |
bf38cbff | 32 | #endif |
c801d85f KB |
33 | |
34 | class WXDLLEXPORT wxTextCtrl; | |
35 | class WXDLLEXPORT wxButton; | |
36 | class WXDLLEXPORT wxCheckBox; | |
fa12f7e6 | 37 | class WXDLLEXPORT wxComboBox; |
c801d85f KB |
38 | class WXDLLEXPORT wxStaticText; |
39 | class WXDLLEXPORT wxRadioBox; | |
43330cc9 | 40 | class WXDLLEXPORT wxPageSetupData; |
8850cbd3 | 41 | |
d6b9496a VZ |
42 | // ---------------------------------------------------------------------------- |
43 | // constants | |
44 | // ---------------------------------------------------------------------------- | |
c801d85f | 45 | |
5c750f94 WS |
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 | |
c801d85f | 48 | |
d6b9496a VZ |
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, | |
2c84e0c2 RR |
74 | wxPRINTID_PAPERSIZE, |
75 | wxPRINTID_PRINTER | |
d6b9496a VZ |
76 | }; |
77 | ||
8850cbd3 RR |
78 | #if wxUSE_POSTSCRIPT |
79 | ||
80 | //---------------------------------------------------------------------------- | |
81 | // wxPostScriptNativeData | |
82 | //---------------------------------------------------------------------------- | |
83 | ||
84 | class WXDLLEXPORT wxPostScriptPrintNativeData: public wxPrintNativeDataBase | |
85 | { | |
86 | public: | |
87 | wxPostScriptPrintNativeData(); | |
88 | virtual ~wxPostScriptPrintNativeData(); | |
5c750f94 | 89 | |
fd64de59 RR |
90 | virtual bool TransferTo( wxPrintData &data ); |
91 | virtual bool TransferFrom( const wxPrintData &data ); | |
5c750f94 | 92 | |
8850cbd3 | 93 | virtual bool Ok() const { return true; } |
5c750f94 | 94 | |
8850cbd3 RR |
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; } | |
8850cbd3 RR |
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; } | |
8850cbd3 RR |
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; | |
8850cbd3 RR |
129 | #if wxUSE_STREAMS |
130 | wxOutputStream *m_outputStream; | |
131 | #endif | |
5c750f94 | 132 | |
8850cbd3 RR |
133 | private: |
134 | DECLARE_DYNAMIC_CLASS(wxPostScriptPrintNativeData) | |
135 | }; | |
5c750f94 | 136 | |
d6b9496a VZ |
137 | // ---------------------------------------------------------------------------- |
138 | // Simulated Print and Print Setup dialogs for non-Windows platforms (and | |
139 | // Windows using PostScript print/preview) | |
140 | // ---------------------------------------------------------------------------- | |
141 | ||
c061373d | 142 | class WXDLLEXPORT wxGenericPrintDialog : public wxPrintDialogBase |
c801d85f | 143 | { |
7bcb11d3 | 144 | public: |
d6b9496a VZ |
145 | wxGenericPrintDialog(wxWindow *parent, |
146 | wxPrintDialogData* data = (wxPrintDialogData*)NULL); | |
147 | wxGenericPrintDialog(wxWindow *parent, wxPrintData* data); | |
148 | ||
149 | virtual ~wxGenericPrintDialog(); | |
7bcb11d3 JS |
150 | |
151 | void OnSetup(wxCommandEvent& event); | |
152 | void OnRange(wxCommandEvent& event); | |
153 | void OnOK(wxCommandEvent& event); | |
d6b9496a | 154 | |
7bcb11d3 JS |
155 | virtual bool TransferDataFromWindow(); |
156 | virtual bool TransferDataToWindow(); | |
157 | ||
158 | virtual int ShowModal(); | |
159 | ||
d6b9496a VZ |
160 | wxPrintData& GetPrintData() |
161 | { return m_printDialogData.GetPrintData(); } | |
d6b9496a VZ |
162 | |
163 | wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; } | |
7bcb11d3 JS |
164 | wxDC *GetPrintDC(); |
165 | ||
166 | public: | |
58a33cb4 | 167 | // wxStaticText* m_printerMessage; |
7bcb11d3 | 168 | wxButton* m_setupButton; |
58a33cb4 | 169 | // wxButton* m_helpButton; |
7bcb11d3 JS |
170 | wxRadioBox* m_rangeRadioBox; |
171 | wxTextCtrl* m_fromText; | |
172 | wxTextCtrl* m_toText; | |
173 | wxTextCtrl* m_noCopiesText; | |
174 | wxCheckBox* m_printToFileCheckBox; | |
58a33cb4 | 175 | // wxCheckBox* m_collateCopiesCheckBox; |
d6b9496a | 176 | |
7bcb11d3 | 177 | wxPrintDialogData m_printDialogData; |
d6b9496a VZ |
178 | |
179 | protected: | |
180 | void Init(wxWindow *parent); | |
181 | ||
182 | private: | |
7bcb11d3 | 183 | DECLARE_EVENT_TABLE() |
47dc9f78 | 184 | DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog) |
c801d85f KB |
185 | }; |
186 | ||
d6b9496a | 187 | class WXDLLEXPORT wxGenericPrintSetupDialog : public wxDialog |
c801d85f | 188 | { |
7bcb11d3 JS |
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); | |
d6b9496a | 193 | virtual ~wxGenericPrintSetupDialog(); |
7bcb11d3 JS |
194 | |
195 | void Init(wxPrintData* data); | |
196 | ||
2c84e0c2 | 197 | void OnPrinter(wxListEvent& event); |
5c750f94 | 198 | |
7bcb11d3 JS |
199 | virtual bool TransferDataFromWindow(); |
200 | virtual bool TransferDataToWindow(); | |
201 | ||
6038ec8e | 202 | virtual wxComboBox *CreatePaperTypeChoice(); |
d6b9496a | 203 | |
7bcb11d3 | 204 | public: |
2c84e0c2 | 205 | wxListCtrl* m_printerListCtrl; |
7bcb11d3 JS |
206 | wxRadioBox* m_orientationRadioBox; |
207 | wxTextCtrl* m_printerCommandText; | |
208 | wxTextCtrl* m_printerOptionsText; | |
209 | wxCheckBox* m_colourCheckBox; | |
2c84e0c2 | 210 | wxComboBox* m_paperTypeChoice; |
d6b9496a | 211 | |
7bcb11d3 | 212 | wxPrintData m_printData; |
d6b9496a | 213 | wxPrintData& GetPrintData() { return m_printData; } |
5c750f94 | 214 | |
2c84e0c2 RR |
215 | // After pressing OK, write data here. |
216 | wxPrintData* m_targetData; | |
47dc9f78 RR |
217 | |
218 | private: | |
2c84e0c2 | 219 | DECLARE_EVENT_TABLE() |
47dc9f78 | 220 | DECLARE_CLASS(wxGenericPrintSetupDialog) |
c801d85f | 221 | }; |
25889d3c JS |
222 | #endif |
223 | // wxUSE_POSTSCRIPT | |
c801d85f | 224 | |
08680429 | 225 | class WXDLLEXPORT wxGenericPageSetupDialog : public wxPageSetupDialogBase |
c801d85f | 226 | { |
7bcb11d3 | 227 | public: |
47494677 | 228 | wxGenericPageSetupDialog(wxWindow *parent = NULL, |
08680429 | 229 | wxPageSetupDialogData* data = NULL); |
d6b9496a | 230 | virtual ~wxGenericPageSetupDialog(); |
7bcb11d3 JS |
231 | |
232 | virtual bool TransferDataFromWindow(); | |
233 | virtual bool TransferDataToWindow(); | |
234 | ||
08680429 | 235 | virtual wxPageSetupDialogData& GetPageSetupDialogData(); |
d6b9496a | 236 | |
08680429 | 237 | void OnPrinter(wxCommandEvent& event); |
fa12f7e6 | 238 | wxComboBox *CreatePaperTypeChoice(int* x, int* y); |
7bcb11d3 JS |
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; | |
fa12f7e6 | 247 | wxComboBox* m_paperTypeChoice; |
d6b9496a | 248 | |
08680429 | 249 | wxPageSetupDialogData m_pageData; |
d6b9496a VZ |
250 | |
251 | private: | |
7bcb11d3 | 252 | DECLARE_EVENT_TABLE() |
47494677 | 253 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericPageSetupDialog) |
c801d85f KB |
254 | }; |
255 | ||
ce4169a4 RR |
256 | #endif |
257 | ||
c801d85f | 258 | #endif |
28181831 | 259 | // __PRINTDLGH_G_ |