]>
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); | |
ca65c044 | 45 | |
3a97d2db | 46 | // Recommended destructor :-) |
d3c7fc99 | 47 | virtual ~wxPostScriptDC(); |
c801d85f | 48 | |
b7cacb43 VZ |
49 | virtual bool Ok() const { return IsOk(); } |
50 | virtual bool IsOk() const; | |
bf38cbff | 51 | |
ca65c044 | 52 | bool CanDrawBitmap() const { return true; } |
bf38cbff | 53 | |
a6f6393c | 54 | void Clear(); |
bf38cbff JS |
55 | void SetFont( const wxFont& font ); |
56 | void SetPen( const wxPen& pen ); | |
57 | void SetBrush( const wxBrush& brush ); | |
58 | void SetLogicalFunction( int function ); | |
59 | void SetBackground( const wxBrush& brush ); | |
60 | ||
a6f6393c | 61 | void DestroyClippingRegion(); |
af0bb3b1 | 62 | |
c801d85f | 63 | bool StartDoc(const wxString& message); |
a6f6393c VZ |
64 | void EndDoc(); |
65 | void StartPage(); | |
66 | void EndPage(); | |
c801d85f | 67 | |
72cdf4c9 VZ |
68 | wxCoord GetCharHeight() const; |
69 | wxCoord GetCharWidth() const; | |
ca65c044 | 70 | bool CanGetTextExtent() const { return true; } |
7bcb11d3 JS |
71 | |
72 | // Resolution in pixels per logical inch | |
72cdf4c9 | 73 | wxSize GetPPI() const; |
c801d85f | 74 | |
bf38cbff | 75 | void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); |
72cdf4c9 | 76 | void SetDeviceOrigin( wxCoord x, wxCoord y ); |
bf38cbff | 77 | |
72cdf4c9 VZ |
78 | void SetBackgroundMode(int WXUNUSED(mode)) { } |
79 | void SetPalette(const wxPalette& WXUNUSED(palette)) { } | |
c801d85f | 80 | |
af0bb3b1 VZ |
81 | wxPrintData& GetPrintData() { return m_printData; } |
82 | void SetPrintData(const wxPrintData& data) { m_printData = data; } | |
83 | ||
84 | virtual int GetDepth() const { return 24; } | |
ca65c044 | 85 | |
b64de916 VS |
86 | static void SetResolution(int ppi); |
87 | static int GetResolution(); | |
244e5e34 | 88 | |
c9f78968 | 89 | WX_DEFINE_VARARG_FUNC_VOID(PsPrintf, DoPsPrintfFormat) |
244e5e34 VZ |
90 | void PsPrint( const char* psdata ); |
91 | void PsPrint( int ch ); | |
92 | ||
93 | #if wxUSE_UNICODE | |
94 | void PsPrint( const wxChar* psdata ) { PsPrint( wxConvUTF8.cWX2MB( psdata ) ); } | |
95 | #endif | |
96 | ||
ca65c044 | 97 | private: |
c9f78968 VS |
98 | void DoPsPrintfFormat(const wxChar *fmt, ... ); |
99 | ||
eba33006 | 100 | static float ms_PSScaleFactor; |
7bcb11d3 | 101 | |
c801d85f | 102 | protected: |
6f02a879 VZ |
103 | bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style = wxFLOOD_SURFACE); |
104 | bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const; | |
105 | void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); | |
106 | void DoCrossHair(wxCoord x, wxCoord y) ; | |
107 | void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc); | |
108 | void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea); | |
109 | void DoDrawPoint(wxCoord x, wxCoord y); | |
110 | void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0); | |
111 | void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle = wxODDEVEN_RULE); | |
112 | void DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle = wxODDEVEN_RULE); | |
113 | void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
114 | void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20); | |
115 | void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
116 | #if wxUSE_SPLINES | |
117 | void DoDrawSpline(wxList *points); | |
118 | #endif // wxUSE_SPLINES | |
119 | bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, | |
120 | wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false, | |
121 | wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); | |
122 | void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); | |
123 | void DoDrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false); | |
124 | void DoDrawText(const wxString& text, wxCoord x, wxCoord y); | |
125 | void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle); | |
126 | void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
127 | void DoSetClippingRegionAsRegion( const wxRegion &WXUNUSED(clip)) { } | |
128 | void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, | |
129 | wxCoord *descent = NULL, | |
130 | wxCoord *externalLeading = NULL, | |
131 | wxFont *theFont = NULL) const; | |
132 | void DoGetSize(int* width, int* height) const; | |
133 | void DoGetSizeMM(int *width, int *height) const; | |
3a97d2db | 134 | |
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; | |
ca65c044 | 145 | |
eba33006 RR |
146 | private: |
147 | DECLARE_DYNAMIC_CLASS(wxPostScriptDC) | |
c801d85f KB |
148 | }; |
149 | ||
bf38cbff JS |
150 | #endif |
151 | // wxUSE_POSTSCRIPT | |
72cdf4c9 | 152 | |
ce4169a4 RR |
153 | #endif |
154 | // wxUSE_PRINTING_ARCHITECTURE | |
ed880dd4 | 155 | |
c801d85f | 156 | #endif |
bf38cbff | 157 | // _WX_DCPSG_H_ |