#include "wx/wxprec.h"
#include "wx/dialog.h"
+#include "wx/evtloop.h"
#ifndef WX_PRECOMP
#include "wx/app.h"
#include "wx/osx/private.h"
-
// Lists to keep track of windows, so we can disable/enable them
// for modal dialogs
void wxDialog::Init()
{
m_modality = wxDIALOG_MODALITY_NONE;
+ m_eventLoop = NULL;
}
bool wxDialog::Create( wxWindow *parent,
// Replacement for Show(true) for modal dialogs - returns return code
int wxDialog::ShowModal()
{
- m_modality = wxDIALOG_MODALITY_WINDOW_MODAL;
+ m_modality = wxDIALOG_MODALITY_APP_MODAL;
Show();
- DoShowModal();
-
+ wxModalEventLoop modalLoop(this);
+ m_eventLoop = &modalLoop;
+
+ modalLoop.Run();
+
+ m_eventLoop = NULL;
+
return GetReturnCode();
}
// dialogs and should work for both of them
void wxDialog::EndModal(int retCode)
{
+ if ( m_eventLoop )
+ m_eventLoop->Exit(retCode);
+
SetReturnCode(retCode);
Show(false);
}