diff --git a/libs/ui/include/psemek/ui/controller.hpp b/libs/ui/include/psemek/ui/controller.hpp index 189a5091..ec7141e9 100644 --- a/libs/ui/include/psemek/ui/controller.hpp +++ b/libs/ui/include/psemek/ui/controller.hpp @@ -22,6 +22,8 @@ namespace psemek::ui void set_hint_delay(float seconds); void on_hint(util::function callback); + void set_post_draw_effect(util::function effect); + void reshape(geom::box const & shape); bool event(mouse_move const & e); diff --git a/libs/ui/source/controller.cpp b/libs/ui/source/controller.cpp index 8af42246..b235c331 100644 --- a/libs/ui/source/controller.cpp +++ b/libs/ui/source/controller.cpp @@ -68,6 +68,7 @@ namespace psemek::ui util::function on_hint; std::optional> hinted_element = std::nullopt; std::optional hint_called = std::nullopt; + util::function post_draw_effect; impl(async::event_loop * loop); @@ -212,6 +213,11 @@ namespace psemek::ui impl().on_hint = std::move(callback); } + void controller::set_post_draw_effect(util::function effect) + { + impl().post_draw_effect = std::move(effect); + } + void controller::reshape(geom::box const & shape) { impl().root->reshape(shape); @@ -321,7 +327,11 @@ namespace psemek::ui for (auto c : elem->children()) if (c) self(c); if (visible) + { elem->post_draw(impl().painter); + if (impl().post_draw_effect) + impl().post_draw_effect(elem, impl().painter); + } }); visitor(impl().root.get());