Add widgets for settings page, add list to auto position widgets

This commit is contained in:
dec05eba
2024-08-02 23:38:23 +02:00
parent 7c4af06d95
commit 2869ef7cec
18 changed files with 348 additions and 173 deletions

28
include/gui/List.hpp Normal file
View File

@@ -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;
};
}