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