#ifndef WX_PRECOMP
#include "wx/panel.h"
+ #include "wx/toplevel.h"
#endif
#include "wx/stockitem.h"
if ( !wxButtonBase::Create(parent, id, pos, size, style, validator, name) )
return false;
- m_label = label ;
+ m_labelOrig = m_label = label ;
OSStatus err;
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
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