X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b84aec037f06174a9e911aa9c9307c2a4e5b8f0b..ff42758536f8d573409bf6c35528497ba36b4d0e:/src/mac/carbon/button.cpp diff --git a/src/mac/carbon/button.cpp b/src/mac/carbon/button.cpp index 55785b73ac..9da363eb50 100644 --- a/src/mac/carbon/button.cpp +++ b/src/mac/carbon/button.cpp @@ -43,7 +43,7 @@ bool wxButton::Create(wxWindow *parent, 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 ) ; @@ -101,20 +101,19 @@ bool wxButton::Create(wxWindow *parent, 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