]> git.saurik.com Git - wxWidgets.git/blame - include/wx/dcsvg.h
don't lock the gs_prevCS critical section recursively (replaces patch 1857581)
[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
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
27class WXDLLIMPEXP_FWD_BASE wxFileOutputStream;
28
d8416992
RR
29
30
163b3ad7 31class WXDLLIMPEXP_FWD_CORE wxSVGFileDC;
d8416992 32
888dde65 33class WXDLLIMPEXP_CORE wxSVGFileDCImpl : public wxDCImpl
e104adcd 34{
621b83d9 35public:
888dde65 36 wxSVGFileDCImpl( wxSVGFileDC *owner, const wxString &filename,
d8416992 37 int width=320, int height=240, double dpi=72.0 );
d8416992 38
888dde65 39 virtual ~wxSVGFileDCImpl();
d8416992
RR
40
41 bool IsOk() const { return m_OK; }
8e10778e
VZ
42
43 virtual bool CanDrawBitmap() const { return true; }
44 virtual bool CanGetTextExtent() const { return true; }
45
46 virtual int GetDepth() const
47 {
48 wxFAIL_MSG(wxT("wxSVGFILEDC::GetDepth Call not implemented"));
49 return -1;
50 }
51
52 virtual void Clear()
53 {
54 wxFAIL_MSG(wxT("wxSVGFILEDC::Clear() Call not implemented \nNot sensible for an output file?"));
55 }
56
57 virtual void DestroyClippingRegion()
58 {
59 wxFAIL_MSG(wxT("wxSVGFILEDC::void Call not yet implemented"));
60 }
61
62 virtual wxCoord GetCharHeight() const;
63 virtual wxCoord GetCharWidth() const;
64
65 virtual void SetClippingRegion(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
66 wxCoord WXUNUSED(w), wxCoord WXUNUSED(h))
67 {
68 wxFAIL_MSG(wxT("wxSVGFILEDC::SetClippingRegion not implemented"));
69 }
70
71 virtual void SetPalette(const wxPalette& WXUNUSED(palette))
72 {
73 wxFAIL_MSG(wxT("wxSVGFILEDC::SetPalette not implemented"));
74 }
75
76 virtual void GetClippingBox(wxCoord *WXUNUSED(x), wxCoord *WXUNUSED(y),
77 wxCoord *WXUNUSED(w), wxCoord *WXUNUSED(h))
78 {
79 wxFAIL_MSG(wxT("wxSVGFILEDC::GetClippingBox not implemented"));
80 }
81
82 virtual void SetLogicalFunction(int WXUNUSED(function))
83 {
84 wxFAIL_MSG(wxT("wxSVGFILEDC::SetLogicalFunction Call not implemented"));
85 }
86
87 virtual int GetLogicalFunction() const
88 {
89 wxFAIL_MSG(wxT("wxSVGFILEDC::GetLogicalFunction() not implemented"));
90 return -1;
91 }
92
93 virtual void SetBackground( const wxBrush &brush );
94 virtual void SetBackgroundMode( int mode );
95 virtual void SetBrush(const wxBrush& brush);
96 virtual void SetFont(const wxFont& font);
97 virtual void SetPen(const wxPen& pen);
98
621b83d9 99private:
8e10778e
VZ
100 virtual bool DoGetPixel(wxCoord, wxCoord, wxColour *) const
101 {
102 wxFAIL_MSG(wxT("wxSVGFILEDC::DoGetPixel Call not implemented"));
103 return true;
104 }
105
106 virtual bool DoBlit(wxCoord, wxCoord, wxCoord, wxCoord, wxDC *,
107 wxCoord, wxCoord, int = wxCOPY,
108 bool = 0, int = -1, int = -1);
e104adcd 109
8e10778e
VZ
110 virtual void DoCrossHair(wxCoord, wxCoord)
111 {
112 wxFAIL_MSG(wxT("wxSVGFILEDC::CrossHair Call not implemented"));
113 }
e104adcd 114
8e10778e 115 virtual void DoDrawArc(wxCoord, wxCoord, wxCoord, wxCoord, wxCoord, wxCoord);
e104adcd 116
8e10778e 117 virtual void DoDrawBitmap(const wxBitmap &, wxCoord, wxCoord, bool = 0);
e104adcd 118
8e10778e 119 virtual void DoDrawCheckMark(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
e104adcd 120
8e10778e 121 virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
e104adcd 122
8e10778e
VZ
123 virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
124 double sa, double ea);
e104adcd 125
8e10778e 126 virtual void DoDrawIcon(const wxIcon &, wxCoord, wxCoord);
e104adcd 127
8e10778e 128 virtual void DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
e104adcd 129
8e10778e
VZ
130 virtual void DoDrawLines(int n, wxPoint points[],
131 wxCoord xoffset = 0, wxCoord yoffset = 0);
e104adcd 132
8e10778e 133 virtual void DoDrawPoint(wxCoord, wxCoord);
621b83d9 134
8e10778e 135 virtual void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset,int 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),
150 int WXUNUSED(style) = wxFLOOD_SURFACE)
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
8e10778e
VZ
169 virtual void DoSetClippingRegionAsRegion(const wxRegion& WXUNUSED(region))
170 {
d8416992
RR
171 wxFAIL_MSG(wxT("wxSVGFILEDC::DoSetClippingRegionAsRegion not yet implemented"));
172 }
173
174 virtual void DoSetClippingRegion( int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height) )
175 {
176 wxFAIL_MSG(wxT("wxSVGFILEDC::DoSetClippingRegion not yet implemented"));
8e10778e 177 }
e104adcd 178
d8416992
RR
179 virtual void DoGetSizeMM( int *width, int *height ) const;
180
181 virtual wxSize GetPPI() const;
182
183 void Init (const wxString &filename, int width, int height, double dpi);
e104adcd 184
8e10778e 185 void NewGraphics();
e104adcd 186
8e10778e 187 void write( const wxString &s );
621b83d9
RR
188
189private:
8e10778e
VZ
190 wxFileOutputStream *m_outfile;
191 wxString m_filename;
192 int m_sub_images; // number of png format images we have
193 bool m_OK;
194 bool m_graphics_changed;
195 int m_width, m_height;
d8416992 196 double m_dpi;
8e10778e 197
621b83d9 198private:
888dde65 199 DECLARE_ABSTRACT_CLASS(wxSVGFileDCImpl)
d8416992
RR
200};
201
202
d8416992
RR
203class WXDLLIMPEXP_CORE wxSVGFileDC : public wxDC
204{
205public:
f0875501
VZ
206 wxSVGFileDC(const wxString& filename,
207 int width = 320,
208 int height = 240,
209 double dpi = 72.0)
210 : wxDC(new wxSVGFileDCImpl(this, filename, width, height, dpi))
d8416992 211 {
d8416992 212 }
e104adcd
CE
213};
214
b0fc907f
VZ
215#endif // wxUSE_SVG
216
8e10778e 217#endif // _WX_DCSVG_H_