+// we will have a mouseDown, then in the native
+// implementation of mouseDown the tracking code
+// is calling clickedAction, therefore we wire this
+// to thumbtrack and only after super mouseDown
+// returns we will call the thumbrelease
+
+void wxOSXScrollBarCocoaImpl::controlAction( WXWidget slf, void *_cmd, void *sender)
+{
+ wxEventType scrollEvent = wxEVT_NULL;
+ switch ([(NSScroller*)m_osxView hitPart])
+ {
+ case NSScrollerIncrementLine:
+ scrollEvent = wxEVT_SCROLL_LINEDOWN;
+ break;
+ case NSScrollerIncrementPage:
+ scrollEvent = wxEVT_SCROLL_PAGEDOWN;
+ break;
+ case NSScrollerDecrementLine:
+ scrollEvent = wxEVT_SCROLL_LINEUP;
+ break;
+ case NSScrollerDecrementPage:
+ scrollEvent = wxEVT_SCROLL_PAGEUP;
+ break;
+ case NSScrollerKnob:
+ case NSScrollerKnobSlot:
+ scrollEvent = wxEVT_SCROLL_THUMBTRACK;
+ break;
+ case NSScrollerNoPart:
+ default:
+ return;
+ }
+
+ wxWindow* wxpeer = (wxWindow*) GetWXPeer();
+ if ( wxpeer )
+ wxpeer->TriggerScrollEvent(scrollEvent);
+}
+
+void wxOSXScrollBarCocoaImpl::mouseEvent(WX_NSEvent event, WXWidget slf, void *_cmd)
+{
+ wxWidgetCocoaImpl::mouseEvent(event, slf, _cmd);
+
+ // send a release event in case we've been tracking the thumb
+ if ( strcmp( sel_getName((SEL) _cmd) , "mouseDown:") == 0 )
+ {
+ NSScrollerPart hit = [(NSScroller*)m_osxView hitPart];
+ if ( (hit == NSScrollerKnob || hit == NSScrollerKnobSlot) )
+ {
+ wxWindow* wxpeer = (wxWindow*) GetWXPeer();
+ if ( wxpeer )
+ wxpeer->OSXHandleClicked(0);
+ }
+ }
+}
+