]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/button.cpp
corrected version in the libraries names: it's only 2 digits even in development...
[wxWidgets.git] / src / gtk1 / button.cpp
index c84debc53d2710540c53b85bac7255d1695dd252..f84cfc32213da3fcf1d2adc4c2fb6fbddd94d2e7 100644 (file)
 #if wxUSE_BUTTON
 
 #include "wx/button.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/toplevel.h"
+#endif
+
 #include "wx/stockitem.h"
 
 #include "wx/gtk1/private.h"
@@ -154,10 +159,10 @@ bool wxButton::Create(  wxWindow *parent, wxWindowID id, const wxString &label,
 
 void wxButton::SetDefault()
 {
-    wxWindow *parent = GetParent();
-    wxCHECK_RET( parent, _T("button without parent?") );
+    wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
+    wxCHECK_RET( tlw, _T("button without top level window?") );
 
-    parent->SetDefaultItem(this);
+    tlw->SetDefaultItem(this);
 
     GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT );
     gtk_widget_grab_default( m_widget );