backport of better drawing for toggle buttons
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@64084 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -133,11 +133,11 @@ public:
|
|||||||
if ( m_toolbarItemRef )
|
if ( m_toolbarItemRef )
|
||||||
{
|
{
|
||||||
CFIndex count = CFGetRetainCount( m_toolbarItemRef ) ;
|
CFIndex count = CFGetRetainCount( m_toolbarItemRef ) ;
|
||||||
// different behaviour under Leopard
|
// different behaviour under Leopard
|
||||||
if ( UMAGetSystemVersion() < 0x1050 )
|
if ( UMAGetSystemVersion() < 0x1050 )
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( count == 1 , wxT("Reference Count of native tool was not 1 in wxToolBarTool destructor") );
|
wxASSERT_MSG( count == 1 , wxT("Reference Count of native tool was not 1 in wxToolBarTool destructor") );
|
||||||
}
|
}
|
||||||
wxTheApp->MacAddToAutorelease(m_toolbarItemRef);
|
wxTheApp->MacAddToAutorelease(m_toolbarItemRef);
|
||||||
CFRelease(m_toolbarItemRef);
|
CFRelease(m_toolbarItemRef);
|
||||||
m_toolbarItemRef = NULL;
|
m_toolbarItemRef = NULL;
|
||||||
@@ -472,15 +472,21 @@ void wxToolBarTool::UpdateToggleImage( bool toggle )
|
|||||||
#ifdef __WXMAC_OSX__
|
#ifdef __WXMAC_OSX__
|
||||||
if ( toggle )
|
if ( toggle )
|
||||||
{
|
{
|
||||||
int w = m_bmpNormal.GetWidth();
|
int w = m_bmpNormal.GetWidth() + 6;
|
||||||
int h = m_bmpNormal.GetHeight();
|
int h = m_bmpNormal.GetHeight() + 6;
|
||||||
wxBitmap bmp( w, h );
|
wxBitmap bmp( w, h );
|
||||||
wxMemoryDC dc;
|
wxMemoryDC dc;
|
||||||
|
|
||||||
dc.SelectObject( bmp );
|
dc.SelectObject( bmp );
|
||||||
dc.SetPen( wxPen(*wxBLACK) );
|
wxColour mid_grey_75 = wxColour(128, 128, 128, 196);
|
||||||
dc.SetBrush( wxBrush( *wxLIGHT_GREY ));
|
wxColour light_grey_75 = wxColour(196, 196, 196, 196);
|
||||||
dc.DrawRectangle( 0, 0, w, h );
|
dc.GradientFillLinear( wxRect(1, 1, w - 1, h-1),
|
||||||
|
light_grey_75, mid_grey_75, wxNORTH);
|
||||||
|
wxColour black_50 = wxColour(0, 0, 0, 127);
|
||||||
|
dc.SetPen( wxPen(black_50) );
|
||||||
|
dc.DrawRoundedRectangle( 0, 0, w, h, 1.5 );
|
||||||
|
dc.DrawBitmap( m_bmpNormal, 3, 3, true );
|
||||||
|
|
||||||
dc.DrawBitmap( m_bmpNormal, 0, 0, true );
|
dc.DrawBitmap( m_bmpNormal, 0, 0, true );
|
||||||
dc.SelectObject( wxNullBitmap );
|
dc.SelectObject( wxNullBitmap );
|
||||||
ControlButtonContentInfo info;
|
ControlButtonContentInfo info;
|
||||||
@@ -666,8 +672,8 @@ static pascal OSStatus ControlToolbarItemHandler( EventHandlerCallRef inCallRef,
|
|||||||
if ( count >= 1 )
|
if ( count >= 1 )
|
||||||
CFRelease( viewRef ) ;
|
CFRelease( viewRef ) ;
|
||||||
}
|
}
|
||||||
free( object ) ;
|
free( object ) ;
|
||||||
result = noErr;
|
result = noErr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -679,7 +685,7 @@ static pascal OSStatus ControlToolbarItemHandler( EventHandlerCallRef inCallRef,
|
|||||||
case kEventToolbarItemCreateCustomView:
|
case kEventToolbarItemCreateCustomView:
|
||||||
{
|
{
|
||||||
HIViewRef viewRef = object->viewRef ;
|
HIViewRef viewRef = object->viewRef ;
|
||||||
HIViewRemoveFromSuperview( viewRef ) ;
|
HIViewRemoveFromSuperview( viewRef ) ;
|
||||||
HIViewSetVisible(viewRef, true) ;
|
HIViewSetVisible(viewRef, true) ;
|
||||||
CFRetain( viewRef ) ;
|
CFRetain( viewRef ) ;
|
||||||
result = SetEventParameter( inEvent, kEventParamControlRef, typeControlRef, sizeof( HIViewRef ), &viewRef );
|
result = SetEventParameter( inEvent, kEventParamControlRef, typeControlRef, sizeof( HIViewRef ), &viewRef );
|
||||||
@@ -900,11 +906,11 @@ wxToolBar::~wxToolBar()
|
|||||||
MacInstallNativeToolbar( false );
|
MacInstallNativeToolbar( false );
|
||||||
|
|
||||||
CFIndex count = CFGetRetainCount( m_macHIToolbarRef ) ;
|
CFIndex count = CFGetRetainCount( m_macHIToolbarRef ) ;
|
||||||
// Leopard seems to have one refcount more, so we cannot check reliably at the moment
|
// Leopard seems to have one refcount more, so we cannot check reliably at the moment
|
||||||
if ( UMAGetSystemVersion() < 0x1050 )
|
if ( UMAGetSystemVersion() < 0x1050 )
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( count == 1 , wxT("Reference Count of native control was not 1 in wxToolBar destructor") );
|
wxASSERT_MSG( count == 1 , wxT("Reference Count of native control was not 1 in wxToolBar destructor") );
|
||||||
}
|
}
|
||||||
CFRelease( (HIToolbarRef)m_macHIToolbarRef );
|
CFRelease( (HIToolbarRef)m_macHIToolbarRef );
|
||||||
m_macHIToolbarRef = NULL;
|
m_macHIToolbarRef = NULL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user