X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fui%2FPanel.hpp;h=cf72e72a9c8668309f5ca9abd0ef8e9a110320de;hb=bf25780e00b719b0e5fa5d0191087bca2d99462b;hp=d62073b4ce46caac5e0899adc5af7afac6a9d37c;hpb=56f570e713c42d30109a214e68a2beed96ba1999;p=blobs.git diff --git a/src/ui/Panel.hpp b/src/ui/Panel.hpp index d62073b..cf72e72 100644 --- a/src/ui/Panel.hpp +++ b/src/ui/Panel.hpp @@ -18,6 +18,7 @@ public: HORIZONTAL, VERTICAL, }; + using Children_t = std::vector>; public: Panel(); @@ -25,19 +26,22 @@ public: public: // panel takes ownership - Panel &Add(Widget *); + Panel *Add(Widget *); + Panel *Clear(); + Panel *Reserve(int n) { widgets.reserve(n); return this; } + const Children_t &Children() const noexcept { return widgets; } - Panel &Background(const glm::vec4 &); - Panel &Padding(const glm::vec2 &); - Panel &Spacing(float); - Panel &Direction(Dir); + Panel *Background(const glm::vec4 &); + Panel *Padding(const glm::vec2 &); + Panel *Spacing(float); + Panel *Direction(Dir); glm::vec2 Size() override; - void Relayout(); + void FixLayout(); void Draw(app::Assets &, graphics::Viewport &) noexcept override; private: - std::vector> widgets; + Children_t widgets; glm::vec4 bg_color; glm::vec2 padding; float spacing;