diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-03-03 02:52:22 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-03-03 02:52:22 +0100 |
commit | b0c673265a73bcb5719986be589dfb10fee0ce22 (patch) | |
tree | a22bdff06fd5baa1cd434a8428957a754dcc4632 /LibGUI | |
parent | 7c06431ff7682b42c9e91a8ea27f54f73c7c28f8 (diff) | |
download | serenity-b0c673265a73bcb5719986be589dfb10fee0ce22.zip |
Applications: Map Alt+F4 to Quit in FileManager/ProcessManager/Terminal.
Diffstat (limited to 'LibGUI')
-rw-r--r-- | LibGUI/GAction.cpp | 6 | ||||
-rw-r--r-- | LibGUI/GAction.h | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/LibGUI/GAction.cpp b/LibGUI/GAction.cpp index 27321c2ff4..770c5ebc5d 100644 --- a/LibGUI/GAction.cpp +++ b/LibGUI/GAction.cpp @@ -20,6 +20,12 @@ GAction::GAction(const String& text, RetainPtr<GraphicsBitmap>&& icon, Function< { } +GAction::GAction(const String& text, const GShortcut& shortcut, Function<void(const GAction&)> on_activation_callback) + : GAction(text, shortcut, nullptr, move(on_activation_callback)) +{ +} + + GAction::GAction(const String& text, const GShortcut& shortcut, RetainPtr<GraphicsBitmap>&& icon, Function<void(const GAction&)> on_activation_callback) : on_activation(move(on_activation_callback)) , m_text(text) diff --git a/LibGUI/GAction.h b/LibGUI/GAction.h index 959995d38b..f85cda11f0 100644 --- a/LibGUI/GAction.h +++ b/LibGUI/GAction.h @@ -21,6 +21,10 @@ public: { return adopt(*new GAction(text, move(icon), move(callback))); } + static Retained<GAction> create(const String& text, const GShortcut& shortcut, Function<void(const GAction&)> callback) + { + return adopt(*new GAction(text, shortcut, move(callback))); + } static Retained<GAction> create(const String& text, const GShortcut& shortcut, RetainPtr<GraphicsBitmap>&& icon, Function<void(const GAction&)> callback) { return adopt(*new GAction(text, shortcut, move(icon), move(callback))); @@ -38,6 +42,7 @@ public: private: GAction(const String& text, Function<void(const GAction&)> = nullptr); + GAction(const String& text, const GShortcut&, Function<void(const GAction&)> = nullptr); GAction(const String& text, const GShortcut&, RetainPtr<GraphicsBitmap>&& icon, Function<void(const GAction&)> = nullptr); GAction(const String& text, RetainPtr<GraphicsBitmap>&& icon, Function<void(const GAction&)> = nullptr); GAction(const String& text, const String& custom_data = String(), Function<void(const GAction&)> = nullptr); |