summaryrefslogtreecommitdiff
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
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>
-rw-r--r--include/vcl/scrbar.hxx1
-rw-r--r--vcl/source/control/scrbar.cxx27
2 files changed, 16 insertions, 12 deletions
diff --git a/include/vcl/scrbar.hxx b/include/vcl/scrbar.hxx
index 8a2fffac0321..fb08f37405b6 100644
--- a/include/vcl/scrbar.hxx
+++ b/include/vcl/scrbar.hxx
@@ -94,6 +94,7 @@ public:
virtual void KeyInput(const KeyEvent& rKEvt) override;
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
virtual void Draw(OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags) override;
+ virtual void Move() override;
virtual void Resize() override;
virtual void StateChanged(StateChangedType nType) override;
virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
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();