summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI/GMenu.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-08-28 21:11:53 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-08-29 06:36:29 +0200
commit63e6b09816c5d144e83138d3fd471b800d29a52a (patch)
tree7daa439cf56e3c9e6131aa7a52fb7432ca0e32e6 /Libraries/LibGUI/GMenu.h
parentd3ebd8897f27c75ddf0bb75d401a6ea55761b1bd (diff)
downloadserenity-63e6b09816c5d144e83138d3fd471b800d29a52a.zip
WindowServer+LibGUI: Add support for nested menus
It's now possible to add a GMenu as a submenu of another GMenu. Simply use the GMenu::add_submenu(NonnullOwnPtr<GMenu>) API :^) The WindowServer now keeps track of a stack of open menus rather than just one "current menu". This code needs a bit more work, but the basic functionality is now here!
Diffstat (limited to 'Libraries/LibGUI/GMenu.h')
-rw-r--r--Libraries/LibGUI/GMenu.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/Libraries/LibGUI/GMenu.h b/Libraries/LibGUI/GMenu.h
index 2ddd6f41f2..f873c92def 100644
--- a/Libraries/LibGUI/GMenu.h
+++ b/Libraries/LibGUI/GMenu.h
@@ -15,10 +15,13 @@ public:
static GMenu* from_menu_id(int);
+ const String& name() const { return m_name; }
+
GAction* action_at(int);
void add_action(NonnullRefPtr<GAction>);
void add_separator();
+ void add_submenu(NonnullOwnPtr<GMenu>);
void popup(const Point& screen_position);
void dismiss();
@@ -31,6 +34,7 @@ private:
int menu_id() const { return m_menu_id; }
int realize_menu();
void unrealize_menu();
+ void realize_if_needed();
int m_menu_id { -1 };
String m_name;