diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-03-03 12:32:15 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-03-03 12:32:15 +0100 |
commit | 5e40aa4f1a4f5e9c36a0e071f53bc25d857fd18f (patch) | |
tree | 2b4c3605302f346c6060e65fdcf733e42b0c0dd0 /LibGUI/GApplication.h | |
parent | 725b57fe1fd99b00a432b84299839109b2fa3ff9 (diff) | |
download | serenity-5e40aa4f1a4f5e9c36a0e071f53bc25d857fd18f.zip |
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.
Diffstat (limited to 'LibGUI/GApplication.h')
-rw-r--r-- | LibGUI/GApplication.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/LibGUI/GApplication.h b/LibGUI/GApplication.h index 723eeec3e4..694f19e4d2 100644 --- a/LibGUI/GApplication.h +++ b/LibGUI/GApplication.h @@ -1,7 +1,12 @@ #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; @@ -15,8 +20,13 @@ public: 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; }; |