]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/dcpsg.h
Use correct reload flags on all platforms to avoid compilation errors
[wxWidgets.git] / include / wx / generic / dcpsg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/dcpsg.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 #include "wx/defs.h"
15
16 #if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT
17
18 #include "wx/dc.h"
19 #include "wx/dcprint.h"
20 #include "wx/dialog.h"
21 #include "wx/module.h"
22 #include "wx/cmndata.h"
23 #include "wx/strvararg.h"
24
25 //-----------------------------------------------------------------------------
26 // wxPostScriptDC
27 //-----------------------------------------------------------------------------
28
29
30 class WXDLLIMPEXP_CORE wxPostScriptDC : public wxDC
31 {
32 public:
33 wxPostScriptDC();
34
35 // Recommended constructor
36 wxPostScriptDC(const wxPrintData& printData);
37
38 private:
39 DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
40 };
41
42 class WXDLLIMPEXP_CORE wxPostScriptDCImpl : public wxDCImpl
43 {
44 public:
45 wxPostScriptDCImpl( wxPrinterDC *owner );
46 wxPostScriptDCImpl( wxPrinterDC *owner, const wxPrintData& data );
47 wxPostScriptDCImpl( wxPostScriptDC *owner );
48 wxPostScriptDCImpl( wxPostScriptDC *owner, const wxPrintData& data );
49
50 void Init();
51
52 virtual ~wxPostScriptDCImpl();
53
54 virtual bool Ok() const { return IsOk(); }
55 virtual bool IsOk() const;
56
57 bool CanDrawBitmap() const { return true; }
58
59 void Clear();
60 void SetFont( const wxFont& font );
61 void SetPen( const wxPen& pen );
62 void SetBrush( const wxBrush& brush );
63 void SetLogicalFunction( wxRasterOperationMode function );
64 void SetBackground( const wxBrush& brush );
65
66 void DestroyClippingRegion();
67
68 bool StartDoc(const wxString& message);
69 void EndDoc();
70 void StartPage();
71 void EndPage();
72
73 wxCoord GetCharHeight() const;
74 wxCoord GetCharWidth() const;
75 bool CanGetTextExtent() const { return true; }
76
77 // Resolution in pixels per logical inch
78 wxSize GetPPI() const;
79
80 virtual void ComputeScaleAndOrigin();
81
82 void SetBackgroundMode(int WXUNUSED(mode)) { }
83 void SetPalette(const wxPalette& WXUNUSED(palette)) { }
84
85 void SetPrintData(const wxPrintData& data);
86 wxPrintData& GetPrintData() { return m_printData; }
87
88 virtual int GetDepth() const { return 24; }
89
90 void PsPrint( const wxString& psdata );
91
92 // Overrridden for wxPrinterDC Impl
93
94 virtual int GetResolution() const;
95 virtual wxRect GetPaperRect() const;
96
97 protected:
98 bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col,
99 wxFloodFillStyle style = wxFLOOD_SURFACE);
100 bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;
101 void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
102 void DoCrossHair(wxCoord x, wxCoord y) ;
103 void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc);
104 void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea);
105 void DoDrawPoint(wxCoord x, wxCoord y);
106 void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
107 void DoDrawPolygon(int n, wxPoint points[],
108 wxCoord xoffset = 0, wxCoord yoffset = 0,
109 wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
110 void DoDrawPolyPolygon(int n, int count[], wxPoint points[],
111 wxCoord xoffset = 0, wxCoord yoffset = 0,
112 wxPolygonFillMode 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(const wxPointList *points);
118 #endif
119 bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
120 wxDC *source, wxCoord xsrc, wxCoord ysrc,
121 wxRasterOperationMode rop = wxCOPY, bool useMask = false,
122 wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
123 void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
124 void DoDrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false);
125 void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
126 void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
127 void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
128 void DoSetDeviceClippingRegion( const wxRegion &WXUNUSED(clip))
129 {
130 wxFAIL_MSG( "not implemented" );
131 }
132 void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
133 wxCoord *descent = NULL,
134 wxCoord *externalLeading = NULL,
135 const wxFont *theFont = NULL) const;
136 void DoGetSize(int* width, int* height) const;
137 void DoGetSizeMM(int *width, int *height) const;
138
139 FILE* m_pstream; // PostScript output stream
140 unsigned char m_currentRed;
141 unsigned char m_currentGreen;
142 unsigned char m_currentBlue;
143 int m_pageNumber;
144 bool m_clipping;
145 double m_underlinePosition;
146 double m_underlineThickness;
147 wxPrintData m_printData;
148 double m_pageHeight;
149
150 private:
151 DECLARE_DYNAMIC_CLASS(wxPostScriptDCImpl)
152 };
153
154 #endif
155 // wxUSE_POSTSCRIPT && wxUSE_PRINTING_ARCHITECTURE
156
157 #endif
158 // _WX_DCPSG_H_