X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8907154c1a8a6882c6797d1f16393ddfb23e7f3a..2ff0354a3a81557f70a8811a63769b6a42fa4084:/src/univ/dialog.cpp diff --git a/src/univ/dialog.cpp b/src/univ/dialog.cpp index 32feb90cac..3faf2f7800 100644 --- a/src/univ/dialog.cpp +++ b/src/univ/dialog.cpp @@ -21,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 @@ -52,6 +53,9 @@ void wxDialog::Init() wxDialog::~wxDialog() { + // if the dialog is modal, this will end its event loop + Show(false); + delete m_eventLoop; } @@ -70,7 +74,7 @@ bool wxDialog::Create(wxWindow *parent, void wxDialog::OnApply(wxCommandEvent &WXUNUSED(event)) { - if ( Validate() ) + if ( Validate() ) TransferDataFromWindow(); } @@ -149,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; @@ -174,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; @@ -214,7 +221,7 @@ void wxDialog::EndModal(int retCode) } m_isShowingModal = false; - + m_eventLoop->Exit(); Show(false);