more wxCloseEvent changes: now the behaviour should be conforming to the one
described in the docs (i.e. like Julian wants it) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1611 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -224,15 +224,15 @@ void wxDialog::OnCloseWindow(wxCloseEvent& event)
|
||||
if (closing.Member(this))
|
||||
return; // no loops
|
||||
|
||||
if ( event.GetVeto() )
|
||||
return;
|
||||
|
||||
closing.Append(this);
|
||||
|
||||
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
|
||||
cancelEvent.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent(cancelEvent);
|
||||
closing.DeleteObject(this);
|
||||
|
||||
if ( event.CanVeto() )
|
||||
event.Veto();
|
||||
}
|
||||
|
||||
bool wxDialog::Destroy()
|
||||
|
@@ -8,7 +8,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "frame.h"
|
||||
#pragma implementation "frame.h"
|
||||
#endif
|
||||
|
||||
#include "wx/frame.h"
|
||||
@@ -104,6 +104,7 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC
|
||||
|
||||
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
|
||||
EVT_SIZE(wxFrame::OnSize)
|
||||
EVT_CLOSE(wxFrame::OnCloseWindow)
|
||||
EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
@@ -474,6 +475,13 @@ void wxFrame::OnInternalIdle()
|
||||
DoMenuUpdates();
|
||||
}
|
||||
|
||||
void wxFrame::OnCloseWindow( wxCloseEvent& event )
|
||||
{
|
||||
// close the window if it wasn't vetoed by the application
|
||||
if ( !event.GetVeto() )
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
|
||||
{
|
||||
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
|
||||
|
@@ -1718,13 +1718,9 @@ bool wxWindow::Close( bool force )
|
||||
event.SetEventObject(this);
|
||||
event.SetCanVeto(!force);
|
||||
|
||||
(void)GetEventHandler()->ProcessEvent(event);
|
||||
|
||||
// when we're forced to close we do it anyhow, otherwise only if the
|
||||
// application didn't forbid it (if the event wasn't processed, GetVeto()
|
||||
// will return FALSE too)
|
||||
if ( force || !event.GetVeto() )
|
||||
Destroy();
|
||||
// return FALSE if window wasn't closed because the application vetoed the
|
||||
// close event
|
||||
return GetEventHandler()->ProcessEvent(event) && !event.GetVeto();
|
||||
}
|
||||
|
||||
bool wxWindow::Destroy()
|
||||
|
Reference in New Issue
Block a user