+ if ( mouseStillDown )
+ scrollEvent = wxEVT_SCROLL_THUMBTRACK;
+ else
+ scrollEvent = wxEVT_SCROLL_THUMBRELEASE;
+ break ;
+ default :
+ wxFAIL_MSG(wxT("illegal scrollbar selector"));
+ break ;
+ }
+
+ int new_pos = position + nScrollInc;
+
+ if (new_pos < minPos)
+ new_pos = minPos;
+ if (new_pos > maxPos)
+ new_pos = maxPos;
+ if ( nScrollInc )
+ SetThumbPosition(new_pos);
+
+ wxScrollEvent event(scrollEvent, m_windowId);
+ if ( m_windowStyle & wxHORIZONTAL )
+ {
+ event.SetOrientation( wxHORIZONTAL ) ;
+ }
+ else
+ {
+ event.SetOrientation( wxVERTICAL ) ;
+ }
+ event.SetPosition(new_pos);
+ event.SetEventObject( this );
+ wxWindow* window = GetParent() ;
+ if (window && window->MacIsWindowScrollbar(this) )
+ {
+ // this is hardcoded
+ window->MacOnScroll(event);
+ }
+ else
+ GetEventHandler()->ProcessEvent(event);
+}
+
+wxInt32 wxScrollBar::MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF mevent )
+{
+ int position = m_peer->GetValue() ;
+ int minPos = m_peer->GetMinimum() ;
+ int maxPos = m_peer->GetMaximum() ;
+
+ wxEventType scrollEvent = wxEVT_NULL;
+ int nScrollInc = 0;
+
+ wxMacCarbonEvent cEvent( (EventRef) mevent ) ;
+ ControlPartCode controlpart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPart,typeControlPartCode) ;
+
+ // all events have already been reported during mouse down, except for THUMBRELEASE
+ if ( controlpart !=kControlIndicatorPart )
+ return eventNotHandledErr ;
+
+ switch( controlpart )
+ {
+ case kControlIndicatorPart :
+ nScrollInc = 0 ;
+ scrollEvent = wxEVT_SCROLL_THUMBRELEASE;