support for wxNO_BORDER

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36107 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2005-11-07 16:36:00 +00:00
parent 51cdab3ef8
commit d32be04cd7

View File

@@ -63,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") ) ;
@@ -85,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 ) )
{
m_peer->SetData( kControlButtonPart , kControlBevelButtonContentTag , info ) ;
wxMacCreateBitmapButton( &info , m_bmpNormal , kControlContentIconRef ) ;
if ( info.contentType != kControlNoContent )
{
m_peer->SetData( kControlIconPart , kControlIconContentTag , info ) ;
}
}
else
#endif
{
wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
if ( info.contentType != kControlNoContent )
{
m_peer->SetData( kControlButtonPart , kControlBevelButtonContentTag , info ) ;
}
}
wxMacReleaseBitmapButton( &info ) ;
}