1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:47:34 +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

@ -36,6 +36,7 @@
namespace WindowServer {
class Button;
class Menu;
class MouseEvent;
class Window;
@ -43,7 +44,7 @@ class WindowFrame {
public:
static void reload_config();
WindowFrame(Window&);
explicit WindowFrame(Window&);
~WindowFrame();
Gfx::IntRect rect() const;
@ -55,11 +56,15 @@ public:
void notify_window_rect_changed(const Gfx::IntRect& old_rect, const Gfx::IntRect& new_rect);
void invalidate_title_bar();
void invalidate(Gfx::IntRect relative_rect);
void invalidate();
Gfx::IntRect title_bar_rect() const;
Gfx::IntRect title_bar_icon_rect() const;
Gfx::IntRect title_bar_text_rect() const;
Gfx::IntRect menubar_rect() const;
int menu_row_count() const;
void did_set_maximized(Badge<Window>, bool);
void layout_buttons();
@ -97,11 +102,15 @@ private:
void paint_notification_frame(Gfx::Painter&);
void paint_normal_frame(Gfx::Painter&);
void paint_tool_window_frame(Gfx::Painter&);
void paint_menubar(Gfx::Painter&);
Gfx::Bitmap* window_shadow() const;
bool frame_has_alpha() const;
Gfx::IntRect inflated_for_shadow(const Gfx::IntRect&) const;
Gfx::Bitmap* inflate_for_shadow(Gfx::IntRect&, Gfx::IntPoint&) const;
void handle_menubar_mouse_event(const MouseEvent&);
void handle_menu_mouse_event(Menu&, const MouseEvent&);
Gfx::WindowTheme::WindowState window_state_for_theme() const;
String compute_title_text() const;