]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/button.cpp
Fix wxTextFile::GetLine() documentation.
[wxWidgets.git] / src / gtk1 / button.cpp
index b3898b46b0c459830abe422ca1812863edf00849..cbcf71028c679cf164bc15cb9cd51a17cc4f6df2 100644 (file)
 
 #if wxUSE_BUTTON
 
-#include "wx/button.h"
+#ifndef WX_PRECOMP
+    #include "wx/button.h"
+#endif
+
 #include "wx/stockitem.h"
 
 #include "wx/gtk1/private.h"
@@ -52,7 +55,7 @@ static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *
 
     wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
     event.SetEventObject(button);
-    button->GetEventHandler()->ProcessEvent(event);
+    button->HandleWindowEvent(event);
 }
 }
 
@@ -91,8 +94,6 @@ gtk_button_style_set_callback( GtkWidget *m_widget, GtkStyle *WXUNUSED(style), w
 // wxButton
 //-----------------------------------------------------------------------------
 
-IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
-
 wxButton::wxButton()
 {
 }
@@ -152,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 */