X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/93763ad5ba900aecb9220a36ebe7447313ea3e31..30c4dd918ad3fd79065f5253e012b39e5fe942c8:/src/gtk1/button.cpp diff --git a/src/gtk1/button.cpp b/src/gtk1/button.cpp index c84debc53d..f84cfc3221 100644 --- a/src/gtk1/button.cpp +++ b/src/gtk1/button.cpp @@ -13,6 +13,11 @@ #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 );