+bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
+{
+ return TRUE ;
+}
+
+void wxToolBar::OnPaint(wxPaintEvent& event)
+{
+ Point localOrigin ;
+ Rect clipRect ;
+ WindowRef window ;
+ wxWindow *win ;
+
+ GetParent()->MacGetPortParams( &localOrigin , &clipRect , &window , &win ) ;
+ if ( window && win )
+ {
+ wxMacDrawingHelper help( win ) ;
+ // the mac control manager always assumes to have the origin at 0,0
+ SetOrigin( 0 , 0 ) ;
+
+ bool hasTabBehind = false ;
+ wxWindow* parent = GetParent() ;
+ while ( parent )
+ {
+ if( parent->MacGetWindowData() )
+ {
+ UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
+ break ;
+ }
+
+ if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
+ {
+ if ( ((wxControl*)parent)->GetMacControl() )
+ SetUpControlBackground( ((wxControl*)parent)->GetMacControl() , -1 , true ) ;
+ break ;
+ }
+
+ parent = parent->GetParent() ;
+ }
+
+ Rect toolbarrect = { m_y + localOrigin.v , m_x + localOrigin.h ,
+ m_y + localOrigin.v + m_height , m_x + localOrigin.h + m_width } ;
+
+ UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
+ {
+ int index = 0 ;
+ for ( index = 0 ; index < m_macToolHandles.Count() ; ++index )
+ {
+ if ( m_macToolHandles[index] )
+ {
+ UMADrawControl( (ControlHandle) m_macToolHandles[index] ) ;
+ }
+ }
+ }
+ UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
+ }
+}
+
+void wxToolBar::OnMouse( wxMouseEvent &event )
+{
+
+ if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
+ {
+
+ int x = event.m_x ;
+ int y = event.m_y ;
+
+ MacClientToRootWindow( &x , &y ) ;
+
+ ControlHandle control ;
+ Point localwhere ;
+ GrafPtr port ;
+ SInt16 controlpart ;
+ WindowRef window = GetMacRootWindow() ;
+
+ localwhere.h = x ;
+ localwhere.v = y ;
+
+ short modifiers = 0;
+
+ if ( !event.m_leftDown && !event.m_rightDown )
+ modifiers |= btnState ;
+
+ if ( event.m_shiftDown )
+ modifiers |= shiftKey ;
+
+ if ( event.m_controlDown )
+ modifiers |= controlKey ;
+
+ if ( event.m_altDown )
+ modifiers |= optionKey ;
+
+ if ( event.m_metaDown )
+ modifiers |= cmdKey ;
+
+ controlpart = FindControl( localwhere , window , &control ) ;
+ {
+ if ( control && UMAIsControlActive( control ) )
+ {
+ {
+ if ( controlpart == kControlIndicatorPart && !UMAHasAppearance() )
+ controlpart = UMAHandleControlClick( control , localwhere , modifiers , (ControlActionUPP) NULL ) ;
+ else
+ controlpart = UMAHandleControlClick( control , localwhere , modifiers , (ControlActionUPP) -1 ) ;
+ wxTheApp->s_lastMouseDown = 0 ;
+ if ( controlpart && ! ( ( UMAHasAppearance() || (controlpart != kControlIndicatorPart) )
+ && (IsKindOf( CLASSINFO( wxScrollBar ) ) ) ) ) // otherwise we will get the event twice
+ {
+ MacHandleControlClick( control , controlpart ) ;
+ }
+ }
+ }
+ }
+ }