summaryrefslogtreecommitdiff
path: root/vcl/source/control/scrbar.cxx
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2019-05-22 15:57:48 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2019-05-23 06:47:43 +0200
commita71c960754152fb7e8094cdf6190783e609c2b58 (patch)
tree2ac4db24554f454c512f7acb64d7b833ed443580 /vcl/source/control/scrbar.cxx
parent3af6091f45d93508ab746c13e208d9516c009222 (diff)
Fix moving / orientation-changing ScrollBar
Just implements Move the same way then Resize. More importantly the patch correctly resets the Thumb and Page rectangles to position (0,0) instead of just Empty, which ImplCalc is based on. Otherwise this results in broken scroll bars, when the StarMath elements window is docked in in the bottom or top area and switches the scrolling orientation on undock. Change-Id: I32b0507cdd6551cc7f42655a730faf8ef25b747b Reviewed-on: https://gerrit.libreoffice.org/72794 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/source/control/scrbar.cxx')
-rw-r--r--vcl/source/control/scrbar.cxx27
1 files changed, 15 insertions, 12 deletions
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 8c12b9f5ec2d..19db246006b7 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -243,6 +243,11 @@ void ScrollBar::ImplCalc( bool bUpdate )
const tools::Rectangle aControlRegion( Point(0,0), aSize );
tools::Rectangle aBtn1Region, aBtn2Region, aTrackRegion, aBoundingRegion;
+ // reset rectangles to empty *and* (0,0) position
+ maThumbRect = tools::Rectangle();
+ maPage1Rect = tools::Rectangle();
+ maPage2Rect = tools::Rectangle();
+
if ( GetStyle() & WB_HORZ )
{
if ( GetNativeControlRegion( ControlType::Scrollbar, IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft,
@@ -278,13 +283,9 @@ void ScrollBar::ImplCalc( bool bUpdate )
maThumbRect.SetBottom( maTrackRect.Bottom() );
}
else
- {
mnThumbPixRange = 0;
- maPage1Rect.SetEmpty();
- maPage2Rect.SetEmpty();
- }
}
- else
+ else // WB_VERT
{
if ( GetNativeControlRegion( ControlType::Scrollbar, ControlPart::ButtonUp,
aControlRegion, ControlState::NONE, ImplControlValue(), aBoundingRegion, aBtn1Region ) &&
@@ -319,16 +320,9 @@ void ScrollBar::ImplCalc( bool bUpdate )
maThumbRect.SetRight( maTrackRect.Right() );
}
else
- {
mnThumbPixRange = 0;
- maPage1Rect.SetEmpty();
- maPage2Rect.SetEmpty();
- }
}
- if ( !mnThumbPixRange )
- maThumbRect.SetEmpty();
-
mbCalcSize = false;
Size aNewSize = getCurrentCalcSize();
@@ -1092,6 +1086,15 @@ void ScrollBar::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle
ImplDraw(rRenderContext);
}
+void ScrollBar::Move()
+{
+ Control::Move();
+ mbCalcSize = true;
+ if (IsReallyVisible())
+ ImplCalc(false);
+ Invalidate();
+}
+
void ScrollBar::Resize()
{
Control::Resize();