X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0ac091aecd02f787013aaece7fa10d46ee63b556..a7868cdf6a8782a04a46791dd63de2ade825a8bc:/src/mac/carbon/toolbar.cpp diff --git a/src/mac/carbon/toolbar.cpp b/src/mac/carbon/toolbar.cpp index f338f0fc77..997a557d1b 100644 --- a/src/mac/carbon/toolbar.cpp +++ b/src/mac/carbon/toolbar.cpp @@ -392,8 +392,6 @@ void wxToolBarTool::SetPosition( const wxPoint& position ) m_x = position.x; m_y = position.y; - int x, y; - x = y = 0; int mac_x = position.x; int mac_y = position.y; @@ -437,33 +435,6 @@ void wxToolBarTool::SetPosition( const wxPoint& position ) void wxToolBarTool::UpdateToggleImage( bool toggle ) { -#if wxMAC_USE_NATIVE_TOOLBAR - -#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4 -#define kHIToolbarItemSelected (1 << 7) -#endif - - // FIXME: this should be a OSX v10.4 runtime check - if (m_toolbarItemRef != NULL) - { - OptionBits addAttrs, removeAttrs; - OSStatus result; - - if (toggle) - { - addAttrs = kHIToolbarItemSelected; - removeAttrs = kHIToolbarItemNoAttributes; - } - else - { - addAttrs = kHIToolbarItemNoAttributes; - removeAttrs = kHIToolbarItemSelected; - } - - result = HIToolbarItemChangeAttributes( m_toolbarItemRef, addAttrs, removeAttrs ); - } -#endif - #ifdef __WXMAC_OSX__ if ( toggle ) { @@ -473,14 +444,20 @@ void wxToolBarTool::UpdateToggleImage( bool toggle ) wxMemoryDC dc; dc.SelectObject( bmp ); - dc.SetPen( wxNullPen ); - dc.SetBackground( *wxWHITE ); + dc.SetPen( wxPen(*wxBLACK) ); + dc.SetBrush( wxBrush( *wxLIGHT_GREY )); dc.DrawRectangle( 0, 0, w, h ); dc.DrawBitmap( m_bmpNormal, 0, 0, true ); dc.SelectObject( wxNullBitmap ); ControlButtonContentInfo info; wxMacCreateBitmapButton( &info, bmp ); SetControlData( m_controlHandle, 0, kControlIconContentTag, sizeof(info), (Ptr)&info ); +#if wxMAC_USE_NATIVE_TOOLBAR + if (m_toolbarItemRef != NULL) + { + HIToolbarItemSetIconRef( m_toolbarItemRef, info.u.iconRef ); + } +#endif wxMacReleaseBitmapButton( &info ); } else @@ -488,6 +465,12 @@ void wxToolBarTool::UpdateToggleImage( bool toggle ) ControlButtonContentInfo info; wxMacCreateBitmapButton( &info, m_bmpNormal ); SetControlData( m_controlHandle, 0, kControlIconContentTag, sizeof(info), (Ptr)&info ); +#if wxMAC_USE_NATIVE_TOOLBAR + if (m_toolbarItemRef != NULL) + { + HIToolbarItemSetIconRef( m_toolbarItemRef, info.u.iconRef ); + } +#endif wxMacReleaseBitmapButton( &info ); } @@ -729,6 +712,7 @@ CantCreateEvent : return result ; } +#if wxMAC_USE_NATIVE_TOOLBAR static const EventTypeSpec kToolbarEvents[] = { { kEventClassToolbar, kEventToolbarGetDefaultIdentifiers }, @@ -792,6 +776,7 @@ static OSStatus ToolbarDelegateHandler( EventHandlerCallRef inCallRef, EventRef } return result ; } +#endif // wxMAC_USE_NATIVE_TOOLBAR // also for the toolbar we have the dual implementation: // only when MacInstallNativeToolbar is called is the native toolbar set as the window toolbar @@ -1085,7 +1070,6 @@ bool wxToolBar::Realize() bool lastIsRadio = false; bool curIsRadio = false; - bool setChoiceInGroup = false; #if wxMAC_USE_NATIVE_TOOLBAR CFIndex currentPosition = 0; @@ -1180,8 +1164,6 @@ bool wxToolBar::Realize() { if ( tool->IsToggled() ) DoToggleTool( tool, true ); - - setChoiceInGroup = false; } else { @@ -1190,7 +1172,6 @@ bool wxToolBar::Realize() if ( tool->Toggle( true ) ) { DoToggleTool( tool, true ); - setChoiceInGroup = true; } } else if ( tool->IsToggled() ) @@ -1259,7 +1240,7 @@ bool wxToolBar::Realize() InvalidateBestSize(); #endif - SetBestFittingSize(); + SetInitialSize(); return true; } @@ -1667,7 +1648,9 @@ void wxToolBar::OnPaint(wxPaintEvent& event) drawInfo.kind = kThemeBackgroundMetal; HIThemeApplyBackground( &hiToolbarrect, &drawInfo, cgContext, kHIThemeOrientationNormal ); +#ifndef __LP64__ QDEndCGContext( (CGrafPtr) dc.m_macPort, &cgContext ); +#endif #endif } }