diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-08-13 16:44:15 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-08-16 20:09:43 +0200 |
commit | 4639ca2f878b04ffc50d9c20d92e90464d2d67a7 (patch) | |
tree | ab13b23467e4a8b4902f58632300a2756c113fb7 /include/tools/gen.hxx | |
parent | 766b95d58299a1f2eb0d05d67e3afbf95bd9334d (diff) |
Rename setX/setY to SetPosX/SetPosY, to align with SetPos
Change-Id: I856194f26fefad993f416d7b92b57a9417a3c0a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120546
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include/tools/gen.hxx')
-rw-r--r-- | include/tools/gen.hxx | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx index 1cd3928ab67e..5e083e2bffc6 100644 --- a/include/tools/gen.hxx +++ b/include/tools/gen.hxx @@ -501,6 +501,10 @@ public: tools::Long AdjustRight( tools::Long nHorzMoveDelta ); tools::Long AdjustTop( tools::Long nVertMoveDelta ) { nTop += nVertMoveDelta; return nTop; } tools::Long AdjustBottom( tools::Long nVertMoveDelta ); + /// Set the left edge of the rectangle to x, preserving the width + inline void SetPosX(tools::Long x); + /// Set the top edge of the rectangle to y, preserving the height + inline void SetPosY(tools::Long y); inline void SetPos( const Point& rPoint ); void SetSize( const Size& rSize ); @@ -572,10 +576,6 @@ public: tools::Long getWidth() const { return Right() - Left(); } /// Returns the difference between bottom and top, assuming the range includes one end, but not the other. tools::Long getHeight() const { return Bottom() - Top(); } - /// Set the left edge of the rectangle to x, preserving the width - void setX( tools::Long x ); - /// Set the top edge of the rectangle to y, preserving the height - void setY( tools::Long y ); void setWidth( tools::Long n ) { nRight = nLeft + n; } void setHeight( tools::Long n ) { nBottom = nTop + n; } /// Returns the string representation of the rectangle, format is "x, y, width, height". @@ -636,14 +636,24 @@ inline void tools::Rectangle::Move( tools::Long nHorzMove, tools::Long nVertMove nBottom += nVertMove; } -inline void tools::Rectangle::SetPos( const Point& rPoint ) +inline void tools::Rectangle::SetPosX(tools::Long x) { if (!IsWidthEmpty()) - nRight += rPoint.X() - nLeft; + nRight += x - nLeft; + nLeft = x; +} + +inline void tools::Rectangle::SetPosY(tools::Long y) +{ if (!IsHeightEmpty()) - nBottom += rPoint.Y() - nTop; - nLeft = rPoint.X(); - nTop = rPoint.Y(); + nBottom += y - nTop; + nTop = y; +} + +inline void tools::Rectangle::SetPos( const Point& rPoint ) +{ + SetPosX(rPoint.X()); + SetPosY(rPoint.Y()); } inline tools::Rectangle tools::Rectangle::GetUnion( const tools::Rectangle& rRect ) const |