X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4c37f1248bda69718bc13e2fdaa1ebb86f3dfc93..dd12ce22d806e6a9c40cf7bdfddbb237cd55b0ca:/src/mac/carbon/bmpbuttn.cpp diff --git a/src/mac/carbon/bmpbuttn.cpp b/src/mac/carbon/bmpbuttn.cpp index 8fba4742c7..2e9f9c6675 100644 --- a/src/mac/carbon/bmpbuttn.cpp +++ b/src/mac/carbon/bmpbuttn.cpp @@ -73,11 +73,13 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit wxMacCreateBitmapButton( &info , m_bmpNormal ) ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; + m_peer = new wxMacControl() ; verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , (( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevel : kControlBevelButtonNormalBevel ) , - kControlBehaviorOffsetContents , &info , 0 , 0 , 0 , (ControlRef*) &m_macControl ) ) ; + kControlBehaviorOffsetContents , &info , 0 , 0 , 0 , m_peer->GetControlRefAddr() ) ); - wxASSERT_MSG( (ControlRef) m_macControl != NULL , wxT("No valid mac control") ) ; + + wxASSERT_MSG( m_peer != NULL && m_peer->Ok() , wxT("No valid mac control") ) ; MacPostControlCreate(pos,size) ; @@ -87,12 +89,13 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap) { m_bmpNormal = bitmap; + InvalidateBestSize(); ControlButtonContentInfo info ; wxMacCreateBitmapButton( &info , m_bmpNormal ) ; if ( info.contentType != kControlNoContent ) { - ::SetControlData( (ControlRef) m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ; + m_peer->SetData( kControlButtonPart , kControlBevelButtonContentTag , info ) ; } }