diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-02-12 10:08:35 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-02-12 10:08:35 +0100 |
commit | db98327bdc24b3306961cde5036ea73e766008c3 (patch) | |
tree | 3980dd4690778151318bc28e7d5ae85aeecda28e /LibGUI/GMenu.h | |
parent | 9c1c8854831005cee601d73bba3a0737f350c236 (diff) | |
download | serenity-db98327bdc24b3306961cde5036ea73e766008c3.zip |
Plumb menu item activation events from WindowServer to clients.
GMenu now has an "on_item_activation" callback that fires whenever one
of its items are activated. The menu item identifier is used to distinguish
between items.
Use this to implement font switching in Terminal. :^)
Diffstat (limited to 'LibGUI/GMenu.h')
-rw-r--r-- | LibGUI/GMenu.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/LibGUI/GMenu.h b/LibGUI/GMenu.h index 5582049563..3eeed3527f 100644 --- a/LibGUI/GMenu.h +++ b/LibGUI/GMenu.h @@ -1,6 +1,7 @@ #pragma once #include <LibGUI/GMenuItem.h> +#include <AK/Function.h> #include <AK/Vector.h> class GMenu { @@ -8,9 +9,13 @@ public: explicit GMenu(const String& name); ~GMenu(); + static GMenu* from_menu_id(int); + void add_item(unsigned identifier, const String& text); void add_separator(); + Function<void(unsigned)> on_item_activation; + private: friend class GMenuBar; int menu_id() const { return m_menu_id; } |