added wxUSE_SVG
[wxWidgets.git] / include / wx / dcsvg.h
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
12 #ifndef _WX_DCSVG_H_
13 #define _WX_DCSVG_H_
14
15 #include "wx/string.h"
16 #include "wx/dc.h"
17
18 #if wxUSE_SVG
19
20 #define wxSVGVersion wxT("v0100")
21
22 #ifdef __BORLANDC__
23 #pragma warn -8008
24 #pragma warn -8066
25 #endif
26
27 class WXDLLIMPEXP_FWD_BASE wxFileOutputStream;
28
29 class WXDLLIMPEXP_CORE wxSVGFileDC : public wxDC
30 {
31 public:
32 wxSVGFileDC (wxString f);
33 wxSVGFileDC (wxString f, int Width, int Height);
34 wxSVGFileDC (wxString f, int Width, int Height, float dpi);
35
36 virtual ~wxSVGFileDC();
37
38 virtual bool CanDrawBitmap() const { return true; }
39 virtual bool CanGetTextExtent() const { return true; }
40
41 virtual int GetDepth() const
42 {
43 wxFAIL_MSG(wxT("wxSVGFILEDC::GetDepth Call not implemented"));
44 return -1;
45 }
46
47 virtual void Clear()
48 {
49 wxFAIL_MSG(wxT("wxSVGFILEDC::Clear() Call not implemented \nNot sensible for an output file?"));
50 }
51
52 virtual void DestroyClippingRegion()
53 {
54 wxFAIL_MSG(wxT("wxSVGFILEDC::void Call not yet implemented"));
55 }
56
57 virtual wxCoord GetCharHeight() const;
58 virtual wxCoord GetCharWidth() const;
59
60 virtual void SetClippingRegion(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
61 wxCoord WXUNUSED(w), wxCoord WXUNUSED(h))
62 {
63 wxFAIL_MSG(wxT("wxSVGFILEDC::SetClippingRegion not implemented"));
64 }
65
66 virtual void SetPalette(const wxPalette& WXUNUSED(palette))
67 {
68 wxFAIL_MSG(wxT("wxSVGFILEDC::SetPalette not implemented"));
69 }
70
71 virtual void GetClippingBox(wxCoord *WXUNUSED(x), wxCoord *WXUNUSED(y),
72 wxCoord *WXUNUSED(w), wxCoord *WXUNUSED(h))
73 {
74 wxFAIL_MSG(wxT("wxSVGFILEDC::GetClippingBox not implemented"));
75 }
76
77 virtual void SetLogicalFunction(int WXUNUSED(function))
78 {
79 wxFAIL_MSG(wxT("wxSVGFILEDC::SetLogicalFunction Call not implemented"));
80 }
81
82 virtual int GetLogicalFunction() const
83 {
84 wxFAIL_MSG(wxT("wxSVGFILEDC::GetLogicalFunction() not implemented"));
85 return -1;
86 }
87
88 virtual void SetBackground( const wxBrush &brush );
89 virtual void SetBackgroundMode( int mode );
90 virtual void SetBrush(const wxBrush& brush);
91 virtual void SetFont(const wxFont& font);
92 virtual void SetPen(const wxPen& pen);
93
94 virtual bool IsOk() const {return m_OK;}
95
96 virtual void SetMapMode( int mode );
97 virtual void SetUserScale( double x, double y );
98 virtual void SetLogicalScale( double x, double y );
99 virtual void SetLogicalOrigin( wxCoord x, wxCoord y );
100 virtual void SetDeviceOrigin( wxCoord x, wxCoord y );
101 virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
102
103 private:
104 virtual bool DoGetPixel(wxCoord, wxCoord, wxColour *) const
105 {
106 wxFAIL_MSG(wxT("wxSVGFILEDC::DoGetPixel Call not implemented"));
107 return true;
108 }
109
110 virtual bool DoBlit(wxCoord, wxCoord, wxCoord, wxCoord, wxDC *,
111 wxCoord, wxCoord, int = wxCOPY,
112 bool = 0, int = -1, int = -1);
113
114 virtual void DoCrossHair(wxCoord, wxCoord)
115 {
116 wxFAIL_MSG(wxT("wxSVGFILEDC::CrossHair Call not implemented"));
117 }
118
119 virtual void DoDrawArc(wxCoord, wxCoord, wxCoord, wxCoord, wxCoord, wxCoord);
120
121 virtual void DoDrawBitmap(const wxBitmap &, wxCoord, wxCoord, bool = 0);
122
123 virtual void DoDrawCheckMark(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
124
125 virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
126
127 virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
128 double sa, double ea);
129
130 virtual void DoDrawIcon(const wxIcon &, wxCoord, wxCoord);
131
132 virtual void DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
133
134 virtual void DoDrawLines(int n, wxPoint points[],
135 wxCoord xoffset = 0, wxCoord yoffset = 0);
136
137 virtual void DoDrawPoint(wxCoord, wxCoord);
138
139 virtual void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset,int fillStyle);
140
141 virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
142
143 virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
144 double angle);
145
146 virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
147 wxCoord w, wxCoord h,
148 double radius = 20) ;
149
150 virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
151
152 virtual bool DoFloodFill(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
153 const wxColour& WXUNUSED(col),
154 int WXUNUSED(style) = wxFLOOD_SURFACE)
155 {
156 wxFAIL_MSG(wxT("wxSVGFILEDC::DoFloodFill Call not implemented"));
157 return false;
158 }
159
160 virtual void DoGetSize(int * x, int *y) const
161 {
162 if ( x )
163 *x = m_width;
164 if ( y )
165 *y = m_height;
166 }
167
168 virtual void DoGetTextExtent(const wxString& string, wxCoord *w, wxCoord *h,
169 wxCoord *descent = NULL,
170 wxCoord *externalLeading = NULL,
171 const wxFont *font = NULL) const;
172
173 virtual void DoSetClippingRegionAsRegion(const wxRegion& WXUNUSED(region))
174 {
175 wxFAIL_MSG(wxT("wxSVGFILEDC::DoSetClippingRegionAsRegion Call not yet implemented"));
176 }
177
178 void Init (wxString f, int Width, int Height, float dpi);
179
180 void NewGraphics();
181
182 void write( const wxString &s );
183
184 private:
185 wxFileOutputStream *m_outfile;
186 wxString m_filename;
187 int m_sub_images; // number of png format images we have
188 bool m_OK;
189 bool m_graphics_changed;
190 int m_width, m_height;
191
192 private:
193 DECLARE_ABSTRACT_CLASS(wxSVGFileDC)
194 };
195
196 #endif // wxUSE_SVG
197
198 #endif // _WX_DCSVG_H_