diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2022-06-02 22:42:20 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2022-06-08 18:17:17 +0200 |
commit | ea5a0918c8c32309821ab239c4b95f4d6a3b5c12 (patch) | |
tree | 04ff84b7c076a2f178e90d0eb32eb1731b10fd3c /include/tools | |
parent | d4123356c61db269651e950a0a2cc93e6d801c90 (diff) |
VCL add vcl::WindowPosSize abstract class
... and use it to remove a duplicate and simplify code.
Should mostly be a refactoring, which was mainly done by some
larger sed calls, except for the new API calls, which helped
shrinking some LOC. All data is also now private.
Originally two of the "replaced" "classes" had unsigned width
and height and one had signed. Noel pointed out, that during
calculations, the value might get negative temporarly, so this
now settles with signed values. Still the set size should never
be negative and this is enforced this way. Not sure that is what
Noel had in mind.
This also includes:
- rename WindowState => WindowData
- rename WindowStateMask => WindowDataMask
- rename WindowStateState => WindowState
- move WindowState and WindowDataMask to vcl/windowstate.hxx
- move WindowData(Mask) and WindowState into vcl namespace
- readability: replace or'ed WindowState enums with "meta" enums
+ add "meta" WindowState enums PosSize and PosSizeState
Change-Id: Icd16cfb498531aa7238ddbde83fcb0ed6d9e4f77
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135426
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'include/tools')
-rw-r--r-- | include/tools/gen.hxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx index 20da07cb99af..7a8e66e2a6ff 100644 --- a/include/tools/gen.hxx +++ b/include/tools/gen.hxx @@ -481,6 +481,13 @@ inline std::basic_ostream<charT, traits> & operator <<( /// etc. methods interpret the interval as closed, while the lowercase /// getWidth() / getHeight() etc. methods interpret the interval as half-open. /// Ok, now is the time for despair. +/// +/// If you want to work with Size, you must use the closed interval functions! +/// And don't add getSize / setSize; this will probably just introduce bugs, +/// especially when used in combination with list-initialization. +/// +/// (Eventually you might notice, that the same engineer was also working on +/// Qt at some point; see documentation on QRect::bottom / QRect::right ;-). namespace tools { class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Rectangle final @@ -493,6 +500,7 @@ public: tools::Long nRight, tools::Long nBottom ); /// Constructs an empty Rectangle, with top/left at the specified params constexpr Rectangle( tools::Long nLeft, tools::Long nTop ); + /// Constructs a closed interval rectangle constexpr Rectangle( const Point& rLT, const Size& rSize ); constexpr inline static Rectangle Justify(const Point& rLT, const Point& rRB); |