1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:27:46 +00:00

WindowManager: Move more of the menu management logic to WSMenuManager

This patch moves a whole lot of the menu logic from WSWindowManager to
its proper home in WSMenuManager.

We also get rid of the "close_current_menu()" concept which was easily
confused in the presence of submenus. All operations should now be
aware of the menu stack instead. (The concept of a single, current menu
made a lot more sense when there were no nested menus.)
This commit is contained in:
Andreas Kling 2019-11-11 12:21:57 +01:00
parent 77de51d251
commit cbecad0a77
7 changed files with 126 additions and 96 deletions

View file

@ -23,7 +23,16 @@ public:
void set_needs_window_resize();
WSMenu* current_menu() { return m_current_menu.ptr(); }
void set_current_menu(WSMenu*, bool is_submenu = false);
void close_everyone();
void close_everyone_not_in_lineage(WSMenu&);
void close_menu_and_descendants(WSMenu&);
private:
void close_menus(const Vector<WSMenu*>&);
WSWindow& window() { return *m_window; }
const WSWindow& window() const { return *m_window; }
@ -37,6 +46,7 @@ private:
String m_username;
RefPtr<CTimer> m_timer;
WeakPtr<WSMenu> m_current_menu;
Vector<WeakPtr<WSMenu>> m_open_menu_stack;
bool m_needs_window_resize;