#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()
{
- wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
- wxButton *btnOldDefault = NULL;
- if ( tlw )
- {
- btnOldDefault = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
- tlw->SetDefaultItem(this);
- }
+ wxWindow *btnOldDefault = wxButtonBase::SetDefault();
if ( btnOldDefault )
- btnOldDefault->m_peer->SetData(kControlButtonPart , kControlPushButtonDefaultTag , (Boolean) 0 ) ;
+ {
+ // cast needed to access the protected member
+ btnOldDefault->GetPeer()->SetData(kControlButtonPart , kControlPushButtonDefaultTag , (Boolean) 0 ) ;
+ }
m_peer->SetData(kControlButtonPart , kControlPushButtonDefaultTag , (Boolean) 1 ) ;
+
+ return btnOldDefault;
}
wxSize wxButton::DoGetBestSize() const