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:
parent
a5a7ea3d1e
commit
3085e400bc
9 changed files with 103 additions and 43 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue