diff options
Diffstat (limited to 'include/gui/CustomRendererWidget.hpp')
-rw-r--r-- | include/gui/CustomRendererWidget.hpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/gui/CustomRendererWidget.hpp b/include/gui/CustomRendererWidget.hpp new file mode 100644 index 0000000..e16e532 --- /dev/null +++ b/include/gui/CustomRendererWidget.hpp @@ -0,0 +1,25 @@ +#pragma once + +#include "Widget.hpp" + +#include <functional> + +namespace gsr { + class CustomRendererWidget : public Widget { + public: + CustomRendererWidget(mgl::vec2f size); + CustomRendererWidget(const CustomRendererWidget&) = delete; + CustomRendererWidget& operator=(const CustomRendererWidget&) = 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; + + std::function<void(mgl::Window &window, mgl::vec2f pos, mgl::vec2f size)> draw_handler; + // Return true to allow other widgets to handle events + std::function<bool(mgl::Event &event, mgl::Window &window, mgl::vec2f pos, mgl::vec2f size)> event_handler; + private: + mgl::vec2f size; + }; +}
\ No newline at end of file |