]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/dcpsg.h
Compilation fix for VC++ 5 and 6
[wxWidgets.git] / include / wx / generic / dcpsg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: 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 void DoDrawSpline(wxList *points);
70
71 bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
72 wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false,
73 wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
74 bool CanDrawBitmap() const { return true; }
75
76 void DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y );
77 void DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false );
78
79 void DoDrawText(const wxString& text, wxCoord x, wxCoord y );
80 void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
81
82 void Clear();
83 void SetFont( const wxFont& font );
84 void SetPen( const wxPen& pen );
85 void SetBrush( const wxBrush& brush );
86 void SetLogicalFunction( int function );
87 void SetBackground( const wxBrush& brush );
88
89 void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
90 void DestroyClippingRegion();
91
92 void DoSetClippingRegionAsRegion( const wxRegion &WXUNUSED(clip) ) { }
93
94 bool StartDoc(const wxString& message);
95 void EndDoc();
96 void StartPage();
97 void EndPage();
98
99 wxCoord GetCharHeight() const;
100 wxCoord GetCharWidth() const;
101 bool CanGetTextExtent() const { return true; }
102 void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
103 wxCoord *descent = (wxCoord *) NULL,
104 wxCoord *externalLeading = (wxCoord *) NULL,
105 wxFont *theFont = (wxFont *) NULL ) const;
106
107 void DoGetSize(int* width, int* height) const;
108 void DoGetSizeMM(int *width, int *height) const;
109
110 // Resolution in pixels per logical inch
111 wxSize GetPPI() const;
112
113 void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
114 void SetDeviceOrigin( wxCoord x, wxCoord y );
115
116 void SetBackgroundMode(int WXUNUSED(mode)) { }
117 void SetPalette(const wxPalette& WXUNUSED(palette)) { }
118
119 wxPrintData& GetPrintData() { return m_printData; }
120 void SetPrintData(const wxPrintData& data) { m_printData = data; }
121
122 virtual int GetDepth() const { return 24; }
123
124 static void SetResolution(int ppi);
125 static int GetResolution();
126
127 void PsPrintf( const wxChar* fmt, ... );
128 void PsPrint( const char* psdata );
129 void PsPrint( int ch );
130
131 #if wxUSE_UNICODE
132 void PsPrint( const wxChar* psdata ) { PsPrint( wxConvUTF8.cWX2MB( psdata ) ); }
133 #endif
134
135 private:
136 static float ms_PSScaleFactor;
137
138 protected:
139
140 FILE* m_pstream; // PostScript output stream
141 wxString m_title;
142 unsigned char m_currentRed;
143 unsigned char m_currentGreen;
144 unsigned char m_currentBlue;
145 int m_pageNumber;
146 bool m_clipping;
147 double m_underlinePosition;
148 double m_underlineThickness;
149 wxPrintData m_printData;
150
151 private:
152 DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
153 };
154
155 #endif
156 // wxUSE_POSTSCRIPT
157
158 #endif
159 // wxUSE_PRINTING_ARCHITECTURE
160
161 #endif
162 // _WX_DCPSG_H_