diff options
author | Andreas Kling <kling@serenityos.org> | 2020-08-10 13:03:44 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-10 13:03:44 +0200 |
commit | de1a54c3780651f2031d4b4647819ed62c7a1605 (patch) | |
tree | 479d50a082e5659d20fa23cbd5a7b0055e161c39 /Libraries/LibGfx/ClassicWindowTheme.cpp | |
parent | 0e627b02737c2536cb16a085efd0e7b929193e8b (diff) | |
download | serenity-de1a54c3780651f2031d4b4647819ed62c7a1605.zip |
WindowServer+LibGfx: Move window frame rect calculation to WindowTheme
Diffstat (limited to 'Libraries/LibGfx/ClassicWindowTheme.cpp')
-rw-r--r-- | Libraries/LibGfx/ClassicWindowTheme.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Libraries/LibGfx/ClassicWindowTheme.cpp b/Libraries/LibGfx/ClassicWindowTheme.cpp index 83c6a70951..39d6a16622 100644 --- a/Libraries/LibGfx/ClassicWindowTheme.cpp +++ b/Libraries/LibGfx/ClassicWindowTheme.cpp @@ -147,7 +147,30 @@ void ClassicWindowTheme::paint_notification_frame(Painter& painter, const IntRec painter.draw_line({ titlebar_rect.x() + i, stripe_top }, { titlebar_rect.x() + i, stripe_bottom }, palette.active_window_title_stripes()); } } +} + +IntRect ClassicWindowTheme::frame_rect_for_window(WindowType window_type, const IntRect& window_rect, const Gfx::Palette& palette) const +{ + auto window_titlebar_height = palette.window_title_height(); + switch (window_type) { + case WindowType::Normal: + return { + window_rect.x() - 4, + window_rect.y() - window_titlebar_height - 6, + window_rect.width() + 8, + window_rect.height() + 10 + window_titlebar_height + }; + case WindowType::Notification: + return { + window_rect.x() - 3, + window_rect.y() - 3, + window_rect.width() + 6 + window_titlebar_height, + window_rect.height() + 6 + }; + default: + return window_rect; + } } } |