X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a29df0623194319a0f7c670e22424f1f69159a80..57ab6f2314860f6efd2d1339913c91a302020a8e:/samples/printing/printing.cpp diff --git a/samples/printing/printing.cpp b/samples/printing/printing.cpp index e79361807e..bb4daffb35 100644 --- a/samples/printing/printing.cpp +++ b/samples/printing/printing.cpp @@ -51,8 +51,8 @@ #include "printing.h" -#ifndef __WXMSW__ - #include "mondrian.xpm" +#if !defined(__WXMSW__) && !defined(__WXPM__) + #include "../sample.xpm" #endif // Global print data, to remember settings during the session @@ -123,8 +123,6 @@ bool MyApp::OnInit(void) frame->Centre(wxBOTH); frame->Show(); - SetTopWindow(frame); - return true; } @@ -212,7 +210,7 @@ void MyApp::Draw(wxDC&dc) str.Printf( wxT("---- Text at angle %d ----"), i ); dc.DrawRotatedText( str, 100, 300, i ); - wxIcon my_icon = wxICON(mondrian); + wxIcon my_icon = wxICON(sample); dc.DrawIcon( my_icon, 100, 100); @@ -230,6 +228,12 @@ void MyApp::Draw(wxDC&dc) if (window_dc) gc = wxGraphicsContext::Create( *window_dc ); +#ifdef __WXMSW__ + wxEnhMetaFileDC *emf_dc = wxDynamicCast( &dc, wxEnhMetaFileDC ); + if (emf_dc) + gc = wxGraphicsContext::Create( *emf_dc ); +#endif + if (gc) { // make a path that contains a circle and some lines, centered at 100,100 @@ -248,14 +252,14 @@ void MyApp::Draw(wxDC&dc) // draw some text wxString text("Text by wxGraphicsContext"); - gc->SetFont( m_testFont, *wxBLUE ); - gc->DrawText(text, 50.0, 50.0); + gc->SetFont( m_testFont, *wxBLACK ); + gc->DrawText(text, 25.0, 60.0); // draw rectangle around the text double w, h, d, el; gc->GetTextExtent(text, &w, &h, &d, &el); - gc->SetPen( *wxBLUE_PEN ); - gc->DrawRectangle(50.0, 50.0, w, h); + gc->SetPen( *wxBLACK_PEN ); + gc->DrawRectangle(25.0, 60.0, w, h); delete gc; } @@ -297,7 +301,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString&title, const wxPoint&pos, const #endif // wxUSE_STATUSBAR // Load icon and bitmap - SetIcon( wxICON( mondrian) ); + SetIcon( wxICON( sample) ); // Make a menubar wxMenu *file_menu = new wxMenu;