X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a3870b2ff595ba4bb4f0397ace77ceeb9628e94d..a006e78bd388dfb86f8b34ede2034047c062cffb:/src/univ/slider.cpp diff --git a/src/univ/slider.cpp b/src/univ/slider.cpp index 9bffd276ac..8381f531a6 100644 --- a/src/univ/slider.cpp +++ b/src/univ/slider.cpp @@ -787,14 +787,15 @@ bool wxSlider::PerformAction(const wxControlAction& action, wxScrollThumb::Shaft wxSlider::HitTest(const wxPoint& pt) const { wxRect rectShaft = GetShaftRect(); - if ( !rectShaft.Inside(pt) ) + wxRect rectThumb; + CalcThumbRect(&rectShaft, &rectThumb, NULL); + + // check for possible shaft or thumb hit + if (!rectShaft.Inside(pt) && !rectThumb.Inside(pt)) { return wxScrollThumb::Shaft_None; } - // inside the shaft, where is it relatively to the thumb? - wxRect rectThumb; - CalcThumbRect(&rectShaft, &rectThumb, NULL); // the position to test and the start and end of the thumb wxCoord x, x1, x2; @@ -916,7 +917,7 @@ bool wxSlider::OnPageScroll(int pageInc) // wxStdSliderButtonInputHandler // ---------------------------------------------------------------------------- -bool wxStdSliderButtonInputHandler::HandleKey(wxControl *control, +bool wxStdSliderButtonInputHandler::HandleKey(wxInputConsumer *consumer, const wxKeyEvent& event, bool pressed) { @@ -946,29 +947,31 @@ bool wxStdSliderButtonInputHandler::HandleKey(wxControl *control, break; case WXK_PRIOR: + case WXK_PAGEUP: action = wxACTION_SLIDER_PAGE_UP; break; case WXK_NEXT: + case WXK_PAGEDOWN: action = wxACTION_SLIDER_PAGE_DOWN; break; } if ( !!action ) { - control->PerformAction(action); + consumer->PerformAction(action); return TRUE; } } - return wxStdInputHandler::HandleKey(control, event, pressed); + return wxStdInputHandler::HandleKey(consumer, event, pressed); } -bool wxStdSliderButtonInputHandler::HandleMouse(wxControl *control, +bool wxStdSliderButtonInputHandler::HandleMouse(wxInputConsumer *consumer, const wxMouseEvent& event) { - wxSlider *slider = wxStaticCast(control, wxSlider); + wxSlider *slider = wxStaticCast(consumer->GetInputWindow(), wxSlider); if ( slider->GetThumb().HandleMouse(event) ) { @@ -976,13 +979,13 @@ bool wxStdSliderButtonInputHandler::HandleMouse(wxControl *control, return FALSE; } - return wxStdInputHandler::HandleMouse(control, event); + return wxStdInputHandler::HandleMouse(consumer, event); } -bool wxStdSliderButtonInputHandler::HandleMouseMove(wxControl *control, +bool wxStdSliderButtonInputHandler::HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event) { - wxSlider *slider = wxStaticCast(control, wxSlider); + wxSlider *slider = wxStaticCast(consumer->GetInputWindow(), wxSlider); if ( slider->GetThumb().HandleMouseMove(event) ) { @@ -990,10 +993,10 @@ bool wxStdSliderButtonInputHandler::HandleMouseMove(wxControl *control, return FALSE; } - return wxStdInputHandler::HandleMouseMove(control, event); + return wxStdInputHandler::HandleMouseMove(consumer, event); } -bool wxStdSliderButtonInputHandler::HandleFocus(wxControl *control, +bool wxStdSliderButtonInputHandler::HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event) { // slider's appearance changes when it gets/loses focus