X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7fa7e46b265964e2d22ce97e300d5d45cd851da1..3d777efedc1e05bd6c2a7c34a00a65895b62bb13:/src/generic/scrlwing.cpp diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index 81dedd9875..ed7d288d7e 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -5,7 +5,6 @@ // 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 ///////////////////////////////////////////////////////////////////////////// @@ -79,13 +78,9 @@ public: virtual bool ProcessEvent(wxEvent& event); - void ResetDrawnFlag() { m_hasDrawnWindow = false; } - private: wxScrollHelperBase *m_scrollHelper; - bool m_hasDrawnWindow; - wxDECLARE_NO_COPY_CLASS(wxScrollHelperEvtHandler); }; @@ -147,6 +142,7 @@ void wxAutoScrollTimer::Notify() // first scroll the window if we are allowed to do it wxScrollWinEvent event1(m_eventType, m_pos, m_orient); event1.SetEventObject(m_win); + event1.SetId(m_win->GetId()); if ( m_scrollHelper->SendAutoScrollEvents(event1) && m_win->GetEventHandler()->ProcessEvent(event1) ) { @@ -165,7 +161,16 @@ void wxAutoScrollTimer::Notify() event2.SetEventObject(m_win); - // FIXME: we don't fill in the other members - ok? + wxMouseState mouseState = wxGetMouseState(); + + 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(); + event2.m_altDown = mouseState.AltDown(); + event2.m_metaDown = mouseState.MetaDown(); m_win->GetEventHandler()->ProcessEvent(event2); } @@ -185,24 +190,6 @@ bool wxScrollHelperEvtHandler::ProcessEvent(wxEvent& event) { wxEventType evType = event.GetEventType(); - // the explanation of wxEVT_PAINT processing hack: for historic reasons - // there are 2 ways to process this event in classes deriving from - // wxScrolledWindow. The user code may - // - // 1. override wxScrolledWindow::OnDraw(dc) - // 2. define its own OnPaint() handler - // - // In addition, in wxUniversal wxWindow defines OnPaint() itself and - // always processes the draw event, so we can't just try the window - // OnPaint() first and call our HandleOnPaint() if it doesn't process it - // (the latter would never be called in wxUniversal). - // - // So the solution is to have a flag telling us whether the user code drew - // anything in the window. We set it to true here but reset it to false in - // wxScrolledWindow::OnPaint() handler (which wouldn't be called if the - // user code defined OnPaint() in the derived class) - m_hasDrawnWindow = true; - // Pass it on to the real handler: notice that we must not call // ProcessEvent() on this object itself as it wouldn't pass it to the next // handler (i.e. the real window) if we're called from a previous handler @@ -221,22 +208,25 @@ bool wxScrollHelperEvtHandler::ProcessEvent(wxEvent& event) if ( evType == wxEVT_SIZE ) { m_scrollHelper->HandleOnSize((wxSizeEvent &)event); - return true; } - if ( processed ) - { - // normally, nothing more to do here - except if it was a paint event - // which wasn't really processed, then we'll try to call our - // OnDraw() below (from HandleOnPaint) - if ( m_hasDrawnWindow || event.IsCommandEvent() ) - { - return true; - } - } + if ( processed && event.IsCommandEvent()) + return true; - if ( evType == wxEVT_PAINT ) + // For wxEVT_PAINT the user code can either handle this event as usual or + // override virtual OnDraw(), so if the event hasn't been handled we need + // to call this virtual function ourselves. + if ( +#ifndef __WXUNIVERSAL__ + // in wxUniversal "processed" will always be true, because + // all windows use the paint event to draw themselves. + // In this case we can't use this flag to determine if a custom + // paint event handler already drew our window and we just + // call OnDraw() anyway. + !processed && +#endif // !__WXUNIVERSAL__ + evType == wxEVT_PAINT ) { m_scrollHelper->HandleOnPaint((wxPaintEvent &)event); return true; @@ -461,12 +451,6 @@ void wxScrollHelperBase::DeleteEvtHandler() } } -void wxScrollHelperBase::ResetDrawnFlag() -{ - wxCHECK_RET( m_handler, "invalid use of ResetDrawnFlag - no handler?" ); - m_handler->ResetDrawnFlag(); -} - void wxScrollHelperBase::DoSetTargetWindow(wxWindow *target) { m_targetWindow = target; @@ -858,6 +842,7 @@ void wxScrollHelperBase::HandleOnChar(wxKeyEvent& event) newEvent.SetPosition(0); newEvent.SetEventObject(m_win); + newEvent.SetId(m_win->GetId()); // this is the default, it's changed to wxHORIZONTAL below if needed newEvent.SetOrientation(wxVERTICAL); @@ -1032,6 +1017,9 @@ void wxScrollHelperBase::HandleOnMouseWheel(wxMouseEvent& event) 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)