1 #ifndef BLOBS_UI_WIDGET_HPP_
2 #define BLOBS_UI_WIDGET_HPP_
4 #include "../math/glm.hpp"
22 Widget(const Widget &) = delete;
23 Widget &operator =(const Widget &) = delete;
25 Widget(Widget &&) = delete;
26 Widget &operator =(Widget &&) = delete;
29 void SetParent(Widget &) noexcept;
30 bool HasParent() const noexcept { return parent; }
31 Widget &GetParent() noexcept { return *parent; }
32 const Widget &GetParent() const noexcept { return *parent; }
34 Widget *Position(const glm::vec2 &p) noexcept { pos = p; return this; }
35 const glm::vec2 &Position() const noexcept { return pos; }
37 Widget *ZIndex(float z) noexcept { z_index = z; return this; }
38 float ZIndex() const noexcept { return z_index; }
40 bool DirtyLayout() const noexcept { return dirty_layout; }
41 void BreakLayout() noexcept;
42 void BreakParentLayout() noexcept;
45 virtual glm::vec2 Size() = 0;
46 virtual void Draw(app::Assets &, graphics::Viewport &) noexcept = 0;
49 virtual void FixLayout() { }