wxUSE_SPLINES markup and other cleanings.
[wxWidgets.git] / include / wx / generic / dcpsg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/dcps.h
3 // Purpose: wxPostScriptDC class
4 // Author: Julian Smart and others
5 // Modified by:
6 // RCS-ID: $Id$
7 // Copyright: (c) Julian Smart and Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_DCPSG_H_
12 #define _WX_DCPSG_H_
13
14 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
15 #pragma interface "dcpsg.h"
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 public:
41 wxPostScriptDC();
42
43 // Recommended constructor
44 wxPostScriptDC(const wxPrintData& printData);
45
46 // Recommended destructor :-)
47 ~wxPostScriptDC();
48
49 virtual bool Ok() const;
50
51 virtual void BeginDrawing() {}
52 virtual void EndDrawing() {}
53
54 bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE );
55 bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;
56
57 void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
58 void DoCrossHair(wxCoord x, wxCoord y) ;
59 void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc);
60 void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea);
61 void DoDrawPoint(wxCoord x, wxCoord y);
62 void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
63 void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle=wxODDEVEN_RULE);
64 void DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle=wxODDEVEN_RULE);
65 void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
66 void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20);
67 void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
68
69 #if wxUSE_SPLINES
70 void DoDrawSpline(wxList *points);
71 #endif // wxUSE_SPLINES
72 bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
73 wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false,
74 wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
75 bool CanDrawBitmap() const { return true; }
76
77 void DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y );
78 void DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false );
79
80 void DoDrawText(const wxString& text, wxCoord x, wxCoord y );
81 void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
82
83 void Clear();
84 void SetFont( const wxFont& font );
85 void SetPen( const wxPen& pen );
86 void SetBrush( const wxBrush& brush );
87 void SetLogicalFunction( int function );
88 void SetBackground( const wxBrush& brush );
89
90 void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
91 void DestroyClippingRegion();
92
93 void DoSetClippingRegionAsRegion( const wxRegion &WXUNUSED(clip) ) { }
94
95 bool StartDoc(const wxString& message);
96 void EndDoc();
97 void StartPage();
98 void EndPage();
99
100 wxCoord GetCharHeight() const;
101 wxCoord GetCharWidth() const;
102 bool CanGetTextExtent() const { return true; }
103 void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
104 wxCoord *descent = (wxCoord *) NULL,
105 wxCoord *externalLeading = (wxCoord *) NULL,
106 wxFont *theFont = (wxFont *) NULL ) const;
107
108 void DoGetSize(int* width, int* height) const;
109 void DoGetSizeMM(int *width, int *height) const;
110
111 // Resolution in pixels per logical inch
112 wxSize GetPPI() const;
113
114 void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
115 void SetDeviceOrigin( wxCoord x, wxCoord y );
116
117 void SetBackgroundMode(int WXUNUSED(mode)) { }
118 void SetPalette(const wxPalette& WXUNUSED(palette)) { }
119
120 wxPrintData& GetPrintData() { return m_printData; }
121 void SetPrintData(const wxPrintData& data) { m_printData = data; }
122
123 virtual int GetDepth() const { return 24; }
124
125 static void SetResolution(int ppi);
126 static int GetResolution();
127
128 void PsPrintf( const wxChar* fmt, ... );
129 void PsPrint( const char* psdata );
130 void PsPrint( int ch );
131
132 #if wxUSE_UNICODE
133 void PsPrint( const wxChar* psdata ) { PsPrint( wxConvUTF8.cWX2MB( psdata ) ); }
134 #endif
135
136 private:
137 static float ms_PSScaleFactor;
138
139 protected:
140
141 FILE* m_pstream; // PostScript output stream
142 wxString m_title;
143 unsigned char m_currentRed;
144 unsigned char m_currentGreen;
145 unsigned char m_currentBlue;
146 int m_pageNumber;
147 bool m_clipping;
148 double m_underlinePosition;
149 double m_underlineThickness;
150 wxPrintData m_printData;
151
152 private:
153 DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
154 };
155
156 #endif
157 // wxUSE_POSTSCRIPT
158
159 #endif
160 // wxUSE_PRINTING_ARCHITECTURE
161
162 #endif
163 // _WX_DCPSG_H_