aboutsummaryrefslogtreecommitdiff
path: root/CruUI/ui/ui_base.h
diff options
context:
space:
mode:
Diffstat (limited to 'CruUI/ui/ui_base.h')
-rw-r--r--CruUI/ui/ui_base.h154
1 files changed, 0 insertions, 154 deletions
diff --git a/CruUI/ui/ui_base.h b/CruUI/ui/ui_base.h
deleted file mode 100644
index 43f3c498..00000000
--- a/CruUI/ui/ui_base.h
+++ /dev/null
@@ -1,154 +0,0 @@
-#pragma once
-
-
-namespace cru
-{
- namespace ui
- {
- struct Point
- {
- constexpr static Point Zero()
- {
- return Point(0, 0);
- }
-
- constexpr Point() = default;
- constexpr Point(const float x, const float y) : x(x), y(y) { }
-
- float x = 0;
- float y = 0;
- };
-
- constexpr bool operator==(const Point& left, const Point& right)
- {
- return left.x == right.x && left.y == right.y;
- }
-
- constexpr bool operator!=(const Point& left, const Point& right)
- {
- return !(left == right);
- }
-
- struct Size
- {
- constexpr static Size Zero()
- {
- return Size(0, 0);
- }
-
- constexpr Size() = default;
- constexpr Size(const float width, const float height) : width(width), height(height) { }
-
- float width = 0;
- float height = 0;
- };
-
- constexpr Size operator + (const Size& left, const Size& right)
- {
- return Size(left.width + right.width, left.height + right.height);
- }
-
- constexpr Size operator - (const Size& left, const Size& right)
- {
- return Size(left.width - right.width, left.height - right.height);
- }
-
- struct Rect
- {
- constexpr Rect() = default;
- constexpr Rect(const float left, const float top, const float width, const float height)
- : left(left), top(top), width(width), height(height) { }
- constexpr Rect(const Point& lefttop, const Size& size)
- : left(lefttop.x), top(lefttop.y), width(size.width), height(size.height) { }
-
- constexpr static Rect FromVertices(const float left, const float top, const float right, const float bottom)
- {
- return Rect(left, top, right - left, bottom - top);
- }
-
- constexpr float GetRight() const
- {
- return left + width;
- }
-
- constexpr float GetBottom() const
- {
- return top + height;
- }
-
- constexpr Point GetLeftTop() const
- {
- return Point(left, top);
- }
-
- constexpr Point GetRightBottom() const
- {
- return Point(left + width, top + height);
- }
-
- constexpr Size GetSize() const
- {
- return Size(width, height);
- }
-
- constexpr bool IsPointInside(const Point& point) const
- {
- return
- point.x >= left &&
- point.x < GetRight() &&
- point.y >= top &&
- point.y < GetBottom();
- }
-
- float left = 0.0f;
- float top = 0.0f;
- float width = 0.0f;
- 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,
- Right,
- Middle
- };
-
- struct TextRange
- {
- constexpr TextRange() = default;
- constexpr TextRange(const int position, const int count)
- : position(position), count(count)
- {
-
- }
-
- unsigned position = 0;
- unsigned count = 0;
- };
- }
-}