]>
Commit | Line | Data |
---|---|---|
18cea871 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/dcsvg.h | |
3 | // Purpose: wxSVGFileDC | |
4 | // Author: Chris Elliott | |
5 | // Modified by: | |
6 | // Created: | |
7 | // Copyright: (c) Chris Elliott | |
8 | // RCS-ID: $Id$ | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
8e10778e VZ |
12 | #ifndef _WX_DCSVG_H_ |
13 | #define _WX_DCSVG_H_ | |
18cea871 | 14 | |
ae0fbcee | 15 | #include "wx/string.h" |
8e10778e | 16 | #include "wx/dc.h" |
e104adcd | 17 | |
b0fc907f VZ |
18 | #if wxUSE_SVG |
19 | ||
e104adcd | 20 | #define wxSVGVersion wxT("v0100") |
e104adcd | 21 | |
210bb741 CE |
22 | #ifdef __BORLANDC__ |
23 | #pragma warn -8008 | |
24 | #pragma warn -8066 | |
25 | #endif | |
26 | ||
8e10778e VZ |
27 | class WXDLLIMPEXP_FWD_BASE wxFileOutputStream; |
28 | ||
d8416992 RR |
29 | |
30 | ||
31 | #if wxUSE_NEW_DC | |
32 | class WXDLLIMPEXP_FWD_BASE wxSVGFileDC; | |
33 | ||
34 | class WXDLLIMPEXP_CORE wxSVGFileImplDC : public wxImplDC | |
35 | #else | |
36 | #define wxSVGFileImplDC wxSVGFileDC | |
54429bb3 | 37 | class WXDLLIMPEXP_CORE wxSVGFileDC : public wxDC |
d8416992 | 38 | #endif |
e104adcd | 39 | { |
621b83d9 | 40 | public: |
621b83d9 | 41 | |
d8416992 RR |
42 | #if wxUSE_NEW_DC |
43 | wxSVGFileImplDC( wxSVGFileDC *owner, const wxString &filename, | |
44 | int width=320, int height=240, double dpi=72.0 ); | |
45 | #else | |
46 | wxSVGFileDC( const wxString &filename, | |
47 | int width=320, int height=240, double dpi=72.0 ); | |
48 | #endif | |
49 | ||
50 | virtual ~wxSVGFileImplDC(); | |
51 | ||
52 | bool IsOk() const { return m_OK; } | |
8e10778e VZ |
53 | |
54 | virtual bool CanDrawBitmap() const { return true; } | |
55 | virtual bool CanGetTextExtent() const { return true; } | |
56 | ||
57 | virtual int GetDepth() const | |
58 | { | |
59 | wxFAIL_MSG(wxT("wxSVGFILEDC::GetDepth Call not implemented")); | |
60 | return -1; | |
61 | } | |
62 | ||
63 | virtual void Clear() | |
64 | { | |
65 | wxFAIL_MSG(wxT("wxSVGFILEDC::Clear() Call not implemented \nNot sensible for an output file?")); | |
66 | } | |
67 | ||
68 | virtual void DestroyClippingRegion() | |
69 | { | |
70 | wxFAIL_MSG(wxT("wxSVGFILEDC::void Call not yet implemented")); | |
71 | } | |
72 | ||
73 | virtual wxCoord GetCharHeight() const; | |
74 | virtual wxCoord GetCharWidth() const; | |
75 | ||
76 | virtual void SetClippingRegion(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), | |
77 | wxCoord WXUNUSED(w), wxCoord WXUNUSED(h)) | |
78 | { | |
79 | wxFAIL_MSG(wxT("wxSVGFILEDC::SetClippingRegion not implemented")); | |
80 | } | |
81 | ||
82 | virtual void SetPalette(const wxPalette& WXUNUSED(palette)) | |
83 | { | |
84 | wxFAIL_MSG(wxT("wxSVGFILEDC::SetPalette not implemented")); | |
85 | } | |
86 | ||
87 | virtual void GetClippingBox(wxCoord *WXUNUSED(x), wxCoord *WXUNUSED(y), | |
88 | wxCoord *WXUNUSED(w), wxCoord *WXUNUSED(h)) | |
89 | { | |
90 | wxFAIL_MSG(wxT("wxSVGFILEDC::GetClippingBox not implemented")); | |
91 | } | |
92 | ||
93 | virtual void SetLogicalFunction(int WXUNUSED(function)) | |
94 | { | |
95 | wxFAIL_MSG(wxT("wxSVGFILEDC::SetLogicalFunction Call not implemented")); | |
96 | } | |
97 | ||
98 | virtual int GetLogicalFunction() const | |
99 | { | |
100 | wxFAIL_MSG(wxT("wxSVGFILEDC::GetLogicalFunction() not implemented")); | |
101 | return -1; | |
102 | } | |
103 | ||
104 | virtual void SetBackground( const wxBrush &brush ); | |
105 | virtual void SetBackgroundMode( int mode ); | |
106 | virtual void SetBrush(const wxBrush& brush); | |
107 | virtual void SetFont(const wxFont& font); | |
108 | virtual void SetPen(const wxPen& pen); | |
109 | ||
d8416992 RR |
110 | #if wxUSE_NEW_DC |
111 | #else | |
621b83d9 RR |
112 | virtual void SetMapMode( int mode ); |
113 | virtual void SetUserScale( double x, double y ); | |
114 | virtual void SetLogicalScale( double x, double y ); | |
115 | virtual void SetLogicalOrigin( wxCoord x, wxCoord y ); | |
116 | virtual void SetDeviceOrigin( wxCoord x, wxCoord y ); | |
8e10778e | 117 | virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); |
d8416992 | 118 | #endif |
ea76a6a5 | 119 | |
621b83d9 | 120 | private: |
8e10778e VZ |
121 | virtual bool DoGetPixel(wxCoord, wxCoord, wxColour *) const |
122 | { | |
123 | wxFAIL_MSG(wxT("wxSVGFILEDC::DoGetPixel Call not implemented")); | |
124 | return true; | |
125 | } | |
126 | ||
127 | virtual bool DoBlit(wxCoord, wxCoord, wxCoord, wxCoord, wxDC *, | |
128 | wxCoord, wxCoord, int = wxCOPY, | |
129 | bool = 0, int = -1, int = -1); | |
e104adcd | 130 | |
8e10778e VZ |
131 | virtual void DoCrossHair(wxCoord, wxCoord) |
132 | { | |
133 | wxFAIL_MSG(wxT("wxSVGFILEDC::CrossHair Call not implemented")); | |
134 | } | |
e104adcd | 135 | |
8e10778e | 136 | virtual void DoDrawArc(wxCoord, wxCoord, wxCoord, wxCoord, wxCoord, wxCoord); |
e104adcd | 137 | |
8e10778e | 138 | virtual void DoDrawBitmap(const wxBitmap &, wxCoord, wxCoord, bool = 0); |
e104adcd | 139 | |
8e10778e | 140 | virtual void DoDrawCheckMark(wxCoord x, wxCoord y, wxCoord w, wxCoord h); |
e104adcd | 141 | |
8e10778e | 142 | virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h); |
e104adcd | 143 | |
8e10778e VZ |
144 | virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, |
145 | double sa, double ea); | |
e104adcd | 146 | |
8e10778e | 147 | virtual void DoDrawIcon(const wxIcon &, wxCoord, wxCoord); |
e104adcd | 148 | |
8e10778e | 149 | virtual void DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); |
e104adcd | 150 | |
8e10778e VZ |
151 | virtual void DoDrawLines(int n, wxPoint points[], |
152 | wxCoord xoffset = 0, wxCoord yoffset = 0); | |
e104adcd | 153 | |
8e10778e | 154 | virtual void DoDrawPoint(wxCoord, wxCoord); |
621b83d9 | 155 | |
8e10778e | 156 | virtual void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset,int fillStyle); |
e104adcd | 157 | |
8e10778e | 158 | virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h); |
e104adcd | 159 | |
8e10778e VZ |
160 | virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, |
161 | double angle); | |
e104adcd | 162 | |
8e10778e VZ |
163 | virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, |
164 | wxCoord w, wxCoord h, | |
165 | double radius = 20) ; | |
e104adcd | 166 | |
8e10778e | 167 | virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); |
e104adcd | 168 | |
8e10778e VZ |
169 | virtual bool DoFloodFill(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), |
170 | const wxColour& WXUNUSED(col), | |
171 | int WXUNUSED(style) = wxFLOOD_SURFACE) | |
172 | { | |
173 | wxFAIL_MSG(wxT("wxSVGFILEDC::DoFloodFill Call not implemented")); | |
174 | return false; | |
175 | } | |
e104adcd | 176 | |
8e10778e VZ |
177 | virtual void DoGetSize(int * x, int *y) const |
178 | { | |
179 | if ( x ) | |
180 | *x = m_width; | |
181 | if ( y ) | |
182 | *y = m_height; | |
183 | } | |
e104adcd | 184 | |
8e10778e VZ |
185 | virtual void DoGetTextExtent(const wxString& string, wxCoord *w, wxCoord *h, |
186 | wxCoord *descent = NULL, | |
187 | wxCoord *externalLeading = NULL, | |
188 | const wxFont *font = NULL) const; | |
e104adcd | 189 | |
8e10778e VZ |
190 | virtual void DoSetClippingRegionAsRegion(const wxRegion& WXUNUSED(region)) |
191 | { | |
d8416992 RR |
192 | wxFAIL_MSG(wxT("wxSVGFILEDC::DoSetClippingRegionAsRegion not yet implemented")); |
193 | } | |
194 | ||
195 | virtual void DoSetClippingRegion( int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height) ) | |
196 | { | |
197 | wxFAIL_MSG(wxT("wxSVGFILEDC::DoSetClippingRegion not yet implemented")); | |
8e10778e | 198 | } |
e104adcd | 199 | |
d8416992 RR |
200 | virtual void DoGetSizeMM( int *width, int *height ) const; |
201 | ||
202 | virtual wxSize GetPPI() const; | |
203 | ||
204 | void Init (const wxString &filename, int width, int height, double dpi); | |
e104adcd | 205 | |
8e10778e | 206 | void NewGraphics(); |
e104adcd | 207 | |
8e10778e | 208 | void write( const wxString &s ); |
621b83d9 RR |
209 | |
210 | private: | |
8e10778e VZ |
211 | wxFileOutputStream *m_outfile; |
212 | wxString m_filename; | |
213 | int m_sub_images; // number of png format images we have | |
214 | bool m_OK; | |
215 | bool m_graphics_changed; | |
216 | int m_width, m_height; | |
d8416992 | 217 | double m_dpi; |
8e10778e | 218 | |
621b83d9 | 219 | private: |
d8416992 RR |
220 | DECLARE_ABSTRACT_CLASS(wxSVGFileImplDC) |
221 | }; | |
222 | ||
223 | ||
224 | #if wxUSE_NEW_DC | |
225 | class WXDLLIMPEXP_CORE wxSVGFileDC : public wxDC | |
226 | { | |
227 | public: | |
228 | wxSVGFileDC( const wxString &filename, | |
229 | int width=320, int height=240, double dpi=72.0 ) | |
230 | { | |
231 | m_pimpl = new wxSVGFileImplDC( this, filename, width, height, dpi ); | |
232 | } | |
e104adcd | 233 | }; |
d8416992 RR |
234 | #endif |
235 | ||
e104adcd | 236 | |
b0fc907f VZ |
237 | #endif // wxUSE_SVG |
238 | ||
8e10778e | 239 | #endif // _WX_DCSVG_H_ |