]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/dcpsg.h
compile bug fix
[wxWidgets.git] / include / wx / generic / dcpsg.h
CommitLineData
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 32class wxPostScriptDC;
f04371f0 33
bf38cbff
JS
34//-----------------------------------------------------------------------------
35// wxPostScriptDC
36//-----------------------------------------------------------------------------
f04371f0 37
c801d85f
KB
38class WXDLLEXPORT wxPostScriptDC: public wxDC
39{
40 DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
41
bf38cbff
JS
42public:
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
VZ
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; }
bf38cbff 84
72cdf4c9
VZ
85 void DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y );
86 void DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask=FALSE );
bf38cbff 87
72cdf4c9 88 void DoDrawText(const wxString& text, wxCoord x, wxCoord y );
95724b1a 89 void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
c801d85f 90
a6f6393c 91 void Clear();
bf38cbff
JS
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
72cdf4c9 98 void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
a6f6393c 99 void DestroyClippingRegion();
af0bb3b1 100
72cdf4c9 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
72cdf4c9
VZ
108 wxCoord GetCharHeight() const;
109 wxCoord GetCharWidth() const;
385c54d7 110 bool CanGetTextExtent() const { return TRUE; }
72cdf4c9
VZ
111 void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
112 wxCoord *descent = (wxCoord *) NULL,
113 wxCoord *externalLeading = (wxCoord *) NULL,
64698f9a 114 wxFont *theFont = (wxFont *) NULL ) const;
c801d85f 115
4e4ea166
RR
116 void DoGetSize(int* width, int* height) const;
117 void DoGetSizeMM(int *width, int *height) const;
7bcb11d3
JS
118
119 // Resolution in pixels per logical inch
72cdf4c9 120 wxSize GetPPI() const;
c801d85f 121
bf38cbff 122 void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
72cdf4c9 123 void SetDeviceOrigin( wxCoord x, wxCoord y );
bf38cbff 124
72cdf4c9
VZ
125 void SetBackgroundMode(int WXUNUSED(mode)) { }
126 void SetPalette(const wxPalette& WXUNUSED(palette)) { }
c801d85f 127
af0bb3b1
VZ
128 wxPrintData& GetPrintData() { return m_printData; }
129 void SetPrintData(const wxPrintData& data) { m_printData = data; }
130
131 virtual int GetDepth() const { return 24; }
b64de916
VS
132
133 static void SetResolution(int ppi);
134 static int GetResolution();
135
136private:
137 static float ms_PSScaleFactor;
7bcb11d3 138
c801d85f 139protected:
bf38cbff 140
d7657f75 141 FILE* m_pstream; // PostScript output stream
c801d85f
KB
142 wxString m_title;
143 unsigned char m_currentRed;
144 unsigned char m_currentGreen;
145 unsigned char m_currentBlue;
bf38cbff
JS
146 int m_pageNumber;
147 bool m_clipping;
148 double m_underlinePosition;
149 double m_underlineThickness;
7bcb11d3 150 wxPrintData m_printData;
bf38cbff
JS
151};
152
7bcb11d3 153// Deprecated: should use wxGenericPrintDialog instead.
bf38cbff 154#if 1
72cdf4c9
VZ
155enum
156{
157 wxID_PRINTER_COMMAND = 1,
158 wxID_PRINTER_OPTIONS,
159 wxID_PRINTER_ORIENTATION,
160 wxID_PRINTER_MODES,
161 wxID_PRINTER_X_SCALE,
162 wxID_PRINTER_Y_SCALE,
163 wxID_PRINTER_X_TRANS,
164 wxID_PRINTER_Y_TRANS
165};
c801d85f
KB
166
167class WXDLLEXPORT wxPostScriptPrintDialog: public wxDialog
168{
169DECLARE_CLASS(wxPostScriptPrintDialog)
170public:
171 wxPostScriptPrintDialog (wxWindow *parent, const wxString& title,
a6f6393c 172 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
72cdf4c9 173 wxCoord style = wxDEFAULT_DIALOG_STYLE);
c801d85f 174
72cdf4c9 175 virtual int ShowModal();
c801d85f 176};
72cdf4c9 177#endif // 1
c801d85f
KB
178
179// Print Orientation (Should also add Left, Right)
af0bb3b1
VZ
180enum
181{
c801d85f
KB
182 PS_PORTRAIT = 1,
183 PS_LANDSCAPE = 2
184};// ps_orientation = PS_PORTRAIT;
185
186// Print Actions
af0bb3b1
VZ
187enum
188{
7bcb11d3
JS
189 PS_NONE,
190 PS_PREVIEW,
c801d85f 191 PS_FILE,
7bcb11d3 192 PS_PRINTER
c801d85f
KB
193};// ps_action = PS_PREVIEW;
194
195// PostScript printer settings
7bcb11d3
JS
196WXDLLEXPORT void wxSetPrinterCommand(const wxString& cmd);
197WXDLLEXPORT void wxSetPrintPreviewCommand(const wxString& cmd);
198WXDLLEXPORT void wxSetPrinterOptions(const wxString& flags);
184b5d99
JS
199WXDLLEXPORT void wxSetPrinterOrientation(int orientation);
200WXDLLEXPORT void wxSetPrinterScaling(double x, double y);
72cdf4c9 201WXDLLEXPORT void wxSetPrinterTranslation(wxCoord x, wxCoord y);
184b5d99 202WXDLLEXPORT void wxSetPrinterMode(int mode);
7bcb11d3
JS
203WXDLLEXPORT void wxSetPrinterFile(const wxString& f);
204WXDLLEXPORT void wxSetAFMPath(const wxString& f);
c801d85f
KB
205
206// Get current values
7bcb11d3
JS
207WXDLLEXPORT wxString wxGetPrinterCommand();
208WXDLLEXPORT wxString wxGetPrintPreviewCommand();
209WXDLLEXPORT wxString wxGetPrinterOptions();
a6f6393c 210WXDLLEXPORT int wxGetPrinterOrientation();
184b5d99 211WXDLLEXPORT void wxGetPrinterScaling(double* x, double* y);
72cdf4c9 212WXDLLEXPORT void wxGetPrinterTranslation(wxCoord *x, wxCoord *y);
a6f6393c 213WXDLLEXPORT int wxGetPrinterMode();
7bcb11d3
JS
214WXDLLEXPORT wxString wxGetPrinterFile();
215WXDLLEXPORT wxString wxGetAFMPath();
c801d85f
KB
216
217/*
7bcb11d3
JS
218 * PostScript print setup information.
219 * This is now obsolete, but retained for a while for compatibility
c801d85f
KB
220 */
221
222class WXDLLEXPORT wxPrintSetupData: public wxObject
223{
a6f6393c
VZ
224public:
225 wxPrintSetupData();
226 ~wxPrintSetupData();
227
7bcb11d3
JS
228 void SetPrinterCommand(const wxString& cmd) { m_printerCommand = cmd; };
229 void SetPaperName(const wxString& paper) { m_paperName = paper; };
230 void SetPrintPreviewCommand(const wxString& cmd) { m_previewCommand = cmd; };
231 void SetPrinterOptions(const wxString& flags) { m_printerFlags = flags; };
232 void SetPrinterFile(const wxString& f) { m_printerFile = f; };
233 void SetPrinterOrientation(int orient) { m_printerOrient = orient; };
234 void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; };
72cdf4c9 235 void SetPrinterTranslation(wxCoord x, wxCoord y) { m_printerTranslateX = x; m_printerTranslateY = y; };
a6f6393c 236 // 1 = Preview, 2 = print to file, 3 = send to printer
7bcb11d3
JS
237 void SetPrinterMode(int mode) { m_printerMode = mode; };
238 void SetAFMPath(const wxString& f) { m_afmPath = f; };
239 void SetColour(bool col) { m_printColour = col; };
a6f6393c
VZ
240
241 // Get current values
7bcb11d3
JS
242 wxString GetPrinterCommand() const { return m_printerCommand; } ;
243 wxString GetPrintPreviewCommand() const { return m_previewCommand; } ;
244 wxString GetPrinterOptions() const { return m_printerFlags; };
245 wxString GetPrinterFile() const { return m_printerFile; };
246 wxString GetPaperName() const { return m_paperName; }
247 int GetPrinterOrientation() const { return m_printerOrient; };
248 void GetPrinterScaling(double* x, double* y) const { *x = m_printerScaleX; *y = m_printerScaleY; };
72cdf4c9 249 void GetPrinterTranslation(wxCoord *x, wxCoord *y) const { *x = m_printerTranslateX; *y = m_printerTranslateY; };
7bcb11d3
JS
250 int GetPrinterMode() const { return m_printerMode; };
251 wxString GetAFMPath() const { return m_afmPath; };
252 bool GetColour() const { return m_printColour; };
a6f6393c
VZ
253
254 void operator=(wxPrintSetupData& data);
255
7bcb11d3
JS
256 // Initialize from a wxPrintData object (wxPrintData should now be used instead of wxPrintSetupData).
257 // There is also an operator for initializing a wxPrintData from a wxPrintSetupData.
258 void operator=(const wxPrintData& data);
259
72cdf4c9
VZ
260#ifndef __WIN16__
261 void GetPrinterTranslation(long *x, long *y) const
262 { *x = m_printerTranslateX; *y = m_printerTranslateY; }
263#endif // !Win16
264
7bcb11d3
JS
265public:
266 wxString m_printerCommand;
267 wxString m_previewCommand;
268 wxString m_printerFlags;
269 wxString m_printerFile;
270 int m_printerOrient;
271 double m_printerScaleX;
272 double m_printerScaleY;
72cdf4c9
VZ
273 wxCoord m_printerTranslateX;
274 wxCoord m_printerTranslateY;
7bcb11d3
JS
275 // 1 = Preview, 2 = print to file, 3 = send to printer
276 int m_printerMode;
277 wxString m_afmPath;
278 // A name in the paper database (see paper.h)
279 wxString m_paperName;
280 bool m_printColour;
281
72cdf4c9 282 DECLARE_DYNAMIC_CLASS(wxPrintSetupData)
c801d85f
KB
283};
284
184b5d99
JS
285WXDLLEXPORT_DATA(extern wxPrintSetupData*) wxThePrintSetupData;
286WXDLLEXPORT extern void wxInitializePrintSetupData(bool init = TRUE);
c801d85f 287
bf38cbff
JS
288#endif
289 // wxUSE_POSTSCRIPT
72cdf4c9 290
ce4169a4
RR
291#endif
292 // wxUSE_PRINTING_ARCHITECTURE
ed880dd4 293
c801d85f 294#endif
bf38cbff 295 // _WX_DCPSG_H_