+void wxScrollBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
+{
+ if ( (ControlHandle) m_macControl == NULL )
+ return ;
+
+ int position = GetControlValue( (ControlHandle) m_macControl) ;
+ int minPos = GetControlMinimum( (ControlHandle) m_macControl) ;
+ int maxPos = GetControlMaximum( (ControlHandle) m_macControl) ;
+
+ wxEventType scrollEvent = wxEVT_NULL;
+ int nScrollInc;
+
+ switch( controlpart )
+ {
+ case kControlUpButtonPart :
+ nScrollInc = -1;
+ scrollEvent = wxEVT_SCROLL_LINEUP;
+ break ;
+ case kControlDownButtonPart :
+ nScrollInc = 1;
+ scrollEvent = wxEVT_SCROLL_LINEDOWN;
+ break ;
+ case kControlPageUpPart :
+ nScrollInc = -m_pageSize;
+ scrollEvent = wxEVT_SCROLL_PAGEUP;
+ break ;
+ case kControlPageDownPart :
+ nScrollInc = m_pageSize;
+ scrollEvent = wxEVT_SCROLL_PAGEDOWN;
+ break ;
+ case kControlIndicatorPart :
+ nScrollInc = 0 ;
+ scrollEvent = wxEVT_SCROLL_THUMBTRACK;
+ break ;
+ }
+
+ int new_pos = position + nScrollInc;
+
+ if (new_pos < 0)
+ new_pos = 0;
+ 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);
+}
+