X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e6feb95a79834836e88143b15d9f424ebe79621..64ea838d8f4d1853b7d850db93ee565e901d099a:/src/univ/scrthumb.cpp?ds=sidebyside diff --git a/src/univ/scrthumb.cpp b/src/univ/scrthumb.cpp index 0aa837dc2f..b5c49719aa 100644 --- a/src/univ/scrthumb.cpp +++ b/src/univ/scrthumb.cpp @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: univ/scrthumb.cpp +// Name: src/univ/scrthumb.cpp // Purpose: wxScrollThumb and related classes // Author: Vadim Zeitlin // Modified by: // Created: 13.02.01 // RCS-ID: $Id$ -// Copyright: (c) 2001 Vadim Zeitlin -// Licence: wxWindows license +// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ - #pragma implementation "univscrthumb.h" -#endif - #include "wx/wxprec.h" #ifdef __BORLANDC__ @@ -31,6 +27,7 @@ #include "wx/window.h" #endif // WX_PRECOMP +#include "wx/renderer.h" #include "wx/univ/scrtimer.h" #include "wx/univ/scrthumb.h" @@ -62,7 +59,9 @@ struct WXDLLEXPORT wxScrollThumbCaptureData m_window->ReleaseMouse(); } +#if wxUSE_TIMER delete m_timerScroll; +#endif // wxUSE_TIMER } // the thumb part being held pressed @@ -86,6 +85,8 @@ struct WXDLLEXPORT wxScrollThumbCaptureData // wxScrollTimer: the timer used when the arrow is kept pressed // ---------------------------------------------------------------------------- +#if wxUSE_TIMER + class wxScrollThumbTimer : public wxScrollTimer { public: @@ -100,7 +101,7 @@ public: break; default: - wxFAIL_MSG(_T("unexpected shaft part in wxScrollThumbTimer")); + wxFAIL_MSG(wxT("unexpected shaft part in wxScrollThumbTimer")); // fall through case wxScrollThumb::Shaft_Below: @@ -123,6 +124,8 @@ protected: int m_inc; }; +#endif // wxUSE_TIMER + // ============================================================================ // implementation // ============================================================================ @@ -141,7 +144,7 @@ wxScrollThumb::wxScrollThumb(wxControlWithThumb *control) wxScrollThumb::~wxScrollThumb() { // it should have been destroyed - wxASSERT_MSG( !m_captureData, _T("memory leak in wxScrollThumb") ); + wxASSERT_MSG( !m_captureData, wxT("memory leak in wxScrollThumb") ); } // ---------------------------------------------------------------------------- @@ -155,7 +158,7 @@ bool wxScrollThumb::HandleMouse(const wxMouseEvent& event) const if ( btn == -1 ) { // no... - return FALSE; + return false; } // when the mouse is pressed on any scrollbar element, we capture it @@ -165,7 +168,7 @@ bool wxScrollThumb::HandleMouse(const wxMouseEvent& event) const if ( HasCapture() ) { // mouse already captured, nothing to do - return FALSE; + return false; } // determine which part of the window the user clicked in @@ -174,7 +177,7 @@ bool wxScrollThumb::HandleMouse(const wxMouseEvent& event) const if ( shaftPart == Shaft_None ) { // mouse pressed over something else - return FALSE; + return false; } // capture the mouse @@ -195,6 +198,7 @@ bool wxScrollThumb::HandleMouse(const wxMouseEvent& event) const // generate an additional event if we start dragging the thumb m_control->OnThumbDragStart(GetThumbPos(event)); } +#if wxUSE_TIMER else // not the thumb { // start timer for auto scrolling when the user presses the mouse @@ -202,6 +206,7 @@ bool wxScrollThumb::HandleMouse(const wxMouseEvent& event) const m_captureData->m_timerScroll = new wxScrollThumbTimer(m_control, shaftPart); } +#endif // wxUSE_TIMER } // release mouse if the *same* button went up else if ( HasCapture() && (btn == m_captureData->m_btnCapture) ) @@ -218,15 +223,15 @@ bool wxScrollThumb::HandleMouse(const wxMouseEvent& event) const delete m_captureData; wxConstCast(this, wxScrollThumb)->m_captureData = NULL; - m_control->SetShaftPartState(shaftPart, wxCONTROL_PRESSED, FALSE); + m_control->SetShaftPartState(shaftPart, wxCONTROL_PRESSED, false); } else // another mouse button released { // we don't process this - return FALSE; + return false; } - return TRUE; + return true; } bool wxScrollThumb::HandleMouseMove(const wxMouseEvent& event) const @@ -241,7 +246,7 @@ bool wxScrollThumb::HandleMouseMove(const wxMouseEvent& event) const } // we process all mouse events while the mouse is captured by us - return TRUE; + return true; } else // no capture { @@ -259,9 +264,9 @@ bool wxScrollThumb::HandleMouseMove(const wxMouseEvent& event) const if ( shaftPart != m_shaftPart ) { // update the highlighted state - m_control->SetShaftPartState(m_shaftPart, wxCONTROL_CURRENT, FALSE); + m_control->SetShaftPartState(m_shaftPart, wxCONTROL_CURRENT, false); wxConstCast(this, wxScrollThumb)->m_shaftPart = shaftPart; - m_control->SetShaftPartState(m_shaftPart, wxCONTROL_CURRENT, TRUE); + m_control->SetShaftPartState(m_shaftPart, wxCONTROL_CURRENT, true); } // if the event happened on the shaft, it was for us and we processed @@ -279,7 +284,7 @@ wxCoord wxScrollThumb::GetMouseCoord(const wxMouseEvent& event) const int wxScrollThumb::GetThumbPos(const wxMouseEvent& event) const { wxCHECK_MSG( m_captureData && m_captureData->m_shaftPart == Shaft_Thumb, 0, - _T("can't be called when thumb is not dragged") ); + wxT("can't be called when thumb is not dragged") ); int x = GetMouseCoord(event) - m_captureData->m_ofsMouse; return m_control->PixelToThumbPos(x);