1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:47:35 +00:00

WindowServer+LibGfx: Move window frame rect calculation to WindowTheme

This commit is contained in:
Andreas Kling 2020-08-10 13:03:44 +02:00
parent 0e627b0273
commit de1a54c378
4 changed files with 41 additions and 22 deletions

View file

@ -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;
}
}
}