X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4c51a665c649f7579fb39e62070cef4f66b3210d..33d8353fa58dbc66fc9d22fcd510ded6b26ce719:/samples/printing/printing.cpp diff --git a/samples/printing/printing.cpp b/samples/printing/printing.cpp index 9ba62aa6cf..ace34b5d7f 100644 --- a/samples/printing/printing.cpp +++ b/samples/printing/printing.cpp @@ -51,7 +51,7 @@ #include "printing.h" -#if !defined(__WXMSW__) && !defined(__WXPM__) +#ifndef wxHAS_IMAGES_IN_RESOURCES #include "../sample.xpm" #endif @@ -287,12 +287,17 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) #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 @@ -313,6 +318,11 @@ MyFrame::MyFrame(wxFrame *frame, const wxString&title, const wxPoint&pos, const #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]; @@ -400,7 +410,7 @@ void MyFrame::OnPrintPreview(wxCommandEvent& WXUNUSED(event)) 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(); } @@ -480,6 +490,12 @@ void MyFrame::OnAngleDown(wxCommandEvent& WXUNUSED(event)) m_canvas->Refresh(); } +void MyFrame::OnPreviewFrameModalityKind(wxCommandEvent& event) +{ + m_previewModality = static_cast( + wxPreviewFrame_AppModal + + (event.GetId() - WXPRINT_FRAME_MODAL_APP)); +} // ---------------------------------------------------------------------------- // MyCanvas