X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a290fa5a7deebe9d96c0c0089d18e27d4bd9b624..b50e6e416e2b4cdc849ea6f24181094c0957d904:/src/univ/dialog.cpp diff --git a/src/univ/dialog.cpp b/src/univ/dialog.cpp index 39a0695158..f0f3d659c2 100644 --- a/src/univ/dialog.cpp +++ b/src/univ/dialog.cpp @@ -14,10 +14,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "univdialog.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -25,8 +21,9 @@ #pragma hdrstop #endif +#include "wx/dialog.h" + #ifndef WX_PRECOMP - #include "wx/dialog.h" #include "wx/utils.h" #include "wx/app.h" #endif @@ -56,6 +53,9 @@ void wxDialog::Init() wxDialog::~wxDialog() { + // if the dialog is modal, this will end its event loop + Show(false); + delete m_eventLoop; } @@ -74,7 +74,7 @@ bool wxDialog::Create(wxWindow *parent, void wxDialog::OnApply(wxCommandEvent &WXUNUSED(event)) { - if ( Validate() ) + if ( Validate() ) TransferDataFromWindow(); } @@ -153,9 +153,12 @@ bool wxDialog::Show(bool show) EndModal(wxID_CANCEL); } + if (show && CanDoLayoutAdaptation()) + DoLayoutAdaptation(); + bool ret = wxDialogBase::Show(show); - if ( show ) + if ( show ) InitDialog(); return ret; @@ -178,7 +181,7 @@ int wxDialog::ShowModal() // forbidden if ( !GetParent() && !(GetWindowStyleFlag() & wxDIALOG_NO_PARENT) ) { - wxWindow *parent = wxTheApp->GetTopWindow(); + wxWindow * const parent = GetParentForModalDialog(); if ( parent && parent != this ) { m_parent = parent; @@ -189,7 +192,7 @@ int wxDialog::ShowModal() m_isShowingModal = true; - wxASSERT_MSG( !m_windowDisabler, _T("disabling windows twice?") ); + wxASSERT_MSG( !m_windowDisabler, wxT("disabling windows twice?") ); #if defined(__WXGTK__) || defined(__WXMGL__) wxBusyCursorSuspender suspender; @@ -207,7 +210,7 @@ int wxDialog::ShowModal() void wxDialog::EndModal(int retCode) { - wxASSERT_MSG( m_eventLoop, _T("wxDialog is not modal") ); + wxASSERT_MSG( m_eventLoop, wxT("wxDialog is not modal") ); SetReturnCode(retCode); @@ -218,7 +221,7 @@ void wxDialog::EndModal(int retCode) } m_isShowingModal = false; - + m_eventLoop->Exit(); Show(false);