X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/445e564f120fb194a554ef70a6f2187b7ce693ed..d4e5c5b98a5a80c5cc65776f2add32ff543c2972:/src/osx/dialog_osx.cpp?ds=sidebyside diff --git a/src/osx/dialog_osx.cpp b/src/osx/dialog_osx.cpp index b1b50b980a..cb127f323b 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 ///////////////////////////////////////////////////////////////////////////// @@ -13,6 +13,7 @@ #include "wx/dialog.h" #include "wx/evtloop.h" +#include "wx/modalhook.h" #ifndef WX_PRECOMP #include "wx/app.h" @@ -40,9 +41,6 @@ void wxDialog::OSXEndModalDialog() s_openDialogs--; } - -IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxTopLevelWindow) - void wxDialog::Init() { m_modality = wxDIALOG_MODALITY_NONE; @@ -83,7 +81,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); @@ -102,7 +100,7 @@ bool wxDialog::Show(bool show) // nothing to do return false; } - else + else { if ( !wxDialogBase::Show(show) ) // nothing to do @@ -118,46 +116,52 @@ bool wxDialog::Show(bool show) if ( !show ) { - switch( m_modality ) + const int modalityOrig = m_modality; + + // complete the 'hiding' before we send the event + m_modality = wxDIALOG_MODALITY_NONE; + + switch ( modalityOrig ) { 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; } // Replacement for Show(true) for modal dialogs - returns return code int wxDialog::ShowModal() { + WX_HOOK_MODAL_DIALOG(); + 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(); } @@ -172,7 +176,7 @@ void wxDialog::EndModal(int retCode) { if ( m_eventLoop ) m_eventLoop->Exit(retCode); - + SetReturnCode(retCode); Show(false); }