#ifndef WX_PRECOMP
#include "wx/panel.h"
+ #include "wx/toplevel.h"
#endif
#include "wx/stockitem.h"
return true;
}
-void wxButton::SetDefault()
+wxWindow *wxButton::SetDefault()
{
- wxWindow *parent = GetParent();
- wxButton *btnOldDefault = NULL;
+ wxWindow *btnOldDefault = wxButtonBase::SetDefault();
- if ( parent )
+ if ( btnOldDefault )
{
- btnOldDefault = wxDynamicCast(parent->GetDefaultItem(), wxButton);
- parent->SetDefaultItem(this);
+ // cast needed to access the protected member
+ btnOldDefault->GetPeer()->SetData(kControlButtonPart , kControlPushButtonDefaultTag , (Boolean) 0 ) ;
}
- if ( btnOldDefault )
- btnOldDefault->m_peer->SetData(kControlButtonPart , kControlPushButtonDefaultTag , (Boolean) 0 ) ;
-
m_peer->SetData(kControlButtonPart , kControlPushButtonDefaultTag , (Boolean) 1 ) ;
+
+ return btnOldDefault;
}
wxSize wxButton::DoGetBestSize() const