diff --git a/src/widgets/ProgressDialog.cpp b/src/widgets/ProgressDialog.cpp index 72762ea7d..f6de2339e 100644 --- a/src/widgets/ProgressDialog.cpp +++ b/src/widgets/ProgressDialog.cpp @@ -37,6 +37,9 @@ #include #include #include +#if defined(__WXMAC__) +#include +#endif #include #include #include @@ -1144,6 +1147,21 @@ ProgressDialog::ProgressDialog(const wxString & title, const wxString & message, // delay, we MUST disable other windows/menus anyway since we run the risk // of allowing other tasks to run before this one is complete. mDisable = new wxWindowDisabler(this); + +#if defined(__WXMAC__) + // LL: On the Mac, the parent windows get disabled, but they still respond + // to the close button being clicked and the application quit menu item + // is still enabled. We do not want the parent window to be destroyed + // while we're active, so we have to kludge around a bit to keep this + // from happening. + WindowRef windowRef = (WindowRef) MacGetWindowRef(); + SetWindowModality( windowRef, kWindowModalityAppModal, NULL ) ; + BeginAppModalStateForWindow(windowRef); + + wxMenuBar *bar = wxStaticCast(wxGetTopLevelParent(wxTheApp->GetTopWindow()), wxFrame)->GetMenuBar(); + bar->Enable(wxID_PREFERENCES, false); + bar->Enable(wxID_EXIT, false); +#endif } // @@ -1158,10 +1176,18 @@ ProgressDialog::~ProgressDialog() Beep(); } +#if defined(__WXMAC__) + wxMenuBar *bar = wxStaticCast(wxGetTopLevelParent(wxTheApp->GetTopWindow()), wxFrame)->GetMenuBar(); + bar->Enable(wxID_PREFERENCES, true); + bar->Enable(wxID_EXIT, true); + + WindowRef windowRef = (WindowRef) MacGetWindowRef(); + EndAppModalStateForWindow(windowRef); +#endif + if (mDisable) { delete mDisable; - } #if defined(__WXGTK__)