aboutsummaryrefslogtreecommitdiff
path: root/include/gui/Widget.hpp
blob: 63cb64acadbfaef90426fe31e7c419d4307202f9 (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
#pragma once

#include <mglpp/system/vec.hpp>

namespace mgl {
    class Event;
    class Window;
}

namespace gsr {
    class Widget {
        friend class WidgetContainer;
    public:
        Widget();
        Widget(const Widget&) = delete;
        Widget& operator=(const Widget&) = delete;
        virtual ~Widget();

        // Return true to allow other widgets to also process the event
        virtual bool on_event(mgl::Event &event, mgl::Window &window) = 0;
        virtual void draw(mgl::Window &window) = 0;
        virtual void set_position(mgl::vec2f position);

        virtual mgl::vec2f get_position() const;
    protected:
        mgl::vec2f position;
    };
}