mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:57: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:
parent
d3ebd8897f
commit
63e6b09816
16 changed files with 177 additions and 12 deletions
|
@ -37,6 +37,12 @@ public:
|
|||
void notify_about_new_screen_rect(const Rect&);
|
||||
void post_paint_message(WSWindow&);
|
||||
|
||||
WSMenu* find_menu_by_id(int menu_id)
|
||||
{
|
||||
// FIXME: Remove this const_cast when Optional knows how to vend a non-const fallback value somehow.
|
||||
return const_cast<WSMenu*>(m_menus.get(menu_id).value_or(nullptr));
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void event(CEvent&) override;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue