]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
389076f1 | 2 | // Name: wx/generic/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 |
65571936 | 8 | // Licence: wxWindows licence |
c801d85f KB |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
bf38cbff JS |
11 | #ifndef _WX_DCPSG_H_ |
12 | #define _WX_DCPSG_H_ | |
c801d85f | 13 | |
e7445ff8 | 14 | #include "wx/defs.h" |
c801d85f | 15 | |
ce4169a4 RR |
16 | #if wxUSE_PRINTING_ARCHITECTURE |
17 | ||
47d67540 | 18 | #if wxUSE_POSTSCRIPT |
c801d85f | 19 | |
e7445ff8 | 20 | #include "wx/dc.h" |
bf38cbff JS |
21 | #include "wx/dialog.h" |
22 | #include "wx/module.h" | |
7bcb11d3 | 23 | #include "wx/cmndata.h" |
c9f78968 | 24 | #include "wx/strvararg.h" |
fbc535ff | 25 | |
e7445ff8 PC |
26 | extern WXDLLIMPEXP_DATA_CORE(int) wxPageNumber; |
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: |
3a97d2db | 41 | wxPostScriptDC(); |
7bcb11d3 | 42 | |
3a97d2db RR |
43 | // Recommended constructor |
44 | wxPostScriptDC(const wxPrintData& printData); | |
04ab8b6d | 45 | |
d3c7fc99 | 46 | virtual ~wxPostScriptDC(); |
c801d85f | 47 | |
04ab8b6d RR |
48 | virtual bool Ok() const { return IsOk(); } |
49 | virtual bool IsOk() const; | |
bf38cbff | 50 | |
04ab8b6d | 51 | bool CanDrawBitmap() const { return true; } |
bf38cbff | 52 | |
04ab8b6d RR |
53 | void Clear(); |
54 | void SetFont( const wxFont& font ); | |
55 | void SetPen( const wxPen& pen ); | |
56 | void SetBrush( const wxBrush& brush ); | |
57 | void SetLogicalFunction( int function ); | |
58 | void SetBackground( const wxBrush& brush ); | |
bf38cbff | 59 | |
04ab8b6d | 60 | void DestroyClippingRegion(); |
af0bb3b1 | 61 | |
04ab8b6d RR |
62 | bool StartDoc(const wxString& message); |
63 | void EndDoc(); | |
64 | void StartPage(); | |
65 | void EndPage(); | |
c801d85f | 66 | |
04ab8b6d RR |
67 | wxCoord GetCharHeight() const; |
68 | wxCoord GetCharWidth() const; | |
69 | bool CanGetTextExtent() const { return true; } | |
7bcb11d3 | 70 | |
04ab8b6d RR |
71 | // Resolution in pixels per logical inch |
72 | wxSize GetPPI() const; | |
c801d85f | 73 | |
04ab8b6d RR |
74 | // overridden because origin is bottom left and |
75 | // axes are inverted | |
76 | void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); | |
77 | ||
78 | // these need to be overridden as wxPostscriptDC inherits | |
79 | // from the platform dependent wxDC and this we'd call | |
80 | // e.g. wxMSW specific code here. | |
81 | virtual void SetMapMode(int mode); | |
82 | virtual void SetUserScale(double x, double y); | |
83 | virtual void SetLogicalScale(double x, double y); | |
84 | virtual void SetLogicalOrigin(wxCoord x, wxCoord y); | |
85 | virtual void SetDeviceOrigin(wxCoord x, wxCoord y); | |
bf38cbff | 86 | |
04ab8b6d RR |
87 | void SetBackgroundMode(int WXUNUSED(mode)) { } |
88 | void SetPalette(const wxPalette& WXUNUSED(palette)) { } | |
c801d85f | 89 | |
04ab8b6d RR |
90 | void SetPrintData(const wxPrintData& data); |
91 | wxPrintData& GetPrintData() { return m_printData; } | |
af0bb3b1 | 92 | |
04ab8b6d | 93 | virtual int GetDepth() const { return 24; } |
ca65c044 | 94 | |
04ab8b6d RR |
95 | static void SetResolution(int ppi); |
96 | static int GetResolution(); | |
244e5e34 | 97 | |
1528e0b8 | 98 | WX_DEFINE_VARARG_FUNC_VOID(PsPrintf, 1, (const wxFormatString&), |
d1f6e2cf | 99 | DoPsPrintfFormatWchar, DoPsPrintfFormatUtf8) |
2523e9b7 VS |
100 | #ifdef __WATCOMC__ |
101 | // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 | |
d1f6e2cf VS |
102 | WX_DEFINE_VARARG_FUNC_VOID(PsPrintf, 1, (const char*), |
103 | DoPsPrintfFormatWchar, DoPsPrintfFormatUtf8) | |
104 | WX_DEFINE_VARARG_FUNC_VOID(PsPrintf, 1, (const wchar_t*), | |
105 | DoPsPrintfFormatWchar, DoPsPrintfFormatUtf8) | |
2523e9b7 | 106 | #endif |
d1f6e2cf | 107 | |
04ab8b6d RR |
108 | void PsPrint( const wxString& psdata ); |
109 | void PsPrint( int ch ); | |
244e5e34 | 110 | |
ca65c044 | 111 | private: |
d1f6e2cf VS |
112 | #if !wxUSE_UTF8_LOCALE_ONLY |
113 | void DoPsPrintfFormatWchar(const wxChar *fmt, ... ); | |
114 | #endif | |
115 | #if wxUSE_UNICODE_UTF8 | |
116 | void DoPsPrintfFormatUtf8(const char *fmt, ... ); | |
117 | #endif | |
c9f78968 | 118 | |
eba33006 | 119 | static float ms_PSScaleFactor; |
7bcb11d3 | 120 | |
c801d85f | 121 | protected: |
6f02a879 VZ |
122 | bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style = wxFLOOD_SURFACE); |
123 | bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const; | |
124 | void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); | |
125 | void DoCrossHair(wxCoord x, wxCoord y) ; | |
126 | void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc); | |
127 | void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea); | |
128 | void DoDrawPoint(wxCoord x, wxCoord y); | |
129 | void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0); | |
130 | void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle = wxODDEVEN_RULE); | |
131 | void DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle = wxODDEVEN_RULE); | |
132 | void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
133 | void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20); | |
134 | void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
135 | #if wxUSE_SPLINES | |
136 | void DoDrawSpline(wxList *points); | |
137 | #endif // wxUSE_SPLINES | |
138 | bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, | |
139 | wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false, | |
140 | wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); | |
141 | void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); | |
142 | void DoDrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false); | |
143 | void DoDrawText(const wxString& text, wxCoord x, wxCoord y); | |
144 | void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle); | |
145 | void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
146 | void DoSetClippingRegionAsRegion( const wxRegion &WXUNUSED(clip)) { } | |
147 | void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, | |
148 | wxCoord *descent = NULL, | |
149 | wxCoord *externalLeading = NULL, | |
c94f845b | 150 | const wxFont *theFont = NULL) const; |
6f02a879 VZ |
151 | void DoGetSize(int* width, int* height) const; |
152 | void DoGetSizeMM(int *width, int *height) const; | |
3a97d2db | 153 | |
eba33006 RR |
154 | FILE* m_pstream; // PostScript output stream |
155 | wxString m_title; | |
156 | unsigned char m_currentRed; | |
157 | unsigned char m_currentGreen; | |
158 | unsigned char m_currentBlue; | |
159 | int m_pageNumber; | |
160 | bool m_clipping; | |
161 | double m_underlinePosition; | |
162 | double m_underlineThickness; | |
163 | wxPrintData m_printData; | |
ca65c044 | 164 | |
eba33006 RR |
165 | private: |
166 | DECLARE_DYNAMIC_CLASS(wxPostScriptDC) | |
c801d85f KB |
167 | }; |
168 | ||
bf38cbff JS |
169 | #endif |
170 | // wxUSE_POSTSCRIPT | |
72cdf4c9 | 171 | |
ce4169a4 RR |
172 | #endif |
173 | // wxUSE_PRINTING_ARCHITECTURE | |
ed880dd4 | 174 | |
c801d85f | 175 | #endif |
bf38cbff | 176 | // _WX_DCPSG_H_ |