X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/18f3decb46a80b38801dd6590d08eb525d3a3963..8a16d7370e3cdc7d583a6f14ab11b3a1d27b73df:/src/mac/classic/button.cpp diff --git a/src/mac/classic/button.cpp b/src/mac/classic/button.cpp index 12864683c9..714983c2fa 100644 --- a/src/mac/classic/button.cpp +++ b/src/mac/classic/button.cpp @@ -16,7 +16,11 @@ #endif #include "wx/button.h" -#include "wx/panel.h" + +#ifndef WX_PRECOMP + #include "wx/panel.h" +#endif + #include "wx/stockitem.h" IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl) @@ -62,13 +66,12 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& lbl, void wxButton::SetDefault() { - wxWindow *parent = GetParent(); + wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); wxButton *btnOldDefault = NULL; - if ( parent ) + if ( tlw ) { - btnOldDefault = wxDynamicCast(parent->GetDefaultItem(), - wxButton); - parent->SetDefaultItem(this); + btnOldDefault = wxDynamicCast(tlw->GetDefaultItem(), wxButton); + tlw->SetDefaultItem(this); } Boolean inData; @@ -90,7 +93,7 @@ wxSize wxButton::DoGetBestSize() const { wxSize sz = GetDefaultSize() ; - int wBtn = m_label.Length() * 8 + 12 + 2 * kMacOSXHorizontalBorder ; + int wBtn = m_label.length() * 8 + 12 + 2 * kMacOSXHorizontalBorder ; if (wBtn > sz.x) sz.x = wBtn;