Improvements for building minimal builds and new ports: wxUSE_* usage and minor cleaning.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39633 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -45,7 +45,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 +55,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 +69,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 +103,8 @@ protected:
|
||||
wxScrollArrows::Arrow m_arrow;
|
||||
};
|
||||
|
||||
#endif // wxUSE_TIMER
|
||||
|
||||
// ============================================================================
|
||||
// implementation of wxScrollArrows
|
||||
// ============================================================================
|
||||
@@ -166,6 +176,7 @@ bool wxScrollArrows::HandleMouseMove(const wxMouseEvent& event) const
|
||||
arrow = m_control->HitTest(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 +210,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
|
||||
@@ -242,22 +254,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
|
||||
|
Reference in New Issue
Block a user