X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fui%2FLabel.hpp;h=7ba884b3d6d47430df5c406d05d28395a746946b;hb=d921cba26f21e4a75b22f5e9d9be988707bf6a8f;hp=0b9e0ca8e4534c90bebd542a75fe8b56906deb6f;hpb=76b630bd0a147bf7c78d3380237c86b9bfc48530;p=blobs.git diff --git a/src/ui/Label.hpp b/src/ui/Label.hpp index 0b9e0ca..7ba884b 100644 --- a/src/ui/Label.hpp +++ b/src/ui/Label.hpp @@ -1,51 +1,36 @@ #ifndef BLOBS_UI_LABEL_HPP_ #define BLOBS_UI_LABEL_HPP_ -#include "align.hpp" +#include "Widget.hpp" #include "../graphics/Texture.hpp" #include namespace blobs { -namespace app { - struct Assets; -} namespace graphics { class Font; - class Viewport; } namespace ui { -class Label { +class Label +: public Widget { public: explicit Label(const graphics::Font &); - ~Label(); - - Label(const Label &) = delete; - Label &operator =(const Label &) = delete; - - Label(Label &&) = delete; - Label &operator =(Label &&) = delete; + ~Label() override; public: - Label &Text(const std::string &); - Label &Font(const graphics::Font &); - Label &Foreground(const glm::vec4 &); - Label &Background(const glm::vec4 &); - - Label &Position(const glm::vec3 &p) noexcept { pos = p; return *this; } - const glm::vec3 &Position() const noexcept { return pos; } - - Label &Origin(Gravity o) noexcept { origin = o; return *this; } - Gravity Origin() const noexcept { return origin; } + Label *Text(const std::string &); + Label *Font(const graphics::Font &); + Label *Foreground(const glm::vec4 &); + Label *Background(const glm::vec4 &); - glm::vec2 Size(); - void Draw(app::Assets &, graphics::Viewport &) noexcept; + glm::vec2 Size() override; + void Draw(app::Assets &, graphics::Viewport &) noexcept override; private: - void Update(); + void FixLayout() override; private: const graphics::Font *font; @@ -53,9 +38,6 @@ private: graphics::Texture tex; glm::vec4 fg_color; glm::vec4 bg_color; - glm::vec3 pos; - Gravity origin; - bool dirty; };