aboutsummaryrefslogtreecommitdiff
path: root/include/gui/List.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-08-02 23:38:23 +0200
committerdec05eba <dec05eba@protonmail.com>2024-08-02 23:53:28 +0200
commit2869ef7cec7de6bc744cdba9e753dbd0df4ab65b (patch)
tree1d15c5679197b38d42cabb3e74143ef63a930d84 /include/gui/List.hpp
parent7c4af06d953ad439906f85ec996ad00dd38d2302 (diff)
Add widgets for settings page, add list to auto position widgets
Diffstat (limited to 'include/gui/List.hpp')
-rw-r--r--include/gui/List.hpp28
1 files changed, 28 insertions, 0 deletions
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 <vector>
+#include <memory>
+
+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> widget);
+ mgl::vec2f get_size() override;
+ protected:
+ std::vector<std::unique_ptr<Widget>> widgets;
+ Orientation orientation;
+ };
+} \ No newline at end of file