diff --git a/Userland/Libraries/LibGUI/Application.cpp b/Userland/Libraries/LibGUI/Application.cpp index 0d22137683..01146d2d82 100644 --- a/Userland/Libraries/LibGUI/Application.cpp +++ b/Userland/Libraries/LibGUI/Application.cpp @@ -278,4 +278,20 @@ void Application::notify_drag_cancelled(Badge) set_drag_hovered_widget_impl(nullptr); } +void Application::event(Core::Event& event) +{ + if (event.type() == GUI::Event::ActionEnter || event.type() == GUI::Event::ActionLeave) { + auto& action_event = static_cast(event); + auto& action = action_event.action(); + if (action_event.type() == GUI::Event::ActionEnter) { + if (on_action_enter) + on_action_enter(action); + } else { + if (on_action_leave) + on_action_leave(action); + } + } + Object::event(event); +} + } diff --git a/Userland/Libraries/LibGUI/Application.h b/Userland/Libraries/LibGUI/Application.h index b1710ce8dd..19b5c6a23f 100644 --- a/Userland/Libraries/LibGUI/Application.h +++ b/Userland/Libraries/LibGUI/Application.h @@ -95,9 +95,14 @@ public: } void notify_drag_cancelled(Badge); + Function on_action_enter; + Function on_action_leave; + private: Application(int argc, char** argv); + virtual void event(Core::Event&) override; + void tooltip_show_timer_did_fire(); void tooltip_hide_timer_did_fire();