#include "printing.h"
-#ifndef __WXMSW__
- #include "mondrian.xpm"
+#ifndef wxHAS_IMAGES_IN_RESOURCES
+ #include "../sample.xpm"
#endif
// Global print data, to remember settings during the session
frame->Centre(wxBOTH);
frame->Show();
- SetTopWindow(frame);
-
return true;
}
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);
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
// 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;
}
#endif
EVT_MENU(WXPRINT_ANGLEUP, MyFrame::OnAngleUp)
EVT_MENU(WXPRINT_ANGLEDOWN, MyFrame::OnAngleDown)
+
+ EVT_MENU_RANGE(WXPRINT_FRAME_MODAL_APP,
+ WXPRINT_FRAME_MODAL_NON,
+ MyFrame::OnPreviewFrameModalityKind)
END_EVENT_TABLE()
MyFrame::MyFrame(wxFrame *frame, const wxString&title, const wxPoint&pos, const wxSize&size)
: wxFrame(frame, wxID_ANY, title, pos, size)
{
m_canvas = NULL;
+ m_previewModality = wxPreviewFrame_AppModal;
#if wxUSE_STATUSBAR
// Give us a status line
#endif // wxUSE_STATUSBAR
// Load icon and bitmap
- SetIcon( wxICON( mondrian) );
+ SetIcon( wxICON( sample) );
// Make a menubar
wxMenu *file_menu = new wxMenu;
#endif
file_menu->Append(wxID_PREVIEW, wxT("Print Pre&view"), wxT("Preview"));
+ wxMenu * const menuModalKind = new wxMenu;
+ menuModalKind->AppendRadioItem(WXPRINT_FRAME_MODAL_APP, "&App modal");
+ menuModalKind->AppendRadioItem(WXPRINT_FRAME_MODAL_WIN, "&Window modal");
+ menuModalKind->AppendRadioItem(WXPRINT_FRAME_MODAL_NON, "&Not modal");
+ file_menu->AppendSubMenu(menuModalKind, "Preview frame &modal kind");
#if wxUSE_ACCEL
// Accelerators
wxAcceleratorEntry entries[1];
wxPreviewFrame *frame =
new wxPreviewFrame(preview, this, wxT("Demo Print Preview"), wxPoint(100, 100), wxSize(600, 650));
frame->Centre(wxBOTH);
- frame->Initialize();
+ frame->InitializeWithModality(m_previewModality);
frame->Show();
}
m_canvas->Refresh();
}
+void MyFrame::OnPreviewFrameModalityKind(wxCommandEvent& event)
+{
+ m_previewModality = static_cast<wxPreviewFrameModalityKind>(
+ wxPreviewFrame_AppModal +
+ (event.GetId() - WXPRINT_FRAME_MODAL_APP));
+}
// ----------------------------------------------------------------------------
// MyCanvas
int ppiPrinterX, ppiPrinterY;
GetPPIPrinter(&ppiPrinterX, &ppiPrinterY);
- // This scales the DC so that the printout roughly represents the the screen
+ // This scales the DC so that the printout roughly represents the screen
// scaling. The text point size _should_ be the right size but in fact is
// too small for some reason. This is a detail that will need to be
// addressed at some point but can be fudged for the moment.