Add wxAnyScrollHelperBase to reduce code duplication in wxVarScrollHelperBase.

This is just a small refactoring to move some trivially common parts of
wxScrollHelperBase and wxVarScrollHelperBase in a new common base class.
This will make it possible to apply other corrections to wxVarScrollHelperBase
without having to physically duplicate the code from wxScrollHelperBase in it.

See #15357.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74813 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-09-15 00:15:07 +00:00
parent e91e1e3d5c
commit 010d821b31
4 changed files with 45 additions and 34 deletions

View File

@@ -310,17 +310,28 @@ bool wxScrollHelperEvtHandler::ProcessEvent(wxEvent& event)
}
// ============================================================================
// wxScrollHelperBase implementation
// wxAnyScrollHelperBase and wxScrollHelperBase implementation
// ============================================================================
// ----------------------------------------------------------------------------
// wxAnyScrollHelperBase
// ----------------------------------------------------------------------------
wxAnyScrollHelperBase::wxAnyScrollHelperBase(wxWindow* win)
{
wxASSERT_MSG( win, wxT("associated window can't be NULL in wxScrollHelper") );
m_win = win;
m_targetWindow = NULL;
}
// ----------------------------------------------------------------------------
// wxScrollHelperBase construction
// ----------------------------------------------------------------------------
wxScrollHelperBase::wxScrollHelperBase(wxWindow *win)
: wxAnyScrollHelperBase(win)
{
wxASSERT_MSG( win, wxT("associated window can't be NULL in wxScrollHelper") );
m_xScrollPixelsPerLine =
m_yScrollPixelsPerLine =
m_xScrollPosition =
@@ -341,15 +352,10 @@ wxScrollHelperBase::wxScrollHelperBase(wxWindow *win)
m_wheelRotation = 0;
#endif
m_win =
m_targetWindow = NULL;
m_timerAutoScroll = NULL;
m_handler = NULL;
m_win = win;
m_win->SetScrollHelper(static_cast<wxScrollHelper *>(this));
// by default, the associated window is also the target window
@@ -481,11 +487,6 @@ void wxScrollHelperBase::SetTargetWindow(wxWindow *target)
DoSetTargetWindow(target);
}
wxWindow *wxScrollHelperBase::GetTargetWindow() const
{
return m_targetWindow;
}
// ----------------------------------------------------------------------------
// scrolling implementation itself
// ----------------------------------------------------------------------------