X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d69225772ad1ff3952a3ee74055dc93f85c13812..7807a2b4998ef075b5ac7c05ab48274c28b477ba:/src/univ/scrolbar.cpp?ds=sidebyside diff --git a/src/univ/scrolbar.cpp b/src/univ/scrolbar.cpp index 93fdb0ba40..c9f56e5c74 100644 --- a/src/univ/scrolbar.cpp +++ b/src/univ/scrolbar.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: univ/scrolbar.cpp +// Name: src/univ/scrolbar.cpp // Purpose: wxScrollBar implementation // Author: Vadim Zeitlin // Modified by: @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "univscrolbar.h" -#endif - #include "wx/wxprec.h" #ifdef __BORLANDC__ @@ -29,12 +25,13 @@ #if wxUSE_SCROLLBAR +#include "wx/scrolbar.h" + #ifndef WX_PRECOMP #include "wx/timer.h" - #include "wx/dcclient.h" - #include "wx/scrolbar.h" #include "wx/validate.h" + #include "wx/log.h" #endif #include "wx/univ/scrtimer.h" @@ -42,7 +39,6 @@ #include "wx/univ/renderer.h" #include "wx/univ/inphand.h" #include "wx/univ/theme.h" -#include "wx/log.h" #define WXDEBUG_SCROLLBAR @@ -554,12 +550,18 @@ bool wxScrollBar::PerformAction(const wxControlAction& action, // NB: we assume that scrollbar events are sequentially numbered // but this should be ok as other code relies on this as well scrollType += wxEVT_SCROLL_TOP - wxEVT_SCROLLWIN_TOP; + wxScrollEvent event(scrollType, this->GetId(), m_thumbPos, + IsVertical() ? wxVERTICAL : wxHORIZONTAL); + event.SetEventObject(this); + GetEventHandler()->ProcessEvent(event); + } + else // part of the window + { + wxScrollWinEvent event(scrollType, m_thumbPos, + IsVertical() ? wxVERTICAL : wxHORIZONTAL); + event.SetEventObject(this); + GetParent()->GetEventHandler()->ProcessEvent(event); } - - wxScrollWinEvent event(scrollType, m_thumbPos, - IsVertical() ? wxVERTICAL : wxHORIZONTAL); - event.SetEventObject(this); - GetParent()->GetEventHandler()->ProcessEvent(event); } return true; @@ -587,6 +589,15 @@ bool wxScrollBar::ScrollPages(int nPages) return true; } +/* static */ +wxInputHandler *wxScrollBar::GetStdInputHandler(wxInputHandler *handlerDef) +{ + static wxStdScrollBarInputHandler + s_handler(wxTheme::Get()->GetRenderer(), handlerDef); + + return &s_handler; +} + // ============================================================================ // scroll bar input handler // ============================================================================ @@ -715,10 +726,8 @@ bool wxStdScrollBarInputHandler::HandleKey(wxInputConsumer *consumer, case WXK_LEFT: action = wxACTION_SCROLL_LINE_UP; break; case WXK_HOME: action = wxACTION_SCROLL_START; break; case WXK_END: action = wxACTION_SCROLL_END; break; - case WXK_PAGEUP: - case WXK_PRIOR: action = wxACTION_SCROLL_PAGE_UP; break; - case WXK_PAGEDOWN: - case WXK_NEXT: action = wxACTION_SCROLL_PAGE_DOWN; break; + case WXK_PAGEUP: action = wxACTION_SCROLL_PAGE_UP; break; + case WXK_PAGEDOWN: action = wxACTION_SCROLL_PAGE_DOWN; break; } if ( !action.IsEmpty() ) @@ -737,7 +746,7 @@ bool wxStdScrollBarInputHandler::HandleMouse(wxInputConsumer *consumer, { // is this a click event from an acceptable button? int btn = event.GetButton(); - if ( (btn != -1) && IsAllowedButton(btn) ) + if ( btn == wxMOUSE_BTN_LEFT ) { // determine which part of the window mouse is in wxScrollBar *scrollbar = wxStaticCast(consumer->GetInputWindow(), wxScrollBar); @@ -907,6 +916,8 @@ bool wxStdScrollBarInputHandler::HandleMouseMove(wxInputConsumer *consumer, #endif // wxUSE_SCROLLBAR +#if wxUSE_TIMER + // ---------------------------------------------------------------------------- // wxScrollTimer // ---------------------------------------------------------------------------- @@ -950,3 +961,4 @@ void wxScrollTimer::Notify() } } +#endif // wxUSE_TIMER