ladybird/LibGUI/GApplication.h
Andreas Kling 5e40aa4f1a LibGUI: Move shortcut actions from GEventLoop to GApplications.
I'm gonna want to have nested event loops sooner or later, so let's not
pollute GEventLoop with things that are meant to work globally.

This patch also changes key events to pass around their modifiers as a
bitfield all the way around the system instead of breaking them up.
2019-03-03 12:32:15 +01:00

33 lines
697 B
C++

#pragma once
#include <AK/Badge.h>
#include <AK/OwnPtr.h>
#include <AK/HashMap.h>
#include <LibGUI/GShortcut.h>
class GAction;
class GKeyEvent;
class GEventLoop;
class GMenuBar;
class GApplication {
public:
static GApplication& the();
GApplication(int argc, char** argv);
~GApplication();
int exec();
void quit(int);
void set_menubar(OwnPtr<GMenuBar>&&);
GAction* action_for_key_event(const GKeyEvent&);
void register_shortcut_action(Badge<GAction>, GAction&);
void unregister_shortcut_action(Badge<GAction>, GAction&);
private:
OwnPtr<GEventLoop> m_event_loop;
OwnPtr<GMenuBar> m_menubar;
HashMap<GShortcut, GAction*> m_shortcut_actions;
};