Send the wxWindowDestroyEvent for all ports

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19251 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2003-02-19 02:59:36 +00:00
parent 8b49ecd77a
commit 7de595519a
10 changed files with 233 additions and 252 deletions

View File

@ -891,6 +891,9 @@ protected:
void SatisfyConstraints();
#endif // wxUSE_CONSTRAINTS
// Send the wxWindowDestroyEvent
void SendDestroyEvent();
// the window id - a number which uniquely identifies a window among
// its siblings unless it is -1
wxWindowID m_windowId;

View File

@ -2078,6 +2078,15 @@ void wxWindowBase::ReleaseMouse()
GetCapture());
}
void wxWindowBase::SendDestroyEvent()
{
wxWindowDestroyEvent event;
event.SetEventObject(this);
event.SetId(GetId());
GetEventHandler()->ProcessEvent(event);
}
// ----------------------------------------------------------------------------
// global functions
// ----------------------------------------------------------------------------

View File

@ -2275,21 +2275,6 @@ wxWindow *wxWindowBase::FindFocus()
return (wxWindow *)g_focusWindow;
}
//-----------------------------------------------------------------------------
// "destroy" event
//-----------------------------------------------------------------------------
// VZ: Robert commented the code using out so it generates warnings: should
// be either fixed or removed completely
#if 0
static void gtk_window_destroy_callback( GtkWidget* widget, wxWindow *win )
{
wxWindowDestroyEvent event(win);
win->GetEventHandler()->ProcessEvent(event);
}
#endif // 0
//-----------------------------------------------------------------------------
// "realize" from m_widget
@ -2735,6 +2720,8 @@ bool wxWindowGTK::Create( wxWindow *parent,
wxWindowGTK::~wxWindowGTK()
{
SendDestroyEvent();
if (g_focusWindow == this)
g_focusWindow = NULL;
@ -2940,11 +2927,6 @@ void wxWindowGTK::ConnectWidget( GtkWidget *widget )
gtk_signal_connect( GTK_OBJECT(widget), "leave_notify_event",
GTK_SIGNAL_FUNC(gtk_window_leave_callback), (gpointer)this );
// This keeps crashing on me. RR.
//
// gtk_signal_connect( GTK_OBJECT(widget), "destroy",
// GTK_SIGNAL_FUNC(gtk_window_destroy_callback), (gpointer)this );
}
bool wxWindowGTK::Destroy()

View File

@ -2275,21 +2275,6 @@ wxWindow *wxWindowBase::FindFocus()
return (wxWindow *)g_focusWindow;
}
//-----------------------------------------------------------------------------
// "destroy" event
//-----------------------------------------------------------------------------
// VZ: Robert commented the code using out so it generates warnings: should
// be either fixed or removed completely
#if 0
static void gtk_window_destroy_callback( GtkWidget* widget, wxWindow *win )
{
wxWindowDestroyEvent event(win);
win->GetEventHandler()->ProcessEvent(event);
}
#endif // 0
//-----------------------------------------------------------------------------
// "realize" from m_widget
@ -2735,6 +2720,8 @@ bool wxWindowGTK::Create( wxWindow *parent,
wxWindowGTK::~wxWindowGTK()
{
SendDestroyEvent();
if (g_focusWindow == this)
g_focusWindow = NULL;
@ -2940,11 +2927,6 @@ void wxWindowGTK::ConnectWidget( GtkWidget *widget )
gtk_signal_connect( GTK_OBJECT(widget), "leave_notify_event",
GTK_SIGNAL_FUNC(gtk_window_leave_callback), (gpointer)this );
// This keeps crashing on me. RR.
//
// gtk_signal_connect( GTK_OBJECT(widget), "destroy",
// GTK_SIGNAL_FUNC(gtk_window_destroy_callback), (gpointer)this );
}
bool wxWindowGTK::Destroy()

View File

@ -133,6 +133,8 @@ void wxWindowMac::Init()
// Destructor
wxWindowMac::~wxWindowMac()
{
SendDestroyEvent();
// deleting a window while it is shown invalidates the region
if ( IsShown() ) {
wxWindowMac* iter = this ;

View File

@ -133,6 +133,8 @@ void wxWindowMac::Init()
// Destructor
wxWindowMac::~wxWindowMac()
{
SendDestroyEvent();
// deleting a window while it is shown invalidates the region
if ( IsShown() ) {
wxWindowMac* iter = this ;

View File

@ -563,6 +563,8 @@ void wxWindowMGL::Init()
// Destructor
wxWindowMGL::~wxWindowMGL()
{
SendDestroyEvent();
m_isBeingDeleted = TRUE;
if ( gs_mouseCapture == this )

View File

@ -3325,8 +3325,7 @@ bool wxWindowMSW::HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate)
bool wxWindowMSW::HandleDestroy()
{
wxWindowDestroyEvent event((wxWindow *)this);
(void)GetEventHandler()->ProcessEvent(event);
SendDestroyEvent();
// delete our drop target if we've got one
#if wxUSE_DRAG_AND_DROP

View File

@ -3513,9 +3513,7 @@ bool wxWindowOS2::HandleCreate(
bool wxWindowOS2::HandleDestroy()
{
wxWindowDestroyEvent vEvent((wxWindow*)this);
(void)GetEventHandler()->ProcessEvent(vEvent);
SendDestroyEvent();
//
// Delete our drop target if we've got one

View File

@ -341,6 +341,8 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
// Destructor
wxWindowX11::~wxWindowX11()
{
SendDestroyEvent();
if (g_captureWindow == this)
g_captureWindow = NULL;