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