]> git.saurik.com Git - wxWidgets.git/blame - include/wx/dcsvg.h
Try loading even English translations if provided.
[wxWidgets.git] / include / wx / dcsvg.h
CommitLineData
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
18cea871
RD
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
8e10778e
VZ
11#ifndef _WX_DCSVG_H_
12#define _WX_DCSVG_H_
18cea871 13
ae0fbcee 14#include "wx/string.h"
8e10778e 15#include "wx/dc.h"
e104adcd 16
b0fc907f
VZ
17#if wxUSE_SVG
18
e104adcd 19#define wxSVGVersion wxT("v0100")
e104adcd 20
210bb741
CE
21#ifdef __BORLANDC__
22#pragma warn -8008
23#pragma warn -8066
24#endif
25
8e10778e
VZ
26class WXDLLIMPEXP_FWD_BASE wxFileOutputStream;
27
d8416992
RR
28
29
163b3ad7 30class WXDLLIMPEXP_FWD_CORE wxSVGFileDC;
d8416992 31
888dde65 32class WXDLLIMPEXP_CORE wxSVGFileDCImpl : public wxDCImpl
e104adcd 33{
621b83d9 34public:
03647350 35 wxSVGFileDCImpl( wxSVGFileDC *owner, const wxString &filename,
d8416992 36 int width=320, int height=240, double dpi=72.0 );
d8416992 37
888dde65 38 virtual ~wxSVGFileDCImpl();
03647350 39
d8416992 40 bool IsOk() const { return m_OK; }
8e10778e
VZ
41
42 virtual bool CanDrawBitmap() const { return true; }
43 virtual bool CanGetTextExtent() const { return true; }
44
45 virtual int GetDepth() const
46 {
47 wxFAIL_MSG(wxT("wxSVGFILEDC::GetDepth Call not implemented"));
48 return -1;
49 }
50
51 virtual void Clear()
52 {
53 wxFAIL_MSG(wxT("wxSVGFILEDC::Clear() Call not implemented \nNot sensible for an output file?"));
54 }
55
614e38db 56 virtual void DestroyClippingRegion();
8e10778e
VZ
57
58 virtual wxCoord GetCharHeight() const;
59 virtual wxCoord GetCharWidth() const;
60
61 virtual void SetClippingRegion(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
62 wxCoord WXUNUSED(w), wxCoord WXUNUSED(h))
63 {
64 wxFAIL_MSG(wxT("wxSVGFILEDC::SetClippingRegion not implemented"));
65 }
66
67 virtual void SetPalette(const wxPalette& WXUNUSED(palette))
68 {
69 wxFAIL_MSG(wxT("wxSVGFILEDC::SetPalette not implemented"));
70 }
71
72 virtual void GetClippingBox(wxCoord *WXUNUSED(x), wxCoord *WXUNUSED(y),
73 wxCoord *WXUNUSED(w), wxCoord *WXUNUSED(h))
74 {
75 wxFAIL_MSG(wxT("wxSVGFILEDC::GetClippingBox not implemented"));
76 }
77
89efaf2b 78 virtual void SetLogicalFunction(wxRasterOperationMode WXUNUSED(function))
8e10778e
VZ
79 {
80 wxFAIL_MSG(wxT("wxSVGFILEDC::SetLogicalFunction Call not implemented"));
81 }
82
89efaf2b 83 virtual wxRasterOperationMode GetLogicalFunction() const
8e10778e
VZ
84 {
85 wxFAIL_MSG(wxT("wxSVGFILEDC::GetLogicalFunction() not implemented"));
89efaf2b 86 return wxCOPY;
8e10778e
VZ
87 }
88
89 virtual void SetBackground( const wxBrush &brush );
90 virtual void SetBackgroundMode( int mode );
91 virtual void SetBrush(const wxBrush& brush);
92 virtual void SetFont(const wxFont& font);
93 virtual void SetPen(const wxPen& pen);
94
9eefb5c1
RD
95 virtual void* GetHandle() const { return NULL; }
96
621b83d9 97private:
8e10778e
VZ
98 virtual bool DoGetPixel(wxCoord, wxCoord, wxColour *) const
99 {
100 wxFAIL_MSG(wxT("wxSVGFILEDC::DoGetPixel Call not implemented"));
101 return true;
102 }
103
104 virtual bool DoBlit(wxCoord, wxCoord, wxCoord, wxCoord, wxDC *,
89efaf2b 105 wxCoord, wxCoord, wxRasterOperationMode = wxCOPY,
8e10778e 106 bool = 0, int = -1, int = -1);
e104adcd 107
8e10778e
VZ
108 virtual void DoCrossHair(wxCoord, wxCoord)
109 {
110 wxFAIL_MSG(wxT("wxSVGFILEDC::CrossHair Call not implemented"));
111 }
e104adcd 112
8e10778e 113 virtual void DoDrawArc(wxCoord, wxCoord, wxCoord, wxCoord, wxCoord, wxCoord);
e104adcd 114
2a230426 115 virtual void DoDrawBitmap(const wxBitmap &, wxCoord, wxCoord, bool = false);
e104adcd 116
8e10778e 117 virtual void DoDrawCheckMark(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
e104adcd 118
8e10778e 119 virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
e104adcd 120
8e10778e
VZ
121 virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
122 double sa, double ea);
e104adcd 123
8e10778e 124 virtual void DoDrawIcon(const wxIcon &, wxCoord, wxCoord);
e104adcd 125
8e10778e 126 virtual void DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
e104adcd 127
4787c92d 128 virtual void DoDrawLines(int n, const wxPoint points[],
8e10778e 129 wxCoord xoffset = 0, wxCoord yoffset = 0);
e104adcd 130
8e10778e 131 virtual void DoDrawPoint(wxCoord, wxCoord);
621b83d9 132
4787c92d 133 virtual void DoDrawPolygon(int n, const wxPoint points[],
89efaf2b
FM
134 wxCoord xoffset, wxCoord yoffset,
135 wxPolygonFillMode fillStyle);
e104adcd 136
8e10778e 137 virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
e104adcd 138
8e10778e
VZ
139 virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
140 double angle);
e104adcd 141
8e10778e
VZ
142 virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
143 wxCoord w, wxCoord h,
144 double radius = 20) ;
e104adcd 145
8e10778e 146 virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
e104adcd 147
8e10778e
VZ
148 virtual bool DoFloodFill(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
149 const wxColour& WXUNUSED(col),
89efaf2b 150 wxFloodFillStyle WXUNUSED(style) = wxFLOOD_SURFACE)
8e10778e
VZ
151 {
152 wxFAIL_MSG(wxT("wxSVGFILEDC::DoFloodFill Call not implemented"));
153 return false;
154 }
e104adcd 155
8e10778e
VZ
156 virtual void DoGetSize(int * x, int *y) const
157 {
158 if ( x )
159 *x = m_width;
160 if ( y )
161 *y = m_height;
162 }
e104adcd 163
8e10778e
VZ
164 virtual void DoGetTextExtent(const wxString& string, wxCoord *w, wxCoord *h,
165 wxCoord *descent = NULL,
166 wxCoord *externalLeading = NULL,
167 const wxFont *font = NULL) const;
e104adcd 168
fdaad94e 169 virtual void DoSetDeviceClippingRegion(const wxRegion& WXUNUSED(region))
8e10778e 170 {
fdaad94e 171 wxFAIL_MSG(wxT("wxSVGFILEDC::DoSetDeviceClippingRegion not yet implemented"));
d8416992
RR
172 }
173
614e38db 174 virtual void DoSetClippingRegion(int x, int y, int width, int height);
e104adcd 175
d8416992 176 virtual void DoGetSizeMM( int *width, int *height ) const;
03647350 177
d8416992
RR
178 virtual wxSize GetPPI() const;
179
180 void Init (const wxString &filename, int width, int height, double dpi);
e104adcd 181
8e10778e 182 void write( const wxString &s );
621b83d9
RR
183
184private:
c9848e63
VZ
185 // If m_graphics_changed is true, close the current <g> element and start a
186 // new one for the last pen/brush change.
187 void NewGraphicsIfNeeded();
188
614e38db
VZ
189 // Open a new graphics group setting up all the attributes according to
190 // their current values in wxDC.
191 void DoStartNewGraphics();
192
8e10778e
VZ
193 wxFileOutputStream *m_outfile;
194 wxString m_filename;
195 int m_sub_images; // number of png format images we have
196 bool m_OK;
c9848e63 197 bool m_graphics_changed; // set by Set{Brush,Pen}()
8e10778e 198 int m_width, m_height;
d8416992 199 double m_dpi;
8e10778e 200
614e38db
VZ
201 // The clipping nesting level is incremented by every call to
202 // SetClippingRegion() and reset when DestroyClippingRegion() is called.
203 size_t m_clipNestingLevel;
204
205 // Unique ID for every clipping graphics group: this is simply always
206 // incremented in each SetClippingRegion() call.
207 size_t m_clipUniqueId;
208
888dde65 209 DECLARE_ABSTRACT_CLASS(wxSVGFileDCImpl)
d8416992
RR
210};
211
212
d8416992
RR
213class WXDLLIMPEXP_CORE wxSVGFileDC : public wxDC
214{
215public:
03647350 216 wxSVGFileDC(const wxString& filename,
f0875501
VZ
217 int width = 320,
218 int height = 240,
219 double dpi = 72.0)
220 : wxDC(new wxSVGFileDCImpl(this, filename, width, height, dpi))
03647350 221 {
d8416992 222 }
e104adcd
CE
223};
224
b0fc907f
VZ
225#endif // wxUSE_SVG
226
8e10778e 227#endif // _WX_DCSVG_H_