diff options
-rw-r--r-- | include/vcl/scrbar.hxx | 1 | ||||
-rw-r--r-- | vcl/source/control/scrbar.cxx | 58 |
2 files changed, 25 insertions, 34 deletions
diff --git a/include/vcl/scrbar.hxx b/include/vcl/scrbar.hxx index bef8f7170fc8..110ef9f9aff2 100644 --- a/include/vcl/scrbar.hxx +++ b/include/vcl/scrbar.hxx @@ -46,6 +46,7 @@ private: Rectangle maPage1Rect; Rectangle maPage2Rect; Rectangle maThumbRect; + Rectangle maTrackRect; ImplScrollBarData* mpData; long mnStartPos; long mnMouseOff; diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index 33ede81f7725..85207710d4b6 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -68,7 +68,6 @@ struct ImplScrollBarData { AutoTimer maTimer; // Timer bool mbHide; - Rectangle maTrackRect; // TODO: move to ScrollBar class when binary incompatibility of ScrollBar class is no longer problematic }; void ScrollBar::ImplInit( vcl::Window* pParent, WinBits nStyle ) @@ -90,14 +89,6 @@ void ScrollBar::ImplInit( vcl::Window* pParent, WinBits nStyle ) mbCalcSize = true; mbFullDrag = false; - if( !mpData ) // TODO: remove when maTrackRect is no longer in mpData - { - mpData = new ImplScrollBarData; - mpData->maTimer.SetInvokeHandler( LINK( this, ScrollBar, ImplAutoTimerHdl ) ); - mpData->maTimer.SetDebugName( "vcl::ScrollBar mpData->maTimer" ); - mpData->mbHide = false; - } - ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, nullptr ); @@ -135,12 +126,11 @@ void ScrollBar::ImplUpdateRects( bool bUpdate ) mnStateFlags &= ~SCRBAR_STATE_BTN1_DISABLE; mnStateFlags &= ~SCRBAR_STATE_BTN2_DISABLE; - Rectangle& aTrackRect = mpData->maTrackRect; // TODO: remove when maTrackRect is no longer in mpData if ( mnThumbPixRange ) { if ( GetStyle() & WB_HORZ ) { - maThumbRect.Left() = aTrackRect.Left()+mnThumbPixPos; + maThumbRect.Left() = maTrackRect.Left()+mnThumbPixPos; maThumbRect.Right() = maThumbRect.Left()+mnThumbPixSize-1; if ( !mnThumbPixPos ) maPage1Rect.Right() = RECT_EMPTY; @@ -151,12 +141,12 @@ void ScrollBar::ImplUpdateRects( bool bUpdate ) else { maPage2Rect.Left() = maThumbRect.Right()+1; - maPage2Rect.Right() = aTrackRect.Right(); + maPage2Rect.Right() = maTrackRect.Right(); } } else { - maThumbRect.Top() = aTrackRect.Top()+mnThumbPixPos; + maThumbRect.Top() = maTrackRect.Top()+mnThumbPixPos; maThumbRect.Bottom() = maThumbRect.Top()+mnThumbPixSize-1; if ( !mnThumbPixPos ) maPage1Rect.Bottom() = RECT_EMPTY; @@ -167,7 +157,7 @@ void ScrollBar::ImplUpdateRects( bool bUpdate ) else { maPage2Rect.Top() = maThumbRect.Bottom()+1; - maPage2Rect.Bottom() = aTrackRect.Bottom(); + maPage2Rect.Bottom() = maTrackRect.Bottom(); } } } @@ -175,24 +165,24 @@ void ScrollBar::ImplUpdateRects( bool bUpdate ) { if ( GetStyle() & WB_HORZ ) { - const long nSpace = aTrackRect.Right() - aTrackRect.Left(); + const long nSpace = maTrackRect.Right() - maTrackRect.Left(); if ( nSpace > 0 ) { - maPage1Rect.Left() = aTrackRect.Left(); - maPage1Rect.Right() = aTrackRect.Left() + (nSpace/2); + maPage1Rect.Left() = maTrackRect.Left(); + maPage1Rect.Right() = maTrackRect.Left() + (nSpace/2); maPage2Rect.Left() = maPage1Rect.Right() + 1; - maPage2Rect.Right() = aTrackRect.Right(); + maPage2Rect.Right() = maTrackRect.Right(); } } else { - const long nSpace = aTrackRect.Bottom() - aTrackRect.Top(); + const long nSpace = maTrackRect.Bottom() - maTrackRect.Top(); if ( nSpace > 0 ) { - maPage1Rect.Top() = aTrackRect.Top(); - maPage1Rect.Bottom() = aTrackRect.Top() + (nSpace/2); + maPage1Rect.Top() = maTrackRect.Top(); + maPage1Rect.Bottom() = maTrackRect.Top() + (nSpace/2); maPage2Rect.Top() = maPage1Rect.Bottom() + 1; - maPage2Rect.Bottom() = aTrackRect.Bottom(); + maPage2Rect.Bottom() = maTrackRect.Bottom(); } } } @@ -247,7 +237,6 @@ void ScrollBar::ImplCalc( bool bUpdate ) const Size aSize = GetOutputSizePixel(); const long nMinThumbSize = GetSettings().GetStyleSettings().GetMinThumbSize(); - Rectangle& aTrackRect = mpData->maTrackRect; // TODO: remove when maTrackRect is no longer in mpData if ( mbCalcSize ) { Size aOldSize = getCurrentCalcSize(); @@ -276,18 +265,18 @@ void ScrollBar::ImplCalc( bool bUpdate ) if ( GetNativeControlRegion( ControlType::Scrollbar, ControlPart::TrackHorzArea, aControlRegion, ControlState::NONE, ImplControlValue(), OUString(), aBoundingRegion, aTrackRegion ) ) - aTrackRect = aTrackRegion; + maTrackRect = aTrackRegion; else - aTrackRect = Rectangle( maBtn1Rect.TopRight(), maBtn2Rect.BottomLeft() ); + maTrackRect = Rectangle( maBtn1Rect.TopRight(), maBtn2Rect.BottomLeft() ); // Check if available space is big enough for thumb ( min thumb size = ScrBar width/height ) - mnThumbPixRange = aTrackRect.Right() - aTrackRect.Left(); + mnThumbPixRange = maTrackRect.Right() - maTrackRect.Left(); if( mnThumbPixRange > 0 ) { - maPage1Rect.Left() = aTrackRect.Left(); + maPage1Rect.Left() = maTrackRect.Left(); maPage1Rect.Bottom() = maPage2Rect.Bottom() = - maThumbRect.Bottom() = aTrackRect.Bottom(); + maThumbRect.Bottom() = maTrackRect.Bottom(); } else { @@ -317,18 +306,18 @@ void ScrollBar::ImplCalc( bool bUpdate ) if ( GetNativeControlRegion( ControlType::Scrollbar, ControlPart::TrackVertArea, aControlRegion, ControlState::NONE, ImplControlValue(), OUString(), aBoundingRegion, aTrackRegion ) ) - aTrackRect = aTrackRegion; + maTrackRect = aTrackRegion; else - aTrackRect = Rectangle( maBtn1Rect.BottomLeft()+Point(0,1), maBtn2Rect.TopRight() ); + maTrackRect = Rectangle( maBtn1Rect.BottomLeft()+Point(0,1), maBtn2Rect.TopRight() ); // Check if available space is big enough for thumb - mnThumbPixRange = aTrackRect.Bottom() - aTrackRect.Top(); + mnThumbPixRange = maTrackRect.Bottom() - maTrackRect.Top(); if( mnThumbPixRange > 0 ) { - maPage1Rect.Top() = aTrackRect.Top(); + maPage1Rect.Top() = maTrackRect.Top(); maPage1Rect.Right() = maPage2Rect.Right() = - maThumbRect.Right() = aTrackRect.Right(); + maThumbRect.Right() = maTrackRect.Right(); } else { @@ -422,7 +411,7 @@ void ScrollBar::Draw( OutputDevice* pDev, const Point& rPos, const Size& /* rSiz maBtn1Rect+=aPos; maBtn2Rect+=aPos; maThumbRect+=aPos; - mpData->maTrackRect+=aPos; // TODO: update when maTrackRect is no longer in mpData + maTrackRect+=aPos; maPage1Rect+=aPos; maPage2Rect+=aPos; @@ -1157,6 +1146,7 @@ void ScrollBar::GetFocus() { mpData = new ImplScrollBarData; mpData->maTimer.SetInvokeHandler( LINK( this, ScrollBar, ImplAutoTimerHdl ) ); + mpData->maTimer.SetDebugName( "vcl::ScrollBar mpData->maTimer" ); mpData->mbHide = false; } ImplInvert(); // react immediately |