aboutsummaryrefslogtreecommitdiff
path: root/include/gui/List.hpp
blob: 8c4e1fcbc41ac774968e25e50d87647d22429ba9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once

#include "Widget.hpp"
#include <vector>
#include <memory>

namespace gsr {
    class List : public Widget {
    public:
        enum class Orientation {
            VERTICAL,
            HORIZONTAL
        };

        enum class Alignment {
            START,
            CENTER,
            END
        };

        List(Orientation orientation, Alignment content_alignment = Alignment::START);
        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;
        Alignment content_alignment;
    };
}