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!
This commit is contained in:
Andreas Kling 2019-08-28 21:11:53 +02:00
commit 63e6b09816
Notes: sideshowbarker 2024-07-19 12:26:45 +09:00
16 changed files with 177 additions and 12 deletions

View file

@ -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;