X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8907154c1a8a6882c6797d1f16393ddfb23e7f3a..86ad5903b94d00e7c7625a705f6cd22301607ccd:/src/univ/scrarrow.cpp diff --git a/src/univ/scrarrow.cpp b/src/univ/scrarrow.cpp index 4a47d3fb00..988ecbc957 100644 --- a/src/univ/scrarrow.cpp +++ b/src/univ/scrarrow.cpp @@ -24,6 +24,7 @@ #endif #ifndef WX_PRECOMP + #include "wx/window.h" #endif #include "wx/univ/scrtimer.h" @@ -45,7 +46,9 @@ struct wxScrollArrowCaptureData m_arrowPressed = wxScrollArrows::Arrow_None; m_window = NULL; m_btnCapture = -1; +#if wxUSE_TIMER m_timerScroll = NULL; +#endif // wxUSE_TIMER } ~wxScrollArrowCaptureData() @@ -53,7 +56,9 @@ struct wxScrollArrowCaptureData if ( m_window ) m_window->ReleaseMouse(); +#if wxUSE_TIMER delete m_timerScroll; +#endif // wxUSE_TIMER } // the arrow being held pressed (may be Arrow_None) @@ -65,14 +70,18 @@ struct wxScrollArrowCaptureData // the window which has captured the mouse wxWindow *m_window; +#if wxUSE_TIMER // the timer for generating the scroll events wxScrollTimer *m_timerScroll; +#endif }; // ---------------------------------------------------------------------------- // wxScrollArrowTimer: a wxScrollTimer which calls OnArrow() // ---------------------------------------------------------------------------- +#if wxUSE_TIMER + class wxScrollArrowTimer : public wxScrollTimer { public: @@ -95,6 +104,8 @@ protected: wxScrollArrows::Arrow m_arrow; }; +#endif // wxUSE_TIMER + // ============================================================================ // implementation of wxScrollArrows // ============================================================================ @@ -112,7 +123,7 @@ wxScrollArrows::wxScrollArrows(wxControlWithArrows *control) wxScrollArrows::~wxScrollArrows() { // it should have been destroyed - wxASSERT_MSG( !m_captureData, _T("memory leak in wxScrollArrows") ); + wxASSERT_MSG( !m_captureData, wxT("memory leak in wxScrollArrows") ); } // ---------------------------------------------------------------------------- @@ -163,9 +174,10 @@ bool wxScrollArrows::HandleMouseMove(const wxMouseEvent& event) const } else // Moving() or Entering(), treat them the same here { - arrow = m_control->HitTest(event.GetPosition()); + arrow = m_control->HitTestArrow(event.GetPosition()); } +#if wxUSE_TIMER if ( m_captureData && m_captureData->m_timerScroll) { // the mouse is captured, we may want to pause scrolling if it goes @@ -199,6 +211,7 @@ bool wxScrollArrows::HandleMouseMove(const wxMouseEvent& event) const return false; } +#endif // wxUSE_TIMER // reset the wxCONTROL_CURRENT flag for the arrows which don't have the // mouse and set it for the one which has @@ -222,7 +235,7 @@ bool wxScrollArrows::HandleMouse(const wxMouseEvent& event) const { if ( !m_captureData ) { - Arrow arrow = m_control->HitTest(event.GetPosition()); + Arrow arrow = m_control->HitTestArrow(event.GetPosition()); if ( arrow == Arrow_None ) { // mouse pressed over something else @@ -242,22 +255,28 @@ bool wxScrollArrows::HandleMouse(const wxMouseEvent& event) const m_captureData->m_window = m_control->GetWindow(); m_captureData->m_window->CaptureMouse(); - // start scrolling +#if wxUSE_TIMER + // start scrolling wxScrollArrowTimer *tmpTimerScroll = new wxScrollArrowTimer(m_control, arrow); +#endif // wxUSE_TIMER - // Because in some cases wxScrollArrowTimer can cause - // m_captureData to be destructed we need to test if it + // Because in some cases wxScrollArrowTimer can cause + // m_captureData to be destructed we need to test if it // is still valid before using. if (m_captureData) { +#if wxUSE_TIMER m_captureData->m_timerScroll = tmpTimerScroll; +#endif // wxUSE_TIMER m_control->SetArrowFlag(arrow, wxCONTROL_PRESSED, true); } else { +#if wxUSE_TIMER delete tmpTimerScroll; +#endif // wxUSE_TIMER } } //else: mouse already captured, nothing to do @@ -280,4 +299,3 @@ bool wxScrollArrows::HandleMouse(const wxMouseEvent& event) const return true; } -