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