1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +00:00

LibGUI: Add GAction class and make GMenu deal in actions rather than strings.

This commit is contained in:
Andreas Kling 2019-02-12 14:09:48 +01:00
parent a5a7ea3d1e
commit 3085e400bc
9 changed files with 103 additions and 43 deletions

View file

@ -2,6 +2,7 @@
#include "GEvent.h"
#include "GObject.h"
#include "GWindow.h"
#include <LibGUI/GAction.h>
#include <LibGUI/GNotifier.h>
#include <LibGUI/GMenu.h>
#include <LibC/unistd.h>
@ -156,8 +157,8 @@ void GEventLoop::handle_menu_event(const GUI_Event& event)
dbgprintf("GEventLoop received event for invalid window ID %d\n", event.window_id);
return;
}
if (menu->on_item_activation)
menu->on_item_activation(event.menu.identifier);
if (auto* action = menu->action_at(event.menu.identifier))
action->activate();
return;
}
ASSERT_NOT_REACHED();