X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/62068535c57c64732d49c7d8cf770c05903402c0..60372b0d54379701d62edf5595a7dc25c48330e1:/src/osx/dialog_osx.cpp diff --git a/src/osx/dialog_osx.cpp b/src/osx/dialog_osx.cpp index e605e95f3f..835afaaa24 100644 --- a/src/osx/dialog_osx.cpp +++ b/src/osx/dialog_osx.cpp @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: dialog.cpp 54820 2008-07-29 20:04:11Z SC $ +// RCS-ID: $Id$ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -23,12 +23,22 @@ #include "wx/osx/private.h" -// Lists to keep track of windows, so we can disable/enable them -// for modal dialogs +static int s_openDialogs = 0; +bool wxDialog::OSXHasModalDialogsOpen() +{ + return s_openDialogs > 0; +} -wxList wxModalDialogs; +void wxDialog::OSXBeginModalDialog() +{ + s_openDialogs++; +} -IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxTopLevelWindow) +void wxDialog::OSXEndModalDialog() +{ + wxASSERT_MSG( s_openDialogs > 0, "incorrect internal modal dialog count"); + s_openDialogs--; +} void wxDialog::Init() { @@ -70,7 +80,7 @@ wxDialog::~wxDialog() // about it bool wxDialog::IsEscapeKey(const wxKeyEvent& event) { - if ( event.GetKeyCode() == '.' && event.GetModifiers() == wxMOD_CMD ) + if ( event.GetKeyCode() == '.' && event.GetModifiers() == wxMOD_CONTROL ) return true; return wxDialogBase::IsEscapeKey(event); @@ -89,7 +99,7 @@ bool wxDialog::Show(bool show) // nothing to do return false; } - else + else { if ( !wxDialogBase::Show(show) ) // nothing to do @@ -109,14 +119,14 @@ bool wxDialog::Show(bool show) { case wxDIALOG_MODALITY_WINDOW_MODAL: EndWindowModal(); // OS X implementation method for cleanup - SendWindowModalDialogEvent ( wxEVT_WINDOW_MODAL_DIALOG_CLOSED ); + SendWindowModalDialogEvent ( wxEVT_WINDOW_MODAL_DIALOG_CLOSED ); break; default: break; } m_modality = wxDIALOG_MODALITY_NONE; } - + return true; } @@ -124,25 +134,27 @@ bool wxDialog::Show(bool show) int wxDialog::ShowModal() { m_modality = wxDIALOG_MODALITY_APP_MODAL; - + Show(); wxModalEventLoop modalLoop(this); m_eventLoop = &modalLoop; - + + wxDialog::OSXBeginModalDialog(); modalLoop.Run(); - + wxDialog::OSXEndModalDialog(); + m_eventLoop = NULL; - + return GetReturnCode(); } void wxDialog::ShowWindowModal() { m_modality = wxDIALOG_MODALITY_WINDOW_MODAL; - + Show(); - + DoShowWindowModal(); } @@ -157,7 +169,7 @@ void wxDialog::EndModal(int retCode) { if ( m_eventLoop ) m_eventLoop->Exit(retCode); - + SetReturnCode(retCode); Show(false); }