mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 14:45:07 +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
|
@ -1,5 +1,6 @@
|
|||
#include <LibGUI/GAction.h>
|
||||
#include <LibGUI/GEventLoop.h>
|
||||
#include <LibGUI/GMenu.h>
|
||||
#include <LibGUI/GMenuItem.h>
|
||||
#include <WindowServer/WSAPITypes.h>
|
||||
|
||||
|
@ -21,6 +22,13 @@ GMenuItem::GMenuItem(unsigned menu_id, NonnullRefPtr<GAction>&& action)
|
|||
m_checked = m_action->is_checked();
|
||||
}
|
||||
|
||||
GMenuItem::GMenuItem(unsigned menu_id, NonnullOwnPtr<GMenu>&& submenu)
|
||||
: m_type(Submenu)
|
||||
, m_menu_id(menu_id)
|
||||
, m_submenu(move(submenu))
|
||||
{
|
||||
}
|
||||
|
||||
GMenuItem::~GMenuItem()
|
||||
{
|
||||
if (m_action)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue