Kaydet (Commit) a71c9607 authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski

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: 's avatarJan-Marek Glogowski <glogow@fbihome.de>
üst 3af6091f
......@@ -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;
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment