diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-02-12 14:09:48 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-02-12 14:09:48 +0100 |
commit | 3085e400bcda710ac6977016768581bc789bb937 (patch) | |
tree | 6f40a1fa142afa9e163779c63ff5cb8157f107b8 /LibGUI/GMenu.h | |
parent | a5a7ea3d1e6cbf595aa5d1809217abe6580fb63a (diff) | |
download | serenity-3085e400bcda710ac6977016768581bc789bb937.zip |
LibGUI: Add GAction class and make GMenu deal in actions rather than strings.
Diffstat (limited to 'LibGUI/GMenu.h')
-rw-r--r-- | LibGUI/GMenu.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/LibGUI/GMenu.h b/LibGUI/GMenu.h index 3eeed3527f..dceaad72eb 100644 --- a/LibGUI/GMenu.h +++ b/LibGUI/GMenu.h @@ -4,6 +4,8 @@ #include <AK/Function.h> #include <AK/Vector.h> +class GAction; + class GMenu { public: explicit GMenu(const String& name); @@ -11,7 +13,9 @@ public: static GMenu* from_menu_id(int); - void add_item(unsigned identifier, const String& text); + GAction* action_at(size_t); + + void add_action(OwnPtr<GAction>&&); void add_separator(); Function<void(unsigned)> on_item_activation; @@ -23,5 +27,5 @@ private: int m_menu_id { 0 }; String m_name; - Vector<GMenuItem> m_items; + Vector<OwnPtr<GMenuItem>> m_items; }; |