diff --git a/Userland/Libraries/LibGUI/Toolbar.cpp b/Userland/Libraries/LibGUI/Toolbar.cpp index 0968b81b6d8..a66ce9a22a4 100644 --- a/Userland/Libraries/LibGUI/Toolbar.cpp +++ b/Userland/Libraries/LibGUI/Toolbar.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, Andreas Kling + * Copyright (c) 2018-2021, Andreas Kling * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,8 +26,10 @@ #include #include +#include #include #include +#include #include #include #include @@ -88,6 +90,22 @@ private: } return builder.to_string(); } + + virtual void enter_event(Core::Event& event) override + { + auto* app = Application::the(); + if (app && action()) + Core::EventLoop::current().post_event(*app, make(ActionEvent::Type::ActionEnter, *action())); + return Button::enter_event(event); + } + + virtual void leave_event(Core::Event& event) override + { + auto* app = Application::the(); + if (app && action()) + Core::EventLoop::current().post_event(*app, make(ActionEvent::Type::ActionLeave, *action())); + return Button::leave_event(event); + } }; void Toolbar::add_action(Action& action)