// 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"
#pragma hdrstop
#endif
+#include "wx/dialog.h"
+
#ifndef WX_PRECOMP
- #include "wx/dialog.h"
#include "wx/utils.h"
#include "wx/app.h"
#endif
wxDialog::~wxDialog()
{
+ // if the dialog is modal, this will end its event loop
+ Show(false);
+
delete m_eventLoop;
}
void wxDialog::OnApply(wxCommandEvent &WXUNUSED(event))
{
- if ( Validate() )
+ if ( Validate() )
TransferDataFromWindow();
}
// if we had disabled other app windows, reenable them back now because
// if they stay disabled Windows will activate another window (one
// which is enabled, anyhow) and we will lose activation
- if ( m_windowDisabler )
- {
- delete m_windowDisabler;
- m_windowDisabler = NULL;
- }
+ wxDELETE(m_windowDisabler);
if ( IsModal() )
EndModal(wxID_CANCEL);
}
+ if (show && CanDoLayoutAdaptation())
+ DoLayoutAdaptation();
+
bool ret = wxDialogBase::Show(show);
- if ( show )
+ if ( show )
InitDialog();
return ret;
// use the apps top level window as parent if none given unless explicitly
// forbidden
- if ( !GetParent() && !(GetWindowStyleFlag() & wxDIALOG_NO_PARENT) )
+ wxWindow * const parent = GetParentForModalDialog();
+ if ( parent && parent != this )
{
- wxWindow *parent = wxTheApp->GetTopWindow();
- if ( parent && parent != this )
- {
- m_parent = parent;
- }
+ m_parent = parent;
}
Show(true);
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;
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);
}
m_isShowingModal = false;
-
+
m_eventLoop->Exit();
Show(false);