]>
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$ |
371a5b4e | 7 | // Copyright: (c) Julian Smart and Robert Roebling |
a6f6393c | 8 | // Licence: wxWindows licence |
c801d85f KB |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
bf38cbff JS |
11 | #ifndef _WX_DCPSG_H_ |
12 | #define _WX_DCPSG_H_ | |
c801d85f | 13 | |
af49c4b8 | 14 | #if defined(__GNUG__) && !defined(__APPLE__) |
ade6b9c5 | 15 | #pragma interface "dcpsg.h" |
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 | { | |
bf38cbff | 40 | public: |
a6f6393c | 41 | wxPostScriptDC(); |
7bcb11d3 | 42 | |
7bcb11d3 JS |
43 | // Recommended constructor |
44 | wxPostScriptDC(const wxPrintData& printData); | |
009a0665 | 45 | |
a6f6393c | 46 | ~wxPostScriptDC(); |
c801d85f | 47 | |
009a0665 RR |
48 | #if WXWIN_COMPATIBILITY_2_2 |
49 | wxPostScriptDC( const wxString &output, bool interactive = FALSE, wxWindow *parent = NULL ) | |
50 | { Create( output, interactive, parent ); } | |
51 | bool Create ( const wxString &output, bool interactive = FALSE, wxWindow *parent = NULL ); | |
52 | #endif | |
53 | ||
bf38cbff JS |
54 | virtual bool Ok() const; |
55 | ||
bf38cbff JS |
56 | virtual void BeginDrawing() {} |
57 | virtual void EndDrawing() {} | |
c801d85f | 58 | |
387ebd3e | 59 | bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE ); |
72cdf4c9 VZ |
60 | bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const; |
61 | ||
62 | void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); | |
63 | void DoCrossHair(wxCoord x, wxCoord y) ; | |
64 | void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc); | |
65 | void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea); | |
66 | void DoDrawPoint(wxCoord x, wxCoord y); | |
67 | void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0); | |
68 | void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle=wxODDEVEN_RULE); | |
69 | void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
70 | void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20); | |
71 | void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
64698f9a RR |
72 | |
73 | void DoDrawSpline(wxList *points); | |
74 | ||
72cdf4c9 | 75 | bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, |
f0a6b1cd JS |
76 | wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = FALSE, |
77 | wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); | |
72cdf4c9 | 78 | bool CanDrawBitmap() const { return TRUE; } |
bf38cbff | 79 | |
72cdf4c9 VZ |
80 | void DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y ); |
81 | void DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask=FALSE ); | |
bf38cbff | 82 | |
72cdf4c9 | 83 | void DoDrawText(const wxString& text, wxCoord x, wxCoord y ); |
95724b1a | 84 | void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle); |
c801d85f | 85 | |
a6f6393c | 86 | void Clear(); |
bf38cbff JS |
87 | void SetFont( const wxFont& font ); |
88 | void SetPen( const wxPen& pen ); | |
89 | void SetBrush( const wxBrush& brush ); | |
90 | void SetLogicalFunction( int function ); | |
91 | void SetBackground( const wxBrush& brush ); | |
92 | ||
72cdf4c9 | 93 | void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height); |
a6f6393c | 94 | void DestroyClippingRegion(); |
af0bb3b1 | 95 | |
72cdf4c9 | 96 | void DoSetClippingRegionAsRegion( const wxRegion &WXUNUSED(clip) ) { } |
c801d85f KB |
97 | |
98 | bool StartDoc(const wxString& message); | |
a6f6393c VZ |
99 | void EndDoc(); |
100 | void StartPage(); | |
101 | void EndPage(); | |
c801d85f | 102 | |
72cdf4c9 VZ |
103 | wxCoord GetCharHeight() const; |
104 | wxCoord GetCharWidth() const; | |
385c54d7 | 105 | bool CanGetTextExtent() const { return TRUE; } |
72cdf4c9 VZ |
106 | void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, |
107 | wxCoord *descent = (wxCoord *) NULL, | |
108 | wxCoord *externalLeading = (wxCoord *) NULL, | |
64698f9a | 109 | wxFont *theFont = (wxFont *) NULL ) const; |
c801d85f | 110 | |
4e4ea166 RR |
111 | void DoGetSize(int* width, int* height) const; |
112 | void DoGetSizeMM(int *width, int *height) const; | |
7bcb11d3 JS |
113 | |
114 | // Resolution in pixels per logical inch | |
72cdf4c9 | 115 | wxSize GetPPI() const; |
c801d85f | 116 | |
bf38cbff | 117 | void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); |
72cdf4c9 | 118 | void SetDeviceOrigin( wxCoord x, wxCoord y ); |
bf38cbff | 119 | |
72cdf4c9 VZ |
120 | void SetBackgroundMode(int WXUNUSED(mode)) { } |
121 | void SetPalette(const wxPalette& WXUNUSED(palette)) { } | |
c801d85f | 122 | |
af0bb3b1 VZ |
123 | wxPrintData& GetPrintData() { return m_printData; } |
124 | void SetPrintData(const wxPrintData& data) { m_printData = data; } | |
125 | ||
126 | virtual int GetDepth() const { return 24; } | |
b64de916 VS |
127 | |
128 | static void SetResolution(int ppi); | |
129 | static int GetResolution(); | |
130 | ||
131 | private: | |
eba33006 | 132 | static float ms_PSScaleFactor; |
7bcb11d3 | 133 | |
c801d85f | 134 | protected: |
eba33006 RR |
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 | private: | |
147 | DECLARE_DYNAMIC_CLASS(wxPostScriptDC) | |
c801d85f KB |
148 | }; |
149 | ||
47dc9f78 RR |
150 | |
151 | #if WXWIN_COMPATIBILITY_2_2 | |
152 | // Print Orientation | |
153 | enum | |
154 | { | |
155 | PS_PORTRAIT = wxPORTRAIT, | |
156 | PS_LANDSCAPE = wxLANDSCAPE | |
157 | }; | |
158 | ||
159 | // Print Actions | |
160 | enum | |
161 | { | |
162 | PS_NONE = wxPRINT_MODE_NONE, | |
163 | PS_PREVIEW = wxPRINT_MODE_PREVIEW, | |
164 | PS_FILE = wxPRINT_MODE_FILE, | |
165 | PS_PRINTER = wxPRINT_MODE_PRINTER | |
166 | }; | |
167 | ||
168 | class wxPrintSetupData: public wxPrintData | |
169 | { | |
170 | public: | |
171 | wxPrintSetupData() {} | |
172 | ||
173 | void SetPrinterOrientation( int orient ) | |
174 | { SetOrientation( orient ); } | |
175 | void SetPrinterMode( wxPrintMode mode ) | |
176 | { SetPrintMode( mode ); } | |
177 | void SetAFMPath( const wxString &path ) | |
178 | { SetFontMetricPath( path ); } | |
179 | ||
180 | void SetPaperName(const wxString& paper) { m_paperName = paper; } | |
181 | void SetPrinterFile(const wxString& file) { m_printerFile = file; } | |
182 | wxString GetPaperName() const { return m_paperName; } | |
183 | wxString GetPrinterFile() const { return m_printerFile; }; | |
184 | ||
185 | wxString m_paperName; | |
186 | wxString m_printerFile; | |
187 | }; | |
188 | ||
189 | WXDLLEXPORT_DATA(extern wxPrintSetupData*) wxThePrintSetupData; | |
190 | WXDLLEXPORT extern void wxInitializePrintSetupData(bool init = TRUE); | |
191 | #endif | |
192 | ||
193 | ||
bf38cbff JS |
194 | #endif |
195 | // wxUSE_POSTSCRIPT | |
72cdf4c9 | 196 | |
ce4169a4 RR |
197 | #endif |
198 | // wxUSE_PRINTING_ARCHITECTURE | |
ed880dd4 | 199 | |
c801d85f | 200 | #endif |
bf38cbff | 201 | // _WX_DCPSG_H_ |