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
commit 3085e400bc
Notes: sideshowbarker 2024-07-19 15:46:14 +09:00
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();