From 2869ef7cec7de6bc744cdba9e753dbd0df4ab65b Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 2 Aug 2024 23:38:23 +0200 Subject: Add widgets for settings page, add list to auto position widgets --- include/gui/List.hpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 include/gui/List.hpp (limited to 'include/gui/List.hpp') diff --git a/include/gui/List.hpp b/include/gui/List.hpp new file mode 100644 index 0000000..23bf5ea --- /dev/null +++ b/include/gui/List.hpp @@ -0,0 +1,28 @@ +#pragma once + +#include "Widget.hpp" +#include +#include + +namespace gsr { + class List : public Widget { + public: + enum class Orientation { + VERTICAL, + HORIZONTAL + }; + + List(Orientation orientation); + List(const List&) = delete; + List& operator=(const List&) = delete; + + bool on_event(mgl::Event &event, mgl::Window &window, mgl::vec2f offset) override; + void draw(mgl::Window &window, mgl::vec2f offset) override; + + void add_widget(std::unique_ptr widget); + mgl::vec2f get_size() override; + protected: + std::vector> widgets; + Orientation orientation; + }; +} \ No newline at end of file -- cgit v1.2.3