X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/756d3e7fb5d154e2eb5984a2da925e0ba2041196..b9efe021b554fa3967d1442cf758435c5cd5ae8f:/samples/svg/svgtest.cpp diff --git a/samples/svg/svgtest.cpp b/samples/svg/svgtest.cpp index 56882fb677..31c7f8875a 100644 --- a/samples/svg/svgtest.cpp +++ b/samples/svg/svgtest.cpp @@ -39,13 +39,13 @@ USERC("svg.rc"); #include #include -#include "mondrian.xpm" +#include "mondrian.xpm" #include "bitmaps/new.xpm" #include "bitmaps/save.xpm" #include "bitmaps/help.xpm" #include "SVGlogo24.xpm" - + class MyChild; // Define a new application @@ -83,7 +83,7 @@ class MyCanvas : public wxScrolledWindow { public: int m_index ; - + MyChild * m_child ; MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size); virtual void OnDraw(wxDC& dc); @@ -160,7 +160,7 @@ bool MyApp::OnInit() frame = new MyFrame((wxFrame *)NULL, -1, wxT("SVG Demo"), wxPoint(-1, -1), wxSize(500, 400), wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL); - + // Make a menubar wxMenu *file_menu = new wxMenu; @@ -179,9 +179,11 @@ bool MyApp::OnInit() // Associate the menu bar with the frame frame->SetMenuBar(menu_bar); +#if wxUSE_STATUSBAR frame->CreateStatusBar(); +#endif // wxUSE_STATUSBAR - frame->Show(TRUE); + frame->Show(true); SetTopWindow(frame); @@ -222,8 +224,8 @@ void MyFrame::OnClose(wxCloseEvent& event) return ; } // now try the children - wxNode * pNode = m_children.GetFirst (); - wxNode * pNext ; + wxObjectList::compatibility_iterator pNode = m_children.GetFirst (); + wxObjectList::compatibility_iterator pNext ; MyChild * pChild ; while ( pNode ) { @@ -231,7 +233,7 @@ void MyFrame::OnClose(wxCloseEvent& event) pChild = (MyChild*) pNode -> GetData (); if (pChild -> Close ()) { - delete pNode ; + m_children.Erase(pNode) ; } else { @@ -252,7 +254,7 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) ) { - (void)wxMessageBox(wxT("wxWindows 2.0 SVG 1.0 Test\n") + (void)wxMessageBox(wxT("wxWidgets 2.0 SVG 1.0 Test\n") wxT("Author: Chris Elliott (c) 2002\n") wxT("Usage: svg.exe \nClick File | New to show tests\n\n"), wxT("About SVG Test")); } @@ -326,8 +328,8 @@ void MyFrame::InitToolBar(wxToolBar* toolBar) currentX += width + 5; toolBar->AddTool( MDI_SAVE, *bitmaps[1], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, wxT("Save test in SVG format")); currentX += width + 5; - toolBar->AddSeparator(); - toolBar->AddTool(MDI_ABOUT, *bitmaps[2], wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, wxT("Help")); + toolBar->AddSeparator(); + toolBar->AddTool(MDI_ABOUT, *bitmaps[2], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, wxT("Help")); toolBar->Realize(); @@ -340,7 +342,7 @@ void MyFrame::InitToolBar(wxToolBar* toolBar) void MyFrame::FileSavePicture (wxCommandEvent & WXUNUSED(event) ) { MyChild * pChild = (MyChild *)GetActiveChild (); - if (pChild == NULL) + if (pChild == NULL) { return ; } @@ -391,7 +393,9 @@ wxSUNKEN_BORDER|wxVSCROLL|wxHSCROLL) void MyCanvas::OnDraw(wxDC& dc) { // vars to use ... +#if wxUSE_STATUSBAR wxString s ; +#endif // wxUSE_STATUSBAR wxPen wP ; wxBrush wB ; wxPoint points[6]; @@ -401,7 +405,7 @@ void MyCanvas::OnDraw(wxDC& dc) dc.SetFont(*wxSWISS_FONT); dc.SetPen(*wxGREEN_PEN); - + switch (m_index) { default: @@ -417,7 +421,9 @@ void MyCanvas::OnDraw(wxDC& dc) dc.DrawPoint (25,15) ; dc.DrawLine(50, 30, 200, 30); dc.DrawSpline(50, 200, 50, 100, 200, 10); +#if wxUSE_STATUSBAR s = wxT("Green Cross, Cyan Line and spline"); +#endif // wxUSE_STATUSBAR break ; case 1: @@ -440,7 +446,9 @@ void MyCanvas::OnDraw(wxDC& dc) dc.DrawPolygon(5, points); dc.DrawLines (6, points, 160); +#if wxUSE_STATUSBAR s = wxT("Blue rectangle, red edge, clear rounded rectangle, gold ellipse, gold and clear stars"); +#endif // wxUSE_STATUSBAR break ; case 2: @@ -450,7 +458,7 @@ void MyCanvas::OnDraw(wxDC& dc) dc.DrawText(wxT("This is a Swiss-style string"), 50, 30); wC = dc.GetTextForeground() ; dc.SetTextForeground (_T("FIREBRICK")); - + // no effect in msw ?? dc.SetTextBackground (_T("WHEAT")); dc.DrawText(wxT("This is a Red string"), 50, 200); @@ -460,7 +468,9 @@ void MyCanvas::OnDraw(wxDC& dc) dc.SetFont(wF); dc.SetTextForeground (wC) ; dc.DrawText(wxT("This is a Times-style string"), 50, 60); +#if wxUSE_STATUSBAR s = wxT("Swiss, Times text; red text, rotated and colored orange"); +#endif // wxUSE_STATUSBAR break ; case 3 : @@ -494,7 +504,9 @@ void MyCanvas::OnDraw(wxDC& dc) dc.DrawEllipticArc(300, 50,200,100,90.0,145.0) ; dc.DrawEllipticArc(300,100,200,100,90.0,345.0) ; +#if wxUSE_STATUSBAR s = wxT("This is an arc test page"); +#endif // wxUSE_STATUSBAR break ; case 4: @@ -502,7 +514,9 @@ void MyCanvas::OnDraw(wxDC& dc) dc.SetBrush (wxBrush (_T("SALMON"),wxTRANSPARENT)); dc.DrawCheckMark ( 80,50,75,75); dc.DrawRectangle ( 80,50,75,75); +#if wxUSE_STATUSBAR s = wxT("Two check marks"); +#endif // wxUSE_STATUSBAR break ; case 5: @@ -531,18 +545,24 @@ void MyCanvas::OnDraw(wxDC& dc) dc.SetMapMode (wxMM_METRIC) ; //svg ignores this dc.DrawLine(0, 0, 200, 200); dc.DrawLine(200, 0, 0, 200); - dc.DrawText(wxT("This is an 18pt string in MapMode"), 50, 60); + dc.DrawText(wxT("This is an 18pt string in MapMode"), 50, 60); +#if wxUSE_STATUSBAR s = wxT("Scaling test page"); +#endif // wxUSE_STATUSBAR break ; case 6: dc.DrawIcon( wxIcon(mondrian_xpm), 10, 10 ); dc.DrawBitmap ( wxBitmap(svgbitmap_xpm), 50,15); +#if wxUSE_STATUSBAR s = wxT("Icon and Bitmap "); +#endif // wxUSE_STATUSBAR break ; } +#if wxUSE_STATUSBAR m_child->SetStatusText(s); +#endif // wxUSE_STATUSBAR } @@ -559,8 +579,10 @@ const long style) { m_frame = (MyFrame *) parent ; +#if wxUSE_STATUSBAR CreateStatusBar(); - SetStatusText(title); + SetStatusText(title); +#endif // wxUSE_STATUSBAR int w, h ; GetClientSize ( &w, &h );