]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
bf38cbff | 2 | // Name: dcps.h |
c801d85f KB |
3 | // Purpose: wxPostScriptDC class |
4 | // Author: Julian Smart and others | |
5 | // Modified by: | |
c801d85f | 6 | // RCS-ID: $Id$ |
bf38cbff | 7 | // Copyright: (c) Julian Smart, Robert Roebling and Markus Holzem |
a6f6393c | 8 | // Licence: wxWindows licence |
c801d85f KB |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
bf38cbff JS |
11 | #ifndef _WX_DCPSG_H_ |
12 | #define _WX_DCPSG_H_ | |
c801d85f KB |
13 | |
14 | #ifdef __GNUG__ | |
bf38cbff | 15 | #pragma interface |
c801d85f KB |
16 | #endif |
17 | ||
18 | #include "wx/dc.h" | |
c801d85f | 19 | |
ce4169a4 RR |
20 | #if wxUSE_PRINTING_ARCHITECTURE |
21 | ||
47d67540 | 22 | #if wxUSE_POSTSCRIPT |
c801d85f | 23 | |
bf38cbff JS |
24 | #include "wx/dialog.h" |
25 | #include "wx/module.h" | |
7bcb11d3 | 26 | #include "wx/cmndata.h" |
fbc535ff | 27 | |
af0bb3b1 | 28 | #include <fstream.h> |
f04371f0 | 29 | |
bf38cbff JS |
30 | //----------------------------------------------------------------------------- |
31 | // classes | |
32 | //----------------------------------------------------------------------------- | |
f04371f0 | 33 | |
bf38cbff | 34 | class wxPostScriptDC; |
f04371f0 | 35 | |
bf38cbff JS |
36 | //----------------------------------------------------------------------------- |
37 | // wxPostScriptDC | |
38 | //----------------------------------------------------------------------------- | |
f04371f0 | 39 | |
c801d85f KB |
40 | class WXDLLEXPORT wxPostScriptDC: public wxDC |
41 | { | |
42 | DECLARE_DYNAMIC_CLASS(wxPostScriptDC) | |
43 | ||
bf38cbff JS |
44 | public: |
45 | ||
a6f6393c | 46 | wxPostScriptDC(); |
7bcb11d3 JS |
47 | |
48 | // Deprecated constructor | |
c67daf87 | 49 | wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow *parent = (wxWindow *) NULL); |
c801d85f | 50 | |
7bcb11d3 JS |
51 | // Recommended constructor |
52 | wxPostScriptDC(const wxPrintData& printData); | |
53 | ||
a6f6393c | 54 | ~wxPostScriptDC(); |
c801d85f | 55 | |
7bcb11d3 | 56 | // Deprecated |
c67daf87 | 57 | bool Create(const wxString& output, bool interactive = TRUE, wxWindow *parent = (wxWindow *) NULL); |
c801d85f | 58 | |
bf38cbff JS |
59 | virtual bool Ok() const; |
60 | ||
7bcb11d3 | 61 | // Deprecated: use wxGenericPrintDialog instead |
c67daf87 | 62 | virtual bool PrinterDialog(wxWindow *parent = (wxWindow *) NULL); |
c801d85f | 63 | |
bf38cbff JS |
64 | virtual void BeginDrawing() {} |
65 | virtual void EndDrawing() {} | |
c801d85f | 66 | |
64698f9a RR |
67 | void DoFloodFill(long x1, long y1, const wxColour &col, int style=wxFLOOD_SURFACE ); |
68 | bool DoGetPixel(long x1, long y1, wxColour *col) const; | |
69 | ||
70 | void DoDrawLine(long x1, long y1, long x2, long y2); | |
71 | void DoCrossHair(long x, long y) ; | |
72 | void DoDrawArc(long x1,long y1,long x2,long y2,long xc,long yc); | |
73 | void DoDrawEllipticArc(long x,long y,long w,long h,double sa,double ea); | |
74 | void DoDrawPoint(long x, long y); | |
75 | void DoDrawLines(int n, wxPoint points[], long xoffset = 0, long yoffset = 0); | |
76 | void DoDrawPolygon(int n, wxPoint points[], long xoffset = 0, long yoffset = 0, int fillStyle=wxODDEVEN_RULE); | |
77 | void DoDrawRectangle(long x, long y, long width, long height); | |
78 | void DoDrawRoundedRectangle(long x, long y, long width, long height, double radius = 20); | |
79 | void DoDrawEllipse(long x, long y, long width, long height); | |
80 | ||
81 | void DoDrawSpline(wxList *points); | |
82 | ||
83 | bool DoBlit(long xdest, long ydest, long width, long height, | |
bf38cbff JS |
84 | wxDC *source, long xsrc, long ysrc, int rop = wxCOPY, bool useMask = FALSE); |
85 | inline bool CanDrawBitmap(void) const { return TRUE; } | |
86 | ||
64698f9a RR |
87 | void DoDrawIcon( const wxIcon& icon, long x, long y ); |
88 | void DoDrawBitmap( const wxBitmap& bitmap, long x, long y, bool useMask=FALSE ); | |
bf38cbff | 89 | |
64698f9a | 90 | void DoDrawText(const wxString& text, long x, long y ); |
c801d85f | 91 | |
a6f6393c | 92 | void Clear(); |
bf38cbff JS |
93 | void SetFont( const wxFont& font ); |
94 | void SetPen( const wxPen& pen ); | |
95 | void SetBrush( const wxBrush& brush ); | |
96 | void SetLogicalFunction( int function ); | |
97 | void SetBackground( const wxBrush& brush ); | |
98 | ||
c801d85f | 99 | void SetClippingRegion(long x, long y, long width, long height); |
463c1fa1 | 100 | void SetClippingRegion( const wxRegion ®ion ); |
a6f6393c | 101 | void DestroyClippingRegion(); |
af0bb3b1 | 102 | |
64698f9a | 103 | void DoSetClippingRegionAsRegion( const wxRegion &WXUNUSED(clip) ) {} |
c801d85f KB |
104 | |
105 | bool StartDoc(const wxString& message); | |
a6f6393c VZ |
106 | void EndDoc(); |
107 | void StartPage(); | |
108 | void EndPage(); | |
c801d85f | 109 | |
64698f9a RR |
110 | long GetCharHeight() const; |
111 | long GetCharWidth() const; | |
bf38cbff | 112 | inline bool CanGetTextExtent(void) const { return FALSE; } |
c801d85f | 113 | void GetTextExtent(const wxString& string, long *x, long *y, |
a6f6393c VZ |
114 | long *descent = (long *) NULL, |
115 | long *externalLeading = (long *) NULL, | |
64698f9a | 116 | wxFont *theFont = (wxFont *) NULL ) const; |
c801d85f | 117 | |
4e4ea166 RR |
118 | void DoGetSize(int* width, int* height) const; |
119 | void DoGetSizeMM(int *width, int *height) const; | |
7bcb11d3 JS |
120 | |
121 | // Resolution in pixels per logical inch | |
122 | wxSize GetPPI(void) const; | |
c801d85f | 123 | |
bf38cbff JS |
124 | void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); |
125 | void SetDeviceOrigin( long x, long y ); | |
126 | ||
127 | inline void SetBackgroundMode(int WXUNUSED(mode)) {} | |
c801d85f | 128 | inline void SetPalette(const wxPalette& WXUNUSED(palette)) {} |
c801d85f | 129 | |
af0bb3b1 | 130 | ofstream *GetStream(void) const { return m_pstream; } |
c801d85f | 131 | |
af0bb3b1 VZ |
132 | wxPrintData& GetPrintData() { return m_printData; } |
133 | void SetPrintData(const wxPrintData& data) { m_printData = data; } | |
134 | ||
135 | virtual int GetDepth() const { return 24; } | |
7bcb11d3 | 136 | |
c801d85f | 137 | protected: |
bf38cbff | 138 | |
c801d85f KB |
139 | ofstream * m_pstream; // PostScript output stream |
140 | wxString m_title; | |
141 | unsigned char m_currentRed; | |
142 | unsigned char m_currentGreen; | |
143 | unsigned char m_currentBlue; | |
bf38cbff JS |
144 | int m_pageNumber; |
145 | bool m_clipping; | |
146 | double m_underlinePosition; | |
147 | double m_underlineThickness; | |
7bcb11d3 | 148 | wxPrintData m_printData; |
bf38cbff JS |
149 | }; |
150 | ||
7bcb11d3 | 151 | // Deprecated: should use wxGenericPrintDialog instead. |
bf38cbff | 152 | #if 1 |
c801d85f KB |
153 | #define wxID_PRINTER_COMMAND 1 |
154 | #define wxID_PRINTER_OPTIONS 2 | |
155 | #define wxID_PRINTER_ORIENTATION 3 | |
156 | #define wxID_PRINTER_MODES 4 | |
157 | #define wxID_PRINTER_X_SCALE 5 | |
158 | #define wxID_PRINTER_Y_SCALE 6 | |
159 | #define wxID_PRINTER_X_TRANS 7 | |
160 | #define wxID_PRINTER_Y_TRANS 8 | |
161 | ||
162 | class WXDLLEXPORT wxPostScriptPrintDialog: public wxDialog | |
163 | { | |
164 | DECLARE_CLASS(wxPostScriptPrintDialog) | |
165 | public: | |
166 | wxPostScriptPrintDialog (wxWindow *parent, const wxString& title, | |
a6f6393c VZ |
167 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
168 | long style = wxDEFAULT_DIALOG_STYLE); | |
c801d85f KB |
169 | |
170 | virtual int ShowModal(void) ; | |
171 | }; | |
bf38cbff | 172 | #endif |
c801d85f KB |
173 | |
174 | // Print Orientation (Should also add Left, Right) | |
af0bb3b1 VZ |
175 | enum |
176 | { | |
c801d85f KB |
177 | PS_PORTRAIT = 1, |
178 | PS_LANDSCAPE = 2 | |
179 | };// ps_orientation = PS_PORTRAIT; | |
180 | ||
181 | // Print Actions | |
af0bb3b1 VZ |
182 | enum |
183 | { | |
7bcb11d3 JS |
184 | PS_NONE, |
185 | PS_PREVIEW, | |
c801d85f | 186 | PS_FILE, |
7bcb11d3 | 187 | PS_PRINTER |
c801d85f KB |
188 | };// ps_action = PS_PREVIEW; |
189 | ||
190 | // PostScript printer settings | |
7bcb11d3 JS |
191 | WXDLLEXPORT void wxSetPrinterCommand(const wxString& cmd); |
192 | WXDLLEXPORT void wxSetPrintPreviewCommand(const wxString& cmd); | |
193 | WXDLLEXPORT void wxSetPrinterOptions(const wxString& flags); | |
184b5d99 JS |
194 | WXDLLEXPORT void wxSetPrinterOrientation(int orientation); |
195 | WXDLLEXPORT void wxSetPrinterScaling(double x, double y); | |
196 | WXDLLEXPORT void wxSetPrinterTranslation(long x, long y); | |
197 | WXDLLEXPORT void wxSetPrinterMode(int mode); | |
7bcb11d3 JS |
198 | WXDLLEXPORT void wxSetPrinterFile(const wxString& f); |
199 | WXDLLEXPORT void wxSetAFMPath(const wxString& f); | |
c801d85f KB |
200 | |
201 | // Get current values | |
7bcb11d3 JS |
202 | WXDLLEXPORT wxString wxGetPrinterCommand(); |
203 | WXDLLEXPORT wxString wxGetPrintPreviewCommand(); | |
204 | WXDLLEXPORT wxString wxGetPrinterOptions(); | |
a6f6393c | 205 | WXDLLEXPORT int wxGetPrinterOrientation(); |
184b5d99 JS |
206 | WXDLLEXPORT void wxGetPrinterScaling(double* x, double* y); |
207 | WXDLLEXPORT void wxGetPrinterTranslation(long *x, long *y); | |
a6f6393c | 208 | WXDLLEXPORT int wxGetPrinterMode(); |
7bcb11d3 JS |
209 | WXDLLEXPORT wxString wxGetPrinterFile(); |
210 | WXDLLEXPORT wxString wxGetAFMPath(); | |
c801d85f KB |
211 | |
212 | /* | |
7bcb11d3 JS |
213 | * PostScript print setup information. |
214 | * This is now obsolete, but retained for a while for compatibility | |
c801d85f KB |
215 | */ |
216 | ||
217 | class WXDLLEXPORT wxPrintSetupData: public wxObject | |
218 | { | |
a6f6393c VZ |
219 | public: |
220 | wxPrintSetupData(); | |
221 | ~wxPrintSetupData(); | |
222 | ||
7bcb11d3 JS |
223 | void SetPrinterCommand(const wxString& cmd) { m_printerCommand = cmd; }; |
224 | void SetPaperName(const wxString& paper) { m_paperName = paper; }; | |
225 | void SetPrintPreviewCommand(const wxString& cmd) { m_previewCommand = cmd; }; | |
226 | void SetPrinterOptions(const wxString& flags) { m_printerFlags = flags; }; | |
227 | void SetPrinterFile(const wxString& f) { m_printerFile = f; }; | |
228 | void SetPrinterOrientation(int orient) { m_printerOrient = orient; }; | |
229 | void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; }; | |
230 | void SetPrinterTranslation(long x, long y) { m_printerTranslateX = x; m_printerTranslateY = y; }; | |
a6f6393c | 231 | // 1 = Preview, 2 = print to file, 3 = send to printer |
7bcb11d3 JS |
232 | void SetPrinterMode(int mode) { m_printerMode = mode; }; |
233 | void SetAFMPath(const wxString& f) { m_afmPath = f; }; | |
234 | void SetColour(bool col) { m_printColour = col; }; | |
a6f6393c VZ |
235 | |
236 | // Get current values | |
7bcb11d3 JS |
237 | wxString GetPrinterCommand() const { return m_printerCommand; } ; |
238 | wxString GetPrintPreviewCommand() const { return m_previewCommand; } ; | |
239 | wxString GetPrinterOptions() const { return m_printerFlags; }; | |
240 | wxString GetPrinterFile() const { return m_printerFile; }; | |
241 | wxString GetPaperName() const { return m_paperName; } | |
242 | int GetPrinterOrientation() const { return m_printerOrient; }; | |
243 | void GetPrinterScaling(double* x, double* y) const { *x = m_printerScaleX; *y = m_printerScaleY; }; | |
244 | void GetPrinterTranslation(long *x, long *y) const { *x = m_printerTranslateX; *y = m_printerTranslateY; }; | |
245 | int GetPrinterMode() const { return m_printerMode; }; | |
246 | wxString GetAFMPath() const { return m_afmPath; }; | |
247 | bool GetColour() const { return m_printColour; }; | |
a6f6393c VZ |
248 | |
249 | void operator=(wxPrintSetupData& data); | |
250 | ||
7bcb11d3 JS |
251 | // Initialize from a wxPrintData object (wxPrintData should now be used instead of wxPrintSetupData). |
252 | // There is also an operator for initializing a wxPrintData from a wxPrintSetupData. | |
253 | void operator=(const wxPrintData& data); | |
254 | ||
255 | public: | |
256 | wxString m_printerCommand; | |
257 | wxString m_previewCommand; | |
258 | wxString m_printerFlags; | |
259 | wxString m_printerFile; | |
260 | int m_printerOrient; | |
261 | double m_printerScaleX; | |
262 | double m_printerScaleY; | |
263 | long m_printerTranslateX; | |
264 | long m_printerTranslateY; | |
265 | // 1 = Preview, 2 = print to file, 3 = send to printer | |
266 | int m_printerMode; | |
267 | wxString m_afmPath; | |
268 | // A name in the paper database (see paper.h) | |
269 | wxString m_paperName; | |
270 | bool m_printColour; | |
271 | ||
a6f6393c | 272 | DECLARE_DYNAMIC_CLASS(wxPrintSetupData) |
c801d85f KB |
273 | }; |
274 | ||
184b5d99 JS |
275 | WXDLLEXPORT_DATA(extern wxPrintSetupData*) wxThePrintSetupData; |
276 | WXDLLEXPORT extern void wxInitializePrintSetupData(bool init = TRUE); | |
c801d85f | 277 | |
bf38cbff JS |
278 | #endif |
279 | // wxUSE_POSTSCRIPT | |
ce4169a4 RR |
280 | |
281 | #endif | |
282 | // wxUSE_PRINTING_ARCHITECTURE | |
ed880dd4 | 283 | |
c801d85f | 284 | #endif |
bf38cbff | 285 | // _WX_DCPSG_H_ |