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