]> git.saurik.com Git - wxWidgets.git/blame - samples/svg/svgtest.cpp
Always link with expat in monolithic build.
[wxWidgets.git] / samples / svg / svgtest.cpp
CommitLineData
cdf3a589
CE
1/////////////////////////////////////////////////////////////////////////////
2// Name: svgtest.cpp
3// Purpose: SVG sample
4// Author: Chris Elliott
5// Modified by:
6// RCS-ID: $Id$
526954c5 7// Licence: wxWindows licence
cdf3a589
CE
8/////////////////////////////////////////////////////////////////////////////
9
10// ===========================================================================
11// declarations
12// ===========================================================================
13
14// ---------------------------------------------------------------------------
15// headers
16// ---------------------------------------------------------------------------
17
18// For compilers that support precompilation, includes "wx/wx.h".
19#include "wx/wxprec.h"
20
21#ifdef __BORLANDC__
22#pragma hdrstop
23#endif
24
25#ifndef WX_PRECOMP
26#include "wx/wx.h"
27#include "wx/mdi.h"
28#endif
29
ae0fbcee 30#include "wx/toolbar.h"
18cea871 31#include "wx/dcsvg.h"
49e3b82c 32#include "wx/vector.h"
cdf3a589
CE
33
34#include "bitmaps/new.xpm"
35#include "bitmaps/save.xpm"
36#include "bitmaps/help.xpm"
37#include "SVGlogo24.xpm"
a5e6cfa8 38
3cb332c1
VZ
39#if !defined(__WXMSW__) && !defined(__WXPM__)
40 #include "../sample.xpm"
41#endif
42
cdf3a589 43class MyChild;
49e3b82c
FM
44class MyCanvas;
45
46// ---------------------------------------------------------------------------
47// classes
48// ---------------------------------------------------------------------------
cdf3a589 49
cdf3a589
CE
50class MyApp : public wxApp
51{
49e3b82c
FM
52public:
53 bool OnInit();
cdf3a589
CE
54};
55
cdf3a589
CE
56class MyFrame : public wxMDIParentFrame
57{
49e3b82c
FM
58public:
59 MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
cdf3a589
CE
60 const wxPoint& pos, const wxSize& size, const long style);
61
49e3b82c
FM
62 void InitToolBar(wxToolBar* toolBar);
63
64 void OnSize(wxSizeEvent& event);
65 void OnAbout(wxCommandEvent& event);
66 void OnNewWindow(wxCommandEvent& event);
67 void OnQuit(wxCommandEvent& event);
68 void FileSavePicture (wxCommandEvent& event);
ce00f59b 69
49e3b82c
FM
70 unsigned int GetCountOfChildren() const
71 { return m_nWinCreated; }
72
73private:
74 unsigned int m_nWinCreated;
ce00f59b 75
49e3b82c 76 DECLARE_EVENT_TABLE()
cdf3a589
CE
77};
78
49e3b82c 79class MyChild: public wxMDIChildFrame
cdf3a589 80{
49e3b82c 81public:
ce00f59b
VZ
82 MyChild(wxMDIParentFrame *parent, const wxString& title,
83 const wxPoint& pos = wxDefaultPosition,
84 const wxSize& size = wxDefaultSize,
49e3b82c
FM
85 const long style = wxDEFAULT_FRAME_STYLE);
86 ~MyChild();
87
88 void OnActivate(wxActivateEvent& event);
89 void OnQuit(wxCommandEvent& event);
90 bool OnSave(wxString filename);
ce00f59b 91
49e3b82c
FM
92 MyFrame* GetFrame()
93 { return m_frame; }
94
95private:
96 MyCanvas *m_canvas;
97 MyFrame *m_frame;
98
99 DECLARE_EVENT_TABLE()
cdf3a589
CE
100};
101
49e3b82c 102class MyCanvas : public wxScrolledWindow
cdf3a589 103{
49e3b82c
FM
104public:
105 MyCanvas(MyChild *parent, const wxPoint& pos, const wxSize& size);
106 virtual void OnDraw(wxDC& dc);
107
108private:
109 int m_index;
110 MyChild* m_child;
ce00f59b 111
49e3b82c 112 DECLARE_EVENT_TABLE()
cdf3a589
CE
113};
114
49e3b82c
FM
115// ---------------------------------------------------------------------------
116// constants
117// ---------------------------------------------------------------------------
118
cdf3a589
CE
119// menu items ids
120enum
121{
122 MDI_QUIT = 100,
123 MDI_NEW_WINDOW,
124 MDI_SAVE,
125 MDI_REFRESH,
126 MDI_CHILD_QUIT,
127 MDI_ABOUT
128};
129
cdf3a589
CE
130// ---------------------------------------------------------------------------
131// event tables
132// ---------------------------------------------------------------------------
133
134BEGIN_EVENT_TABLE(MyFrame, wxMDIParentFrame)
49e3b82c
FM
135 EVT_MENU(MDI_ABOUT, MyFrame::OnAbout)
136 EVT_MENU(MDI_NEW_WINDOW, MyFrame::OnNewWindow)
137 EVT_MENU(MDI_QUIT, MyFrame::OnQuit)
138 EVT_MENU (MDI_SAVE, MyFrame::FileSavePicture)
cdf3a589 139
49e3b82c 140 EVT_SIZE(MyFrame::OnSize)
cdf3a589
CE
141END_EVENT_TABLE()
142
143// ===========================================================================
144// implementation
145// ===========================================================================
146
147// ---------------------------------------------------------------------------
148// MyApp
149// ---------------------------------------------------------------------------
150
49e3b82c
FM
151IMPLEMENT_APP(MyApp)
152
cdf3a589
CE
153bool MyApp::OnInit()
154{
155 // Create the main frame window
156
49e3b82c
FM
157 MyFrame* frame = new MyFrame((wxFrame *)NULL, -1, wxT("SVG Demo"),
158 wxDefaultPosition, wxSize(500, 400),
159 wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL);
cdf3a589 160
d96cdd4a 161 frame->Show(true);
cdf3a589 162
c54e5eb0 163 return true;
cdf3a589
CE
164}
165
166
167// ---------------------------------------------------------------------------
168// MyFrame
169// ---------------------------------------------------------------------------
170
171// Define my frame constructor
172MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
49e3b82c 173 const wxPoint& pos, const wxSize& size, const long style)
cdf3a589
CE
174 : wxMDIParentFrame(parent, id, title, pos, size, style)
175{
49e3b82c 176 m_nWinCreated = 0;
cdf3a589 177
3cb332c1 178 SetIcon(wxICON(sample));
cdf3a589 179
49e3b82c
FM
180 // Make a menubar
181 wxMenu *file_menu = new wxMenu;
cdf3a589 182
49e3b82c
FM
183 file_menu->Append(MDI_NEW_WINDOW, wxT("&New test\tCtrl+N"));
184 file_menu->Append(MDI_QUIT, wxT("&Exit\tAlt+X"));
cdf3a589 185
49e3b82c
FM
186 wxMenu *help_menu = new wxMenu;
187 help_menu->Append(MDI_ABOUT, wxT("&About"));
cdf3a589 188
49e3b82c 189 wxMenuBar *menu_bar = new wxMenuBar;
cdf3a589 190
49e3b82c
FM
191 menu_bar->Append(file_menu, wxT("&File"));
192 menu_bar->Append(help_menu, wxT("&Help"));
193
194 // Associate the menu bar with the frame
195 SetMenuBar(menu_bar);
196
197#if wxUSE_STATUSBAR
198 CreateStatusBar();
199#endif // wxUSE_STATUSBAR
200
201 CreateToolBar(wxNO_BORDER | wxTB_FLAT | wxTB_HORIZONTAL);
202 InitToolBar(GetToolBar());
203}
cdf3a589
CE
204
205void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
206{
207 Close();
208}
209
cdf3a589
CE
210void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
211{
49e3b82c
FM
212 (void)wxMessageBox(wxT("wxWidgets SVG sample\n")
213 wxT("Author: Chris Elliott (c) 2002-2009\n")
ce00f59b 214 wxT("Usage: click File|New to show tests"),
49e3b82c 215 wxT("About SVG Test"));
cdf3a589
CE
216}
217
cdf3a589
CE
218void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event) )
219{
220 // Make another frame, containing a canvas
49e3b82c 221 MyChild *subframe = new MyChild(this, wxT("SVG Frame"));
cdf3a589 222
cdf3a589 223 wxString title;
49e3b82c 224 title.Printf(wxT("SVG Test Window %d"), m_nWinCreated );
ce00f59b 225
cdf3a589 226 // counts number of children previously, even if now closed
49e3b82c 227 m_nWinCreated ++;
cdf3a589
CE
228
229 // Give it a title and icon
230 subframe->SetTitle(title);
3cb332c1 231 subframe->SetIcon(wxICON(sample));
cdf3a589
CE
232
233 // Make a menubar
234 wxMenu *file_menu = new wxMenu;
235
236 file_menu->Append(MDI_NEW_WINDOW, wxT("&Another test\tCtrl+N"));
237 file_menu->Append(MDI_SAVE, wxT("&Save\tCtrl+S"), wxT("Save in SVG format"));
238 file_menu->Append(MDI_CHILD_QUIT, wxT("&Close child\tCtrl+F4"));
239 file_menu->Append(MDI_QUIT, wxT("&Exit\tAlt+X"));
240
241 wxMenu *help_menu = new wxMenu;
242 help_menu->Append(MDI_ABOUT, wxT("&About"));
243
244 wxMenuBar *menu_bar = new wxMenuBar;
245
246 menu_bar->Append(file_menu, wxT("&File"));
247 menu_bar->Append(help_menu, wxT("&Help"));
248
249 // Associate the menu bar with the frame
250 subframe->SetMenuBar(menu_bar);
251
c54e5eb0 252 subframe->Show(true);
cdf3a589
CE
253}
254
756d3e7f 255void MyFrame::OnSize(wxSizeEvent& event)
cdf3a589
CE
256{
257 int w, h;
258 GetClientSize(&w, &h);
259
260 GetClientWindow()->SetSize(0, 0, w, h);
756d3e7f 261 event.Skip();
cdf3a589
CE
262}
263
cdf3a589
CE
264void MyFrame::InitToolBar(wxToolBar* toolBar)
265{
49e3b82c 266 const int maxBitmaps = 3;
cdf3a589
CE
267 wxBitmap* bitmaps[maxBitmaps];
268
269 bitmaps[0] = new wxBitmap( new_xpm );
270 bitmaps[1] = new wxBitmap( save_xpm );
271 bitmaps[2] = new wxBitmap( help_xpm );
272
bbe28fbb
PC
273 toolBar->AddTool(MDI_NEW_WINDOW, wxEmptyString, *(bitmaps[0]), wxS("New SVG test window"));
274 toolBar->AddTool(MDI_SAVE, wxEmptyString, *bitmaps[1], wxS("Save test in SVG format"));
a5e6cfa8 275 toolBar->AddSeparator();
bbe28fbb 276 toolBar->AddTool(MDI_ABOUT, wxEmptyString, *bitmaps[2], wxS("Help"));
cdf3a589
CE
277
278 toolBar->Realize();
279
280 int i;
281 for (i = 0; i < maxBitmaps; i++)
282 delete bitmaps[i];
283}
284
cdf3a589
CE
285void MyFrame::FileSavePicture (wxCommandEvent & WXUNUSED(event) )
286{
c54e5eb0 287#if wxUSE_FILEDLG
49e3b82c 288 MyChild * pChild = (MyChild *)GetActiveChild();
a5e6cfa8 289 if (pChild == NULL)
cdf3a589 290 {
49e3b82c 291 return;
cdf3a589
CE
292 }
293
294 wxFileDialog dialog(this, wxT("Save Picture as"), wxEmptyString, pChild->GetTitle(),
295 wxT("SVG vector picture files (*.svg)|*.svg"),
ff3e84ff 296 wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
cdf3a589
CE
297
298 if (dialog.ShowModal() == wxID_OK)
299 {
49e3b82c 300 if (!pChild->OnSave ( dialog.GetPath() ))
cdf3a589 301 {
49e3b82c 302 return;
cdf3a589
CE
303 }
304 }
49e3b82c 305 return;
c54e5eb0 306#endif // wxUSE_FILEDLG
cdf3a589
CE
307}
308
309
cdf3a589
CE
310// ---------------------------------------------------------------------------
311// MyCanvas
312// ---------------------------------------------------------------------------
313
49e3b82c
FM
314BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
315END_EVENT_TABLE()
316
cdf3a589 317// Define a constructor for my canvas
49e3b82c
FM
318MyCanvas::MyCanvas(MyChild *parent, const wxPoint& pos, const wxSize& size)
319 : wxScrolledWindow(parent, wxID_ANY, pos, size, wxSUNKEN_BORDER|wxVSCROLL|wxHSCROLL)
cdf3a589 320{
9a83f860 321 SetBackgroundColour(wxColour(wxT("WHITE")));
cdf3a589 322
49e3b82c
FM
323 m_child = parent;
324 m_index = m_child->GetFrame()->GetCountOfChildren() % 7;
325}
cdf3a589
CE
326
327// Define the repainting behaviour
328void MyCanvas::OnDraw(wxDC& dc)
329{
330 // vars to use ...
d96cdd4a 331#if wxUSE_STATUSBAR
49e3b82c 332 wxString s;
d96cdd4a 333#endif // wxUSE_STATUSBAR
49e3b82c
FM
334 wxPen wP;
335 wxBrush wB;
cdf3a589
CE
336 wxPoint points[6];
337 wxColour wC;
49e3b82c 338 wxFont wF;
cdf3a589
CE
339
340 dc.SetFont(*wxSWISS_FONT);
341 dc.SetPen(*wxGREEN_PEN);
342
cdf3a589
CE
343 switch (m_index)
344 {
345 default:
346 case 0:
347 // draw lines to make a cross
348 dc.DrawLine(0, 0, 200, 200);
349 dc.DrawLine(200, 0, 0, 200);
350 // draw point colored line and spline
49e3b82c 351 wP = *wxCYAN_PEN;
cdf3a589
CE
352 wP.SetWidth(3);
353 dc.SetPen(wP);
354
49e3b82c 355 dc.DrawPoint (25,15);
cdf3a589
CE
356 dc.DrawLine(50, 30, 200, 30);
357 dc.DrawSpline(50, 200, 50, 100, 200, 10);
d96cdd4a 358#if wxUSE_STATUSBAR
cdf3a589 359 s = wxT("Green Cross, Cyan Line and spline");
d96cdd4a 360#endif // wxUSE_STATUSBAR
49e3b82c 361 break;
cdf3a589
CE
362
363 case 1:
364 // draw standard shapes
365 dc.SetBrush(*wxCYAN_BRUSH);
366 dc.SetPen(*wxRED_PEN);
367 dc.DrawRectangle(10, 10, 100, 70);
9a83f860 368 wB = wxBrush (wxT("DARK ORCHID"), wxBRUSHSTYLE_TRANSPARENT);
cdf3a589
CE
369 dc.SetBrush (wB);
370 dc.DrawRoundedRectangle(50, 50, 100, 70, 20);
9a83f860 371 dc.SetBrush (wxBrush(wxT("GOLDENROD")) );
cdf3a589
CE
372 dc.DrawEllipse(100, 100, 100, 50);
373
374 points[0].x = 100; points[0].y = 200;
375 points[1].x = 70; points[1].y = 260;
376 points[2].x = 160; points[2].y = 230;
377 points[3].x = 40; points[3].y = 230;
378 points[4].x = 130; points[4].y = 260;
379 points[5].x = 100; points[5].y = 200;
380
381 dc.DrawPolygon(5, points);
382 dc.DrawLines (6, points, 160);
d96cdd4a 383#if wxUSE_STATUSBAR
cdf3a589 384 s = wxT("Blue rectangle, red edge, clear rounded rectangle, gold ellipse, gold and clear stars");
d96cdd4a 385#endif // wxUSE_STATUSBAR
49e3b82c 386 break;
cdf3a589
CE
387
388 case 2:
389 // draw text in Arial or similar font
390 dc.DrawLine(50,25,50,35);
391 dc.DrawLine(45,30,55,30);
392 dc.DrawText(wxT("This is a Swiss-style string"), 50, 30);
49e3b82c 393 wC = dc.GetTextForeground();
9a83f860 394 dc.SetTextForeground (wxT("FIREBRICK"));
a5e6cfa8 395
cdf3a589 396 // no effect in msw ??
9a83f860 397 dc.SetTextBackground (wxT("WHEAT"));
cdf3a589
CE
398 dc.DrawText(wxT("This is a Red string"), 50, 200);
399 dc.DrawRotatedText(wxT("This is a 45 deg string"), 50, 200, 45);
400 dc.DrawRotatedText(wxT("This is a 90 deg string"), 50, 200, 90);
c54e5eb0 401 wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, false, wxT("Times New Roman"));
cdf3a589 402 dc.SetFont(wF);
49e3b82c 403 dc.SetTextForeground (wC);
cdf3a589 404 dc.DrawText(wxT("This is a Times-style string"), 50, 60);
d96cdd4a 405#if wxUSE_STATUSBAR
cdf3a589 406 s = wxT("Swiss, Times text; red text, rotated and colored orange");
d96cdd4a 407#endif // wxUSE_STATUSBAR
49e3b82c 408 break;
cdf3a589
CE
409
410 case 3 :
411 // four arcs start and end points, center
412 dc.SetBrush(*wxGREEN_BRUSH);
216db41f 413 dc.DrawArc ( 200,300, 370,230, 300,300 );
cdf3a589 414 dc.SetBrush(*wxBLUE_BRUSH);
216db41f 415 dc.DrawArc ( 270-50, 270-86, 270-86, 270-50, 270,270 );
cdf3a589 416 dc.SetDeviceOrigin(-10,-10);
216db41f 417 dc.DrawArc ( 270-50, 270-86, 270-86, 270-50, 270,270 );
cdf3a589
CE
418 dc.SetDeviceOrigin(0,0);
419
9a83f860 420 wP.SetColour (wxT("CADET BLUE"));
cdf3a589 421 dc.SetPen(wP);
216db41f 422 dc.DrawArc ( 75,125, 110, 40, 75, 75 );
cdf3a589 423
9a83f860 424 wP.SetColour (wxT("SALMON"));
cdf3a589
CE
425 dc.SetPen(wP);
426 dc.SetBrush(*wxRED_BRUSH);
427 //top left corner, width and height, start and end angle
428 // 315 same center and x-radius as last pie-arc, half Y radius
49e3b82c 429 dc.DrawEllipticArc(25,50,100,50,180.0,45.0);
cdf3a589 430
49e3b82c 431 wP = *wxCYAN_PEN;
cdf3a589
CE
432 wP.SetWidth(3);
433 dc.SetPen(wP);
434 //wxTRANSPARENT));
9a83f860 435 dc.SetBrush (wxBrush (wxT("SALMON")));
49e3b82c 436 dc.DrawEllipticArc(300, 0,200,100, 0.0,145.0);
cdf3a589 437 //same end point
49e3b82c
FM
438 dc.DrawEllipticArc(300, 50,200,100,90.0,145.0);
439 dc.DrawEllipticArc(300,100,200,100,90.0,345.0);
cdf3a589 440
d96cdd4a 441#if wxUSE_STATUSBAR
cdf3a589 442 s = wxT("This is an arc test page");
d96cdd4a 443#endif // wxUSE_STATUSBAR
49e3b82c 444 break;
cdf3a589
CE
445
446 case 4:
447 dc.DrawCheckMark ( 30,30,25,25);
9a83f860 448 dc.SetBrush (wxBrush (wxT("SALMON"),wxBRUSHSTYLE_TRANSPARENT));
cdf3a589
CE
449 dc.DrawCheckMark ( 80,50,75,75);
450 dc.DrawRectangle ( 80,50,75,75);
d96cdd4a 451#if wxUSE_STATUSBAR
cdf3a589 452 s = wxT("Two check marks");
d96cdd4a 453#endif // wxUSE_STATUSBAR
49e3b82c 454 break;
cdf3a589
CE
455
456 case 5:
c54e5eb0 457 wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, false, wxT("Times New Roman"));
cdf3a589
CE
458 dc.SetFont(wF);
459 dc.DrawLine(0, 0, 200, 200);
460 dc.DrawLine(200, 0, 0, 200);
461 dc.DrawText(wxT("This is an 18pt string"), 50, 60);
462
463 // rescale and draw in blue
49e3b82c 464 wP = *wxCYAN_PEN;
cdf3a589
CE
465 dc.SetPen(wP);
466 dc.SetUserScale (2.0,0.5);
467 dc.SetDeviceOrigin(200,0);
468 dc.DrawLine(0, 0, 200, 200);
469 dc.DrawLine(200, 0, 0, 200);
470 dc.DrawText(wxT("This is an 18pt string 2 x 0.5 UserScaled"), 50, 60);
471 dc.SetUserScale (2.0,2.0);
472 dc.SetDeviceOrigin(200,200);
473 dc.DrawText(wxT("This is an 18pt string 2 x 2 UserScaled"), 50, 60);
474
49e3b82c 475 wP = *wxRED_PEN;
cdf3a589
CE
476 dc.SetPen(wP);
477 dc.SetUserScale (1.0,1.0);
478 dc.SetDeviceOrigin(0,10);
49e3b82c 479 dc.SetMapMode (wxMM_METRIC); //svg ignores this
cdf3a589
CE
480 dc.DrawLine(0, 0, 200, 200);
481 dc.DrawLine(200, 0, 0, 200);
a5e6cfa8 482 dc.DrawText(wxT("This is an 18pt string in MapMode"), 50, 60);
d96cdd4a 483#if wxUSE_STATUSBAR
cdf3a589 484 s = wxT("Scaling test page");
d96cdd4a 485#endif // wxUSE_STATUSBAR
49e3b82c 486 break;
cdf3a589
CE
487
488 case 6:
3cb332c1 489 dc.DrawIcon( wxICON(sample), 10, 10 );
756d3e7f 490 dc.DrawBitmap ( wxBitmap(svgbitmap_xpm), 50,15);
d96cdd4a 491#if wxUSE_STATUSBAR
cdf3a589 492 s = wxT("Icon and Bitmap ");
d96cdd4a 493#endif // wxUSE_STATUSBAR
49e3b82c 494 break;
cdf3a589
CE
495
496 }
d96cdd4a 497#if wxUSE_STATUSBAR
cdf3a589 498 m_child->SetStatusText(s);
d96cdd4a 499#endif // wxUSE_STATUSBAR
cdf3a589
CE
500}
501
502
cdf3a589
CE
503// ---------------------------------------------------------------------------
504// MyChild
505// ---------------------------------------------------------------------------
506
49e3b82c
FM
507// Note that MDI_NEW_WINDOW and MDI_ABOUT commands get passed
508// to the parent window for processing, so no need to
509// duplicate event handlers here.
510BEGIN_EVENT_TABLE(MyChild, wxMDIChildFrame)
511 EVT_MENU(MDI_CHILD_QUIT, MyChild::OnQuit)
512END_EVENT_TABLE()
513
cdf3a589 514MyChild::MyChild(wxMDIParentFrame *parent, const wxString& title,
49e3b82c
FM
515 const wxPoint& pos, const wxSize& size,
516 const long style)
517 : wxMDIChildFrame(parent, wxID_ANY, title, pos, size, style)
cdf3a589 518{
49e3b82c 519 m_frame = (MyFrame *) parent;
ce00f59b 520
d96cdd4a 521#if wxUSE_STATUSBAR
cdf3a589 522 CreateStatusBar();
a5e6cfa8 523 SetStatusText(title);
d96cdd4a 524#endif // wxUSE_STATUSBAR
cdf3a589 525
49e3b82c 526 m_canvas = new MyCanvas(this, wxPoint(0, 0), GetClientSize());
ce00f59b 527
cdf3a589
CE
528 // Give it scrollbars
529 m_canvas->SetScrollbars(20, 20, 50, 50);
cdf3a589
CE
530}
531
cdf3a589
CE
532MyChild::~MyChild()
533{
cdf3a589
CE
534}
535
cdf3a589
CE
536void MyChild::OnQuit(wxCommandEvent& WXUNUSED(event))
537{
c54e5eb0 538 Close(true);
cdf3a589
CE
539}
540
cdf3a589
CE
541bool MyChild::OnSave(wxString filename)
542{
49e3b82c 543 wxSVGFileDC svgDC (filename, 600, 650);
cdf3a589 544 m_canvas->OnDraw (svgDC);
22e43568 545 return svgDC.IsOk();
cdf3a589
CE
546}
547
cdf3a589
CE
548void MyChild::OnActivate(wxActivateEvent& event)
549{
550 if ( event.GetActive() && m_canvas )
551 m_canvas->SetFocus();
552}
553