X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5c33522fca7cddc441a316f5b9fb50d7685435ba..17ad51edc74e86c6f914b0a5342d5603ac9d4344:/src/osx/carbon/toolbar.cpp?ds=sidebyside diff --git a/src/osx/carbon/toolbar.cpp b/src/osx/carbon/toolbar.cpp index 71f3a5701f..170c37baaa 100644 --- a/src/osx/carbon/toolbar.cpp +++ b/src/osx/carbon/toolbar.cpp @@ -501,16 +501,20 @@ void wxToolBarTool::UpdateToggleImage( bool toggle ) { if ( toggle ) { - int w = m_bmpNormal.GetWidth(); - int h = m_bmpNormal.GetHeight(); + int w = m_bmpNormal.GetWidth() + 6; + int h = m_bmpNormal.GetHeight() + 6; wxBitmap bmp( w, h ); wxMemoryDC dc; dc.SelectObject( bmp ); - dc.SetPen( wxPen(*wxBLACK) ); - dc.SetBrush( wxBrush( *wxLIGHT_GREY )); - dc.DrawRectangle( 0, 0, w, h ); - dc.DrawBitmap( m_bmpNormal, 0, 0, true ); + wxColour mid_grey_75 = wxColour(128, 128, 128, 196); + wxColour light_grey_75 = wxColour(196, 196, 196, 196); + 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.SelectObject( wxNullBitmap ); ControlButtonContentInfo info; wxMacCreateBitmapButton( &info, bmp ); @@ -1104,10 +1108,18 @@ bool wxToolBar::MacInstallNativeToolbar(bool usesNative) bResult = true; SetWindowToolbar( tlw, (HIToolbarRef) m_macToolbar ); + + // ShowHideWindowToolbar will make the wxFrame grow + // which we don't want in this case + wxSize sz = GetParent()->GetSize(); ShowHideWindowToolbar( tlw, true, false ); + // Restore the orginal size + GetParent()->SetSize( sz ); + ChangeWindowAttributes( tlw, kWindowToolbarButtonAttribute, 0 ); + SetAutomaticControlDragTrackingEnabledForWindow( tlw, true ); - + m_peer->Move(0,0,0,0 ); SetSize( wxSIZE_AUTO_WIDTH, 0 ); m_peer->SetVisibility( false ); @@ -1141,6 +1153,8 @@ bool wxToolBar::Realize() { if (m_tools.GetCount() == 0) return false; + + wxSize tlw_sz = GetParent()->GetSize(); int maxWidth = 0; int maxHeight = 0; @@ -1349,6 +1363,9 @@ bool wxToolBar::Realize() node = node->GetNext(); } + if (m_macUsesNativeToolbar) + GetParent()->SetSize( tlw_sz ); + if ( GetWindowStyleFlag() & wxTB_HORIZONTAL ) { // if not set yet, only one row @@ -1489,7 +1506,7 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const node = node->GetNext(); } - return (wxToolBarToolBase*)NULL; + return NULL; } wxString wxToolBar::MacGetToolTipString( wxPoint &pt ) @@ -1506,7 +1523,7 @@ void wxToolBar::DoEnableTool(wxToolBarToolBase *WXUNUSED(t), bool WXUNUSED(enabl // everything already done in the tool's implementation } -void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle) +void wxToolBar::DoToggleTool(wxToolBarToolBase *WXUNUSED(t), bool WXUNUSED(toggle)) { // everything already done in the tool's implementation }