mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:28:11 +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 @@
|
|||
#pragma once
|
||||
|
||||
#include "WSMenu.h"
|
||||
#include <LibCore/CObject.h>
|
||||
#include <WindowServer/WSCPUMonitor.h>
|
||||
#include <WindowServer/WSWindow.h>
|
||||
|
@ -15,6 +16,10 @@ public:
|
|||
|
||||
virtual void event(CEvent&) override;
|
||||
|
||||
bool is_open(const WSMenu&) const;
|
||||
|
||||
Vector<WeakPtr<WSMenu>>& open_menu_stack() { return m_open_menu_stack; }
|
||||
|
||||
private:
|
||||
WSWindow& window() { return *m_window; }
|
||||
const WSWindow& window() const { return *m_window; }
|
||||
|
@ -27,4 +32,6 @@ private:
|
|||
OwnPtr<WSWindow> m_window;
|
||||
WSCPUMonitor m_cpu_monitor;
|
||||
String m_username;
|
||||
|
||||
Vector<WeakPtr<WSMenu>> m_open_menu_stack;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue