X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2cdcee612a0ea692f0d20f7a039950a793294ac0..12bb29f5432174ecbd65549bda832d70d34a98ae:/src/gtk1/button.cpp diff --git a/src/gtk1/button.cpp b/src/gtk1/button.cpp index f84cfc3221..3ff3a24241 100644 --- a/src/gtk1/button.cpp +++ b/src/gtk1/button.cpp @@ -12,10 +12,8 @@ #if wxUSE_BUTTON -#include "wx/button.h" - #ifndef WX_PRECOMP - #include "wx/toplevel.h" + #include "wx/button.h" #endif #include "wx/stockitem.h" @@ -55,9 +53,9 @@ static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton * if (!button->m_hasVMT) return; if (g_blockEventsOnDrag) return; - wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId()); + wxCommandEvent event(wxEVT_BUTTON, button->GetId()); event.SetEventObject(button); - button->GetEventHandler()->ProcessEvent(event); + button->HandleWindowEvent(event); } } @@ -96,8 +94,6 @@ gtk_button_style_set_callback( GtkWidget *m_widget, GtkStyle *WXUNUSED(style), w // wxButton //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl) - wxButton::wxButton() { } @@ -157,18 +153,17 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, } -void wxButton::SetDefault() +wxWindow *wxButton::SetDefault() { - wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); - wxCHECK_RET( tlw, _T("button without top level window?") ); - - tlw->SetDefaultItem(this); + wxWindow *oldDefault = wxButtonBase::SetDefault(); GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT ); gtk_widget_grab_default( m_widget ); // resize for default border gtk_button_style_set_callback( m_widget, NULL, this ); + + return oldDefault; } /* static */