]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/prntdlgg.h
00848b6e824c7114a33a69a4d6c013138c49fc2b
[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)
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
29 #if wxUSE_POSTSCRIPT
30 #include "wx/dcps.h"
31 #endif
32
33 class WXDLLEXPORT wxTextCtrl;
34 class WXDLLEXPORT wxButton;
35 class WXDLLEXPORT wxCheckBox;
36 class WXDLLEXPORT wxComboBox;
37 class WXDLLEXPORT wxStaticText;
38 class WXDLLEXPORT wxRadioBox;
39 class WXDLLEXPORT wxPrintSetupData;
40 class WXDLLEXPORT wxPageSetupData;
41
42 // ----------------------------------------------------------------------------
43 // constants
44 // ----------------------------------------------------------------------------
45
46 // FIXME why all these enums start with 10 or 30?
47
48 enum
49 {
50 wxPRINTID_STATIC = 10,
51 wxPRINTID_RANGE,
52 wxPRINTID_FROM,
53 wxPRINTID_TO,
54 wxPRINTID_COPIES,
55 wxPRINTID_PRINTTOFILE,
56 wxPRINTID_SETUP
57 };
58
59 enum
60 {
61 wxPRINTID_LEFTMARGIN = 30,
62 wxPRINTID_RIGHTMARGIN,
63 wxPRINTID_TOPMARGIN,
64 wxPRINTID_BOTTOMMARGIN
65 };
66
67 enum
68 {
69 wxPRINTID_PRINTCOLOUR = 10,
70 wxPRINTID_ORIENTATION,
71 wxPRINTID_COMMAND,
72 wxPRINTID_OPTIONS,
73 wxPRINTID_PAPERSIZE
74 };
75
76 #if wxUSE_POSTSCRIPT
77
78 //----------------------------------------------------------------------------
79 // wxPostScriptNativeData
80 //----------------------------------------------------------------------------
81
82 class WXDLLEXPORT wxPostScriptPrintNativeData: public wxPrintNativeDataBase
83 {
84 public:
85 wxPostScriptPrintNativeData();
86 virtual ~wxPostScriptPrintNativeData();
87
88 virtual bool TransferTo( wxPrintData &data );
89 virtual bool TransferFrom( const wxPrintData &data );
90
91 virtual bool Ok() 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 #if wxUSE_POSTSCRIPT
159 wxPrintData& GetPrintData()
160 { return m_printDialogData.GetPrintData(); }
161 #endif // wxUSE_POSTSCRIPT
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 wxGenericPrintSetupDialog(wxWindow *parent, wxPrintSetupData* data);
194 virtual ~wxGenericPrintSetupDialog();
195
196 void Init(wxPrintData* data);
197
198 virtual bool TransferDataFromWindow();
199 virtual bool TransferDataToWindow();
200
201 virtual wxComboBox *CreatePaperTypeChoice();
202
203 public:
204 wxRadioBox* m_orientationRadioBox;
205 wxTextCtrl* m_printerCommandText;
206 wxTextCtrl* m_printerOptionsText;
207 wxCheckBox* m_colourCheckBox;
208 wxComboBox* m_paperTypeChoice;
209
210 #if wxUSE_POSTSCRIPT
211 wxPrintData m_printData;
212 wxPrintData& GetPrintData() { return m_printData; }
213 #endif // wxUSE_POSTSCRIPT
214
215 private:
216 DECLARE_CLASS(wxGenericPrintSetupDialog)
217 };
218 #endif
219 // wxUSE_POSTSCRIPT
220
221 class WXDLLEXPORT wxGenericPageSetupDialog : public wxDialog
222 {
223 public:
224 wxGenericPageSetupDialog(wxWindow *parent = NULL,
225 wxPageSetupData* data = NULL);
226 virtual ~wxGenericPageSetupDialog();
227
228 virtual bool TransferDataFromWindow();
229 virtual bool TransferDataToWindow();
230
231 void OnPrinter(wxCommandEvent& event);
232
233 wxComboBox *CreatePaperTypeChoice(int* x, int* y);
234 wxPageSetupData& GetPageSetupData() { return m_pageData; }
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 static bool m_pageSetupDialogCancelled;
246
247 wxPageSetupData 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__