Skip to content

Commit

Permalink
Make toggle buttons on OS X much more visibly distinct
Browse files Browse the repository at this point in the history
  • Loading branch information
tgoyne committed Jul 27, 2015
1 parent 30d112e commit a80aaf4
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions src/osx/cocoa/toolbar.mm
Expand Up @@ -564,22 +564,9 @@ - (BOOL) isFlipped

if ( CanBeToggled() )
{
int w = m_bmpNormal.GetScaledWidth();
int h = m_bmpNormal.GetScaledHeight();
m_alternateBitmap = wxBitmap();
m_alternateBitmap.CreateScaled(w, h, -1, m_bmpNormal.GetScaleFactor());
wxMemoryDC dc;

dc.SelectObject(m_alternateBitmap);
// This color corresponds to OS X Yosemite's rendering of selected toolbar items
// See also http://trac.wxwidgets.org/ticket/16645
wxColour grey(0xB9, 0xB9, 0xB9);
dc.SetPen(grey);
dc.SetBrush(grey);
dc.DrawRoundedRectangle( 0, 0, w, h, 3 );
dc.DrawBitmap( m_bmpNormal, 0, 0, true );
dc.SelectObject( wxNullBitmap );

m_alternateBitmap = m_bmpNormal;
m_bmpNormal = m_bmpNormal.ConvertToImage().ConvertToGreyscale();
[(NSButton*) m_controlHandle setImage:m_bmpNormal.GetNSImage()];
[(NSButton*) m_controlHandle setAlternateImage:m_alternateBitmap.GetNSImage()];
}
UpdateToggleImage( CanBeToggled() && IsToggled() );
Expand Down

0 comments on commit a80aaf4

Please sign in to comment.