diff options
author | Yuqian Yang <crupest@outlook.com> | 2018-10-04 16:52:11 +0000 |
---|---|---|
committer | Yuqian Yang <crupest@outlook.com> | 2018-10-04 16:52:11 +0000 |
commit | 7e870dd16e2f5b41fa6c6f687723aaa50c16274d (patch) | |
tree | be2b26a42dc9fde97379f98f035113e08e0bc331 /src/ui/ui_base.h | |
parent | 30ecda8bb354d5982978af97aa90b5f49d9ea195 (diff) | |
parent | c5384d496e9ed429ca2baa3ca5e586ff255235eb (diff) | |
download | cru-7e870dd16e2f5b41fa6c6f687723aaa50c16274d.tar.gz cru-7e870dd16e2f5b41fa6c6f687723aaa50c16274d.tar.bz2 cru-7e870dd16e2f5b41fa6c6f687723aaa50c16274d.zip |
Merge branch '12-layout' into 'master'
Resolve "Add padding, margin, border to Control."
Closes #12
See merge request crupest/CruUI!12
Diffstat (limited to 'src/ui/ui_base.h')
-rw-r--r-- | src/ui/ui_base.h | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/src/ui/ui_base.h b/src/ui/ui_base.h index 43f3c498..51ae4084 100644 --- a/src/ui/ui_base.h +++ b/src/ui/ui_base.h @@ -53,6 +53,16 @@ namespace cru return Size(left.width - right.width, left.height - right.height); } + constexpr bool operator==(const Size& left, const Size& right) + { + return left.width == right.width && left.height == right.height; + } + + constexpr bool operator!=(const Size& left, const Size& right) + { + return !(left == right); + } + struct Rect { constexpr Rect() = default; @@ -106,31 +116,6 @@ namespace cru float height = 0.0f; }; - struct Thickness - { - constexpr static Thickness Zero() - { - return Thickness(0); - } - - constexpr Thickness() : Thickness(0) { } - - constexpr explicit Thickness(const float width) - : left(width), top(width), right(width), bottom(width) { } - - constexpr explicit Thickness(const float horizontal, const float vertical) - : left(horizontal), top(vertical), right(horizontal), bottom(vertical) { } - - constexpr Thickness(const float left, const float top, const float right, const float bottom) - : left(left), top(top), right(right), bottom(bottom) { } - - - float left; - float top; - float right; - float bottom; - }; - enum class MouseButton { Left, |