diff options
Diffstat (limited to 'hal/ui/widget/base_widget.hpp')
-rw-r--r-- | hal/ui/widget/base_widget.hpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/hal/ui/widget/base_widget.hpp b/hal/ui/widget/base_widget.hpp new file mode 100644 index 0000000..4deabc3 --- /dev/null +++ b/hal/ui/widget/base_widget.hpp @@ -0,0 +1,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; +}; |