summaryrefslogtreecommitdiffstats
path: root/hal/ui/widget/base_widget.hpp
blob: 4deabc3fa5289569eac188ae3131fbe1c4e0e4dc (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
#pragma once

#include "../../api.hpp"
#include "../../../init.hpp"

class BaseWidget {
    private:
        // A pointer to the API is used by the paint method to draw the widget on-screen.
        Api *m_app_api;

    public:
        // Widget geometry, in pixels
        struct Geometry {
            int x = 0; // top-left corner of widget
            int y = 0; // top-left corner of widget
            int width = 1;
            int height = 1;
        } m_geometry;

        BaseWidget(Api *app_api, Geometry geometry) :
            m_app_api{app_api},
            m_geometry{geometry}
            {}
        virtual void paint(bool invert_colors = false) = 0;
};