X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bcd055ae108a30299fa278f3fe774f52414eb3df..f68c6b523c1117c90c1cf690745c807bc024789d:/src/motif/button.cpp diff --git a/src/motif/button.cpp b/src/motif/button.cpp index eb0af12804..de02890cb2 100644 --- a/src/motif/button.cpp +++ b/src/motif/button.cpp @@ -17,6 +17,8 @@ #define XtDisplay XTDISPLAY #endif +#include "wx/defs.h" + #include "wx/button.h" #include "wx/utils.h" #include "wx/panel.h" @@ -108,9 +110,8 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label, void wxButton::SetDefault() { wxWindow *parent = GetParent(); - wxPanel *panel = wxDynamicCast(parent, wxPanel); - if ( panel ) - panel->SetDefaultItem(this); + if ( parent ) + parent->SetDefaultItem(this); // We initially do not set XmNdefaultShadowThickness, to have small buttons. // Unfortunately, buttons are now mis-aligned. We try to correct this @@ -118,10 +119,12 @@ void wxButton::SetDefault() // Because it's very hard to find wxButton in the same row, // correction is straighforward: we set resource for all wxButton // in this parent (but not sub panels) - for (wxNode * node = parent->GetChildren().First (); node; node = node->Next ()) + for (wxWindowList::Node * node = parent->GetChildren().GetFirst (); + node; node = node->GetNext ()) { - wxButton *item = (wxButton *) node->Data (); - if (item->IsKindOf(CLASSINFO(wxButton))) + wxWindow *win = node->GetData (); + wxButton *item = wxDynamicCast(win, wxButton); + if (item) { bool managed = XtIsManaged((Widget) item->GetMainWidget()); if (managed)