1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:37:34 +00:00

WindowServer: Improve the look of menus.

This patch makes menus stand out a bit more from their background by using
the same kind of shading that Windows 2000 had.
This commit is contained in:
Andreas Kling 2019-04-16 17:02:26 +02:00
parent 311019d8ee
commit 86361d3d45
6 changed files with 32 additions and 18 deletions

View file

@ -166,3 +166,22 @@ void StylePainter::paint_frame(Painter& painter, const Rect& rect, FrameShape sh
painter.draw_line(inner_rect.top_right(), inner_rect.bottom_right().translated(0, -1), bottom_right_color);
}
}
void StylePainter::paint_menu_frame(Painter& painter, const Rect& rect)
{
Color top_left_color;
Color bottom_right_color;
Color base_color = Color::from_rgb(0xc0c0c0);
Color dark_shade = Color::from_rgb(0x404040);
Color mid_shade = Color::from_rgb(0x808080);
Color light_shade = Color::from_rgb(0xffffff);
painter.draw_line(rect.top_left(), rect.top_right(), base_color);
painter.draw_line(rect.top_left().translated(0, 1), rect.bottom_left(), base_color);
painter.draw_line(rect.top_left().translated(1, 1), rect.top_right().translated(-1, 1), light_shade);
painter.draw_line(rect.top_left().translated(1, 1), rect.bottom_left().translated(1, -1), light_shade);
painter.draw_line(rect.top_right(), rect.bottom_right(), dark_shade);
painter.draw_line(rect.bottom_left(), rect.bottom_right(), dark_shade);
painter.draw_line(rect.top_right().translated(-1, 1), rect.bottom_right().translated(-1, -1), mid_shade);
painter.draw_line(rect.bottom_left().translated(1, -1), rect.bottom_right().translated(-1, -1), mid_shade);
}

View file

@ -12,4 +12,5 @@ public:
static void paint_button(Painter&, const Rect&, ButtonStyle, bool pressed, bool hovered = false, bool checked = false, bool enabled = true);
static void paint_surface(Painter&, const Rect&, bool paint_vertical_lines = true);
static void paint_frame(Painter&, const Rect&, FrameShape, FrameShadow, int thickness, bool skip_vertical_lines = false);
static void paint_menu_frame(Painter&, const Rect&);
};