From 31c6b4fc1022d33896e9b3d196f462744359e14f Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Tue, 11 May 1999 08:23:53 +0000 Subject: [PATCH] Implememted IsBeingDeleted() -> buttons work again git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2405 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/msgdlgg.cpp | 3 --- src/gtk/button.cpp | 2 -- src/gtk/dialog.cpp | 6 ++---- src/gtk/frame.cpp | 2 ++ src/gtk/window.cpp | 2 ++ src/gtk1/button.cpp | 2 -- src/gtk1/dialog.cpp | 6 ++---- src/gtk1/frame.cpp | 2 ++ src/gtk1/window.cpp | 2 ++ 9 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/generic/msgdlgg.cpp b/src/generic/msgdlgg.cpp index 0c40ccf0f4..a62f479748 100644 --- a/src/generic/msgdlgg.cpp +++ b/src/generic/msgdlgg.cpp @@ -161,19 +161,16 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent, const wxString void wxGenericMessageDialog::OnYes(wxCommandEvent& WXUNUSED(event)) { - printf( "yes.\n" ); EndModal( wxID_YES ); } void wxGenericMessageDialog::OnNo(wxCommandEvent& WXUNUSED(event)) { - printf( "no.\n" ); EndModal( wxID_NO ); } void wxGenericMessageDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) { - printf( "cancel message.\n" ); /* Allow cancellation via ESC/Close button except if only YES and NO are specified. */ if ( (m_dialogStyle & wxYES_NO) != wxYES_NO || (m_dialogStyle & wxCANCEL) ) diff --git a/src/gtk/button.cpp b/src/gtk/button.cpp index 62e357c733..140e4380ef 100644 --- a/src/gtk/button.cpp +++ b/src/gtk/button.cpp @@ -47,8 +47,6 @@ static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton * if (!button->m_hasVMT) return; if (g_blockEventsOnDrag) return; - printf( "clicked: %s.\n", button->GetLabel().c_str() ); - wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId()); event.SetEventObject(button); button->GetEventHandler()->ProcessEvent(event); diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index ee60f258f2..92622c8f68 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -245,6 +245,8 @@ bool wxDialog::Create( wxWindow *parent, wxDialog::~wxDialog() { + m_isBeingDeleted = TRUE; + wxTopLevelWindows.DeleteObject( this ); if (wxTheApp->GetTopWindow() == this) @@ -290,18 +292,14 @@ void wxDialog::OnCancel( wxCommandEvent &WXUNUSED(event) ) void wxDialog::OnOK( wxCommandEvent &WXUNUSED(event) ) { - printf( "OnOK 1.\n" ); if (Validate() && TransferDataFromWindow()) { - printf( "OnOK 2.\n" ); if (IsModal()) { - printf( "OnOK: modal.\n" ); EndModal(wxID_OK); } else { - printf( "OnOK: non-modal.\n" ); SetReturnCode(wxID_OK); this->Show(FALSE); } diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index 6fe147fa9b..a0c6bb403f 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -413,6 +413,8 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title, wxFrame::~wxFrame() { + m_isBeingDeleted = TRUE; + if (m_frameMenuBar) delete m_frameMenuBar; m_frameMenuBar = (wxMenuBar *) NULL; diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 4abdea598a..4af2690024 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -1453,6 +1453,7 @@ void wxWindow::Init() m_sizeSet = FALSE; m_hasVMT = FALSE; m_needParent = TRUE; + m_isBeingDeleted = FALSE; m_hasScrolling = FALSE; m_isScrolling = FALSE; @@ -1633,6 +1634,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id, wxWindow::~wxWindow() { + m_isBeingDeleted = TRUE; m_hasVMT = FALSE; if (m_widget) diff --git a/src/gtk1/button.cpp b/src/gtk1/button.cpp index 62e357c733..140e4380ef 100644 --- a/src/gtk1/button.cpp +++ b/src/gtk1/button.cpp @@ -47,8 +47,6 @@ static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton * if (!button->m_hasVMT) return; if (g_blockEventsOnDrag) return; - printf( "clicked: %s.\n", button->GetLabel().c_str() ); - wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId()); event.SetEventObject(button); button->GetEventHandler()->ProcessEvent(event); diff --git a/src/gtk1/dialog.cpp b/src/gtk1/dialog.cpp index ee60f258f2..92622c8f68 100644 --- a/src/gtk1/dialog.cpp +++ b/src/gtk1/dialog.cpp @@ -245,6 +245,8 @@ bool wxDialog::Create( wxWindow *parent, wxDialog::~wxDialog() { + m_isBeingDeleted = TRUE; + wxTopLevelWindows.DeleteObject( this ); if (wxTheApp->GetTopWindow() == this) @@ -290,18 +292,14 @@ void wxDialog::OnCancel( wxCommandEvent &WXUNUSED(event) ) void wxDialog::OnOK( wxCommandEvent &WXUNUSED(event) ) { - printf( "OnOK 1.\n" ); if (Validate() && TransferDataFromWindow()) { - printf( "OnOK 2.\n" ); if (IsModal()) { - printf( "OnOK: modal.\n" ); EndModal(wxID_OK); } else { - printf( "OnOK: non-modal.\n" ); SetReturnCode(wxID_OK); this->Show(FALSE); } diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index 6fe147fa9b..a0c6bb403f 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -413,6 +413,8 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title, wxFrame::~wxFrame() { + m_isBeingDeleted = TRUE; + if (m_frameMenuBar) delete m_frameMenuBar; m_frameMenuBar = (wxMenuBar *) NULL; diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 4abdea598a..4af2690024 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -1453,6 +1453,7 @@ void wxWindow::Init() m_sizeSet = FALSE; m_hasVMT = FALSE; m_needParent = TRUE; + m_isBeingDeleted = FALSE; m_hasScrolling = FALSE; m_isScrolling = FALSE; @@ -1633,6 +1634,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id, wxWindow::~wxWindow() { + m_isBeingDeleted = TRUE; m_hasVMT = FALSE; if (m_widget)