1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 06:28:13 +00:00

WindowServer+LibGfx: Show menus in windows! :^)

This patch begins the transition away from the global menu towards
per-window menus instead.

The global menu looks neat, but has always felt clunky, and there
are a number of usability problems with it, especially in programs
with multiple windows.

You can now call GUI::Window::set_menubar() to add a menubar to
your window. It will be specific to that one window only.
This commit is contained in:
Andreas Kling 2021-03-25 21:01:19 +01:00
parent 1daaa4f38d
commit e76771bfad
21 changed files with 335 additions and 44 deletions

View file

@ -50,7 +50,7 @@ public:
bool has_open_menu() const { return !m_open_menu_stack.is_empty(); }
Gfx::IntRect menubar_rect() const;
static int menubar_menu_margin() { return 16; }
static int menubar_menu_margin() { return 13; }
void set_needs_window_resize();
@ -93,6 +93,9 @@ public:
void did_change_theme();
void set_hovered_menu(Menu*);
Menu* hovered_menu() { return m_hovered_menu; }
private:
void close_menus(const Vector<Menu*>&);
@ -121,6 +124,7 @@ private:
int m_theme_index { 0 };
WeakPtr<MenuBar> m_current_menubar;
WeakPtr<Menu> m_hovered_menu;
};
}