+ HandleWindowEvent(event);
+}
+
+static inline wxEventType wxSliderEventTypeForKeyFromEvent(NSEvent *theEvent)
+{
+ NSString *theEventCharacters = [theEvent charactersIgnoringModifiers];
+
+ if ([theEventCharacters length] == 1)
+ {
+ switch ([theEventCharacters characterAtIndex:0])
+ {
+ case NSUpArrowFunctionKey:
+ case NSRightArrowFunctionKey: return wxEVT_SCROLL_PAGEDOWN;
+ case NSDownArrowFunctionKey:
+ case NSLeftArrowFunctionKey: return wxEVT_SCROLL_PAGEUP;
+ case NSPageUpFunctionKey: return wxEVT_SCROLL_BOTTOM;
+ case NSPageDownFunctionKey: return wxEVT_SCROLL_TOP;
+ }
+ }
+ // Overload wxEVT_ANY to mean we can't determine the event type.
+ return wxEVT_ANY;
+}
+
+void wxSlider::CocoaTarget_action()
+{
+ wxEventType sliderEventType;
+ SEL theSelector = wxCocoaNSSlider::GetLastResponderSelector();
+
+ if( theSelector == @selector(moveUp:)
+ || theSelector == @selector(moveRight:))
+ sliderEventType = wxEVT_SCROLL_PAGEDOWN;
+ else if( theSelector == @selector(moveDown:)
+ || theSelector == @selector(moveLeft:))
+ sliderEventType = wxEVT_SCROLL_PAGEUP;
+ else if( theSelector == @selector(pageUp:))
+ sliderEventType = wxEVT_SCROLL_BOTTOM;
+ else if( theSelector == @selector(pageDown:))
+ sliderEventType = wxEVT_SCROLL_TOP;
+ else if( theSelector == @selector(keyDown:))
+ // This case should ideally never be reached.
+ sliderEventType = wxSliderEventTypeForKeyFromEvent([[GetNSSlider() window] currentEvent]);
+ else
+ // Don't generate an event.
+ return;
+ if(sliderEventType != wxEVT_ANY)
+ ProcessEventType(sliderEventType);