]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/button.cpp
Declarations missing from VC++ 5
[wxWidgets.git] / src / gtk / button.cpp
index 74281019ca41bd0e4f7ef05a59a4d2a69d90aae1..efcfb9626fd11a816c2f9c0fdcd93d2363dbb01d 100644 (file)
 #if wxUSE_BUTTON
 
 #include "wx/button.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/toplevel.h"
+#endif
+
 #include "wx/stockitem.h"
 
 #include "wx/gtk/private.h"
@@ -165,10 +170,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 );