X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b905d6cc083a38d46ae48712f5221236247a39ce..bf473da729e2be34f890d8b9c9af4a4143f1647b:/src/mac/carbon/bmpbuttn.cpp?ds=sidebyside diff --git a/src/mac/carbon/bmpbuttn.cpp b/src/mac/carbon/bmpbuttn.cpp index 727df6679c..1176e5226b 100644 --- a/src/mac/carbon/bmpbuttn.cpp +++ b/src/mac/carbon/bmpbuttn.cpp @@ -9,10 +9,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "bmpbuttn.h" -#endif - #include "wx/wxprec.h" #if wxUSE_BMPBUTTON @@ -20,9 +16,7 @@ #include "wx/window.h" #include "wx/bmpbuttn.h" -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton) -#endif #include "wx/mac/uma.h" #include "wx/bitmap.h" @@ -69,14 +63,24 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit m_bmpNormal = bitmap; ControlButtonContentInfo info ; - wxMacCreateBitmapButton( &info , m_bmpNormal ) ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; m_peer = new wxMacControl( this ) ; - verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , - (( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevel : kControlBevelButtonNormalBevel ) , - kControlBehaviorOffsetContents , &info , 0 , 0 , 0 , m_peer->GetControlRefAddr() ) ); - + +#ifdef __WXMAC_OSX__ + if ( HasFlag( wxBORDER_NONE ) ) + { + wxMacCreateBitmapButton( &info , m_bmpNormal , kControlContentIconRef ) ; + verify_noerr ( CreateIconControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , &info , false , m_peer->GetControlRefAddr() ) ); + } + else +#endif + { + wxMacCreateBitmapButton( &info , m_bmpNormal ) ; + verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , + (( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevel : kControlBevelButtonNormalBevel ) , + kControlBehaviorOffsetContents , &info , 0 , 0 , 0 , m_peer->GetControlRefAddr() ) ); + } wxMacReleaseBitmapButton( &info ) ; wxASSERT_MSG( m_peer != NULL && m_peer->Ok() , wxT("No valid mac control") ) ; @@ -91,10 +95,23 @@ void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap) InvalidateBestSize(); ControlButtonContentInfo info ; - wxMacCreateBitmapButton( &info , m_bmpNormal ) ; - if ( info.contentType != kControlNoContent ) +#ifdef __WXMAC_OSX__ + if ( HasFlag( wxBORDER_NONE ) ) + { + wxMacCreateBitmapButton( &info , m_bmpNormal , kControlContentIconRef ) ; + if ( info.contentType != kControlNoContent ) + { + m_peer->SetData( kControlIconPart , kControlIconContentTag , info ) ; + } + } + else +#endif { - m_peer->SetData( kControlButtonPart , kControlBevelButtonContentTag , info ) ; + wxMacCreateBitmapButton( &info , m_bmpNormal ) ; + if ( info.contentType != kControlNoContent ) + { + m_peer->SetData( kControlButtonPart , kControlBevelButtonContentTag , info ) ; + } } wxMacReleaseBitmapButton( &info ) ; }