aboutsummaryrefslogtreecommitdiff
path: root/include/gui/CheckBox.hpp
blob: 19ffaf63e7e69c52b88f4daa968db487d8d97469 (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 "Widget.hpp"

#include <mglpp/graphics/Color.hpp>
#include <mglpp/graphics/Text.hpp>

namespace gsr {
    class CheckBox : public Widget {
    public:
        CheckBox(mgl::Font *font, const char *text);
        CheckBox(const CheckBox&) = delete;
        CheckBox& operator=(const CheckBox&) = delete;

        bool on_event(mgl::Event &event, mgl::Window &window, mgl::vec2f offset) override;
        void draw(mgl::Window &window, mgl::vec2f offset) override;

        mgl::vec2f get_size() override;

        void set_checked(bool checked);
        bool is_checked() const;
    private:
        mgl::vec2f get_checkbox_size();
    private:
        mgl::Text text;
        bool checked = false;
    };
}