X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2b854a32613f34669af815e1416a6c623a4c2c5b..20239453d57b635b6e578c4e46ef02b198512733:/src/gtk1/dialog.cpp?ds=sidebyside diff --git a/src/gtk1/dialog.cpp b/src/gtk1/dialog.cpp index 16bd99d503..b8c54679b7 100644 --- a/src/gtk1/dialog.cpp +++ b/src/gtk1/dialog.cpp @@ -219,6 +219,20 @@ void wxDialog::OnPaint( wxPaintEvent& WXUNUSED(event) ) void wxDialog::OnCloseWindow(wxCloseEvent& event) { + // We'll send a Cancel message by default, + // which may close the dialog. + // Check for looping if the Cancel event handler calls Close(). + + // Note that if a cancel button and handler aren't present in the dialog, + // nothing will happen when you close the dialog via the window manager, or + // via Close(). + // We wouldn't want to destroy the dialog by default, since the dialog may have been + // created on the stack. + // However, this does mean that calling dialog->Close() won't delete the dialog + // unless the handler for wxID_CANCEL does so. So use Destroy() if you want to be + // sure to destroy the dialog. + // The default OnCancel (above) simply ends a modal dialog, and hides a modeless dialog. + static wxList closing; if (closing.Member(this)) @@ -230,9 +244,6 @@ void wxDialog::OnCloseWindow(wxCloseEvent& event) cancelEvent.SetEventObject( this ); GetEventHandler()->ProcessEvent(cancelEvent); closing.DeleteObject(this); - - if ( event.CanVeto() ) - event.Veto(); } bool wxDialog::Destroy() @@ -422,7 +433,7 @@ int wxDialog::ShowModal() wxFAIL_MSG( "wxDialog:ShowModal called twice" ); return GetReturnCode(); } - + Show( TRUE ); m_modalShowing = TRUE;