// Modified by: Vadim Zeitlin on 31.08.00: wxScrollHelper allows to implement.
// Ron Lee on 10.4.02: virtual size / auto scrollbars et al.
// Created: 01/02/97
-// RCS-ID: $Id$
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
wxMouseState mouseState = wxGetMouseState();
- event2.m_leftDown = mouseState.LeftDown();
- event2.m_middleDown = mouseState.MiddleDown();
- event2.m_rightDown = mouseState.RightDown();
+ event2.m_leftDown = mouseState.LeftIsDown();
+ event2.m_middleDown = mouseState.MiddleIsDown();
+ event2.m_rightDown = mouseState.RightIsDown();
event2.m_shiftDown = mouseState.ShiftDown();
event2.m_controlDown = mouseState.ControlDown();
// wxScrollHelperEvtHandler
// ----------------------------------------------------------------------------
+// Notice that this method is currently duplicated in the method with the same
+// name in wxVarScrollHelperEvtHandler class, until this is fixed, the other
+// copy of the method needs to be modified every time this version is.
bool wxScrollHelperEvtHandler::ProcessEvent(wxEvent& event)
{
wxEventType evType = event.GetEventType();
}
// ============================================================================
-// wxScrollHelperBase implementation
+// wxAnyScrollHelperBase and wxScrollHelperBase implementation
// ============================================================================
// ----------------------------------------------------------------------------
-// wxScrollHelperBase construction
+// wxAnyScrollHelperBase
// ----------------------------------------------------------------------------
-wxScrollHelperBase::wxScrollHelperBase(wxWindow *win)
+wxAnyScrollHelperBase::wxAnyScrollHelperBase(wxWindow* win)
{
wxASSERT_MSG( win, wxT("associated window can't be NULL in wxScrollHelper") );
+ m_win = win;
+ m_targetWindow = NULL;
+
+ m_kbdScrollingEnabled = true;
+}
+
+// ----------------------------------------------------------------------------
+// wxScrollHelperBase construction
+// ----------------------------------------------------------------------------
+
+wxScrollHelperBase::wxScrollHelperBase(wxWindow *win)
+ : wxAnyScrollHelperBase(win)
+{
m_xScrollPixelsPerLine =
m_yScrollPixelsPerLine =
m_xScrollPosition =
m_xScrollingEnabled =
m_yScrollingEnabled = true;
- m_kbdScrollingEnabled = true;
-
m_scaleX =
m_scaleY = 1.0;
#if wxUSE_MOUSEWHEEL
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
DoSetTargetWindow(target);
}
-wxWindow *wxScrollHelperBase::GetTargetWindow() const
-{
- return m_targetWindow;
-}
-
// ----------------------------------------------------------------------------
// scrolling implementation itself
// ----------------------------------------------------------------------------
// This calls OnDraw, having adjusted the origin according to the current
// scroll position
-void wxScrollHelperBase::HandleOnPaint(wxPaintEvent& WXUNUSED(event))
+void wxAnyScrollHelperBase::HandleOnPaint(wxPaintEvent& WXUNUSED(event))
{
// don't use m_targetWindow here, this is always called for ourselves
wxPaintDC dc(m_win);
// compatibility here - if we used OnKeyDown(), the programs which process
// arrows themselves in their OnChar() would never get the message and like
// this they always have the priority
-void wxScrollHelperBase::HandleOnChar(wxKeyEvent& event)
+void wxAnyScrollHelperBase::HandleOnChar(wxKeyEvent& event)
{
if ( !m_kbdScrollingEnabled )
{
newEvent.SetOrientation( event.GetWheelAxis() == 0 ? wxVERTICAL : wxHORIZONTAL);
newEvent.SetEventObject(m_win);
+ if ( event.GetWheelAxis() == wxMOUSE_WHEEL_HORIZONTAL )
+ lines = -lines;
+
if (event.IsPageScroll())
{
if (lines > 0)
m_yVisibility = wxSHOW_SB_DEFAULT;
}
+bool wxScrollHelper::IsScrollbarShown(int orient) const
+{
+ wxScrollbarVisibility visibility = orient == wxHORIZONTAL ? m_xVisibility
+ : m_yVisibility;
+
+ return visibility != wxSHOW_SB_NEVER;
+}
+
void wxScrollHelper::DoShowScrollbars(wxScrollbarVisibility horz,
wxScrollbarVisibility vert)
{