]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/dcpsg.h
added and documented wxDEFINE_SCOPED_PTR_TYPE; improved docs a bit
[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 #if WXWIN_COMPATIBILITY_2_2
50 wxPostScriptDC( const wxString &output, bool interactive = FALSE, wxWindow *parent = NULL )
51 { Create( output, interactive, parent ); }
52 bool Create ( const wxString &output, bool interactive = FALSE, wxWindow *parent = NULL );
53 #endif
54
55 virtual bool Ok() const;
56
57 virtual void BeginDrawing() {}
58 virtual void EndDrawing() {}
59
60 bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE );
61 bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;
62
63 void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
64 void DoCrossHair(wxCoord x, wxCoord y) ;
65 void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc);
66 void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea);
67 void DoDrawPoint(wxCoord x, wxCoord y);
68 void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
69 void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle=wxODDEVEN_RULE);
70 void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
71 void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20);
72 void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
73
74 void DoDrawSpline(wxList *points);
75
76 bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
77 wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = FALSE,
78 wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
79 bool CanDrawBitmap() const { return TRUE; }
80
81 void DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y );
82 void DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask=FALSE );
83
84 void DoDrawText(const wxString& text, wxCoord x, wxCoord y );
85 void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
86
87 void Clear();
88 void SetFont( const wxFont& font );
89 void SetPen( const wxPen& pen );
90 void SetBrush( const wxBrush& brush );
91 void SetLogicalFunction( int function );
92 void SetBackground( const wxBrush& brush );
93
94 void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
95 void DestroyClippingRegion();
96
97 void DoSetClippingRegionAsRegion( const wxRegion &WXUNUSED(clip) ) { }
98
99 bool StartDoc(const wxString& message);
100 void EndDoc();
101 void StartPage();
102 void EndPage();
103
104 wxCoord GetCharHeight() const;
105 wxCoord GetCharWidth() const;
106 bool CanGetTextExtent() const { return TRUE; }
107 void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
108 wxCoord *descent = (wxCoord *) NULL,
109 wxCoord *externalLeading = (wxCoord *) NULL,
110 wxFont *theFont = (wxFont *) NULL ) const;
111
112 void DoGetSize(int* width, int* height) const;
113 void DoGetSizeMM(int *width, int *height) const;
114
115 // Resolution in pixels per logical inch
116 wxSize GetPPI() const;
117
118 void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
119 void SetDeviceOrigin( wxCoord x, wxCoord y );
120
121 void SetBackgroundMode(int WXUNUSED(mode)) { }
122 void SetPalette(const wxPalette& WXUNUSED(palette)) { }
123
124 wxPrintData& GetPrintData() { return m_printData; }
125 void SetPrintData(const wxPrintData& data) { m_printData = data; }
126
127 virtual int GetDepth() const { return 24; }
128
129 static void SetResolution(int ppi);
130 static int GetResolution();
131
132 private:
133 static float ms_PSScaleFactor;
134
135 protected:
136 #if wxUSE_PANGO
137 PangoContext *m_context;
138 PangoLayout *m_layout;
139 PangoFontDescription *m_fontdesc;
140 #endif
141
142 FILE* m_pstream; // PostScript output stream
143 wxString m_title;
144 unsigned char m_currentRed;
145 unsigned char m_currentGreen;
146 unsigned char m_currentBlue;
147 int m_pageNumber;
148 bool m_clipping;
149 double m_underlinePosition;
150 double m_underlineThickness;
151 wxPrintData m_printData;
152
153 private:
154 DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
155 };
156
157
158 #if WXWIN_COMPATIBILITY_2_2
159 // Print Orientation
160 enum
161 {
162 PS_PORTRAIT = wxPORTRAIT,
163 PS_LANDSCAPE = wxLANDSCAPE
164 };
165
166 // Print Actions
167 enum
168 {
169 PS_NONE = wxPRINT_MODE_NONE,
170 PS_PREVIEW = wxPRINT_MODE_PREVIEW,
171 PS_FILE = wxPRINT_MODE_FILE,
172 PS_PRINTER = wxPRINT_MODE_PRINTER
173 };
174
175 class wxPrintSetupData: public wxPrintData
176 {
177 public:
178 wxPrintSetupData() {}
179
180 void SetPrinterOrientation( int orient )
181 { SetOrientation( orient ); }
182 void SetPrinterMode( wxPrintMode mode )
183 { SetPrintMode( mode ); }
184 void SetAFMPath( const wxString &path )
185 { SetFontMetricPath( path ); }
186
187 void SetPaperName(const wxString& paper) { m_paperName = paper; }
188 void SetPrinterFile(const wxString& file) { m_printerFile = file; }
189 wxString GetPaperName() const { return m_paperName; }
190 wxString GetPrinterFile() const { return m_printerFile; };
191
192 wxString m_paperName;
193 wxString m_printerFile;
194 };
195
196 WXDLLEXPORT_DATA(extern wxPrintSetupData*) wxThePrintSetupData;
197 WXDLLEXPORT extern void wxInitializePrintSetupData(bool init = TRUE);
198 #endif
199
200
201 #endif
202 // wxUSE_POSTSCRIPT
203
204 #endif
205 // wxUSE_PRINTING_ARCHITECTURE
206
207 #endif
208 // _WX_DCPSG_H_