1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:37:35 +00:00

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
parent d3ebd8897f
commit 63e6b09816
16 changed files with 177 additions and 12 deletions

View file

@ -44,6 +44,12 @@ public:
const GraphicsBitmap* icon() const { return m_icon; }
void set_icon(const GraphicsBitmap* icon) { m_icon = icon; }
bool is_submenu() const { return m_submenu_id != -1; }
int submenu_id() const { return m_submenu_id; }
void set_submenu_id(int submenu_id) { m_submenu_id = submenu_id; }
WSMenu* submenu();
private:
WSMenu& m_menu;
Type m_type { None };
@ -55,4 +61,5 @@ private:
String m_shortcut_text;
Rect m_rect;
RefPtr<GraphicsBitmap> m_icon;
int m_submenu_id { -1 };
};