X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a9efc294a979fb4ae801f7dc37af35677301212d..76b0f8384ed211c5f6b48597a62da743b604e666:/src/univ/dialog.cpp diff --git a/src/univ/dialog.cpp b/src/univ/dialog.cpp index c98a5e91ac..f12d20baa1 100644 --- a/src/univ/dialog.cpp +++ b/src/univ/dialog.cpp @@ -1,7 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: src/univ/dialog.cpp // Author: Robert Roebling, Vaclav Slavik -// Id: $Id$ // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -29,6 +28,7 @@ #endif #include "wx/evtloop.h" +#include "wx/modalhook.h" //----------------------------------------------------------------------------- // wxDialog @@ -41,8 +41,6 @@ BEGIN_EVENT_TABLE(wxDialog,wxDialogBase) EVT_CLOSE (wxDialog::OnCloseWindow) END_EVENT_TABLE() -IMPLEMENT_DYNAMIC_CLASS(wxDialog,wxTopLevelWindow) - void wxDialog::Init() { m_returnCode = 0; @@ -53,8 +51,6 @@ void wxDialog::Init() wxDialog::~wxDialog() { - m_isBeingDeleted = true; - // if the dialog is modal, this will end its event loop Show(false); @@ -132,7 +128,7 @@ void wxDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) s_closing.Append(this); - wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL); + wxCommandEvent cancelEvent(wxEVT_BUTTON, wxID_CANCEL); cancelEvent.SetEventObject(this); GetEventHandler()->ProcessEvent(cancelEvent); s_closing.DeleteObject(this); @@ -145,11 +141,7 @@ bool wxDialog::Show(bool show) // 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); @@ -173,6 +165,8 @@ bool wxDialog::IsModal() const int wxDialog::ShowModal() { + WX_HOOK_MODAL_DIALOG(); + if ( IsModal() ) { wxFAIL_MSG( wxT("wxDialog:ShowModal called twice") ); @@ -181,24 +175,20 @@ int wxDialog::ShowModal() // 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 * const parent = GetParentForModalDialog(); - 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__) +#if defined(__WXGTK__) wxBusyCursorSuspender suspender; - // FIXME (FIXME_MGL) - make sure busy cursor disappears under MSW too #endif m_windowDisabler = new wxWindowDisabler(this); @@ -212,7 +202,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);