mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 09:21:57 -05:00
LibGfx: Add support for notifications to plastic window theme
This commit is contained in:
parent
8918e915d3
commit
9cd906a5e1
2 changed files with 20 additions and 3 deletions
|
@ -169,12 +169,27 @@ void PlasticWindowTheme::paint_normal_frame(Painter& painter, WindowState window
|
|||
}
|
||||
}
|
||||
|
||||
void PlasticWindowTheme::paint_notification_frame(Painter& painter, WindowMode window_mode, IntRect const& window_rect, Palette const& palette, IntRect const& close_button_rect) const
|
||||
{
|
||||
(void)close_button_rect;
|
||||
|
||||
auto frame_rect = frame_rect_for_window(WindowType::Notification, window_mode, window_rect, palette, 0);
|
||||
frame_rect.set_location({ 0, 0 });
|
||||
|
||||
paint_window_frame(frame_rect, painter, palette, s_frame_colors);
|
||||
|
||||
auto titlebar_rect = this->titlebar_rect(WindowType::Notification, window_mode, window_rect, palette);
|
||||
painter.fill_rect_with_linear_gradient(titlebar_rect, s_title_gradient, 270);
|
||||
}
|
||||
|
||||
Vector<IntRect> PlasticWindowTheme::layout_buttons(WindowType window_type, WindowMode window_mode, IntRect const& window_rect, Palette const& palette, size_t buttons, bool is_maximized) const
|
||||
{
|
||||
auto button_rects = ClassicWindowTheme::layout_buttons(window_type, window_mode, window_rect, palette, buttons, is_maximized);
|
||||
for (auto& rect : button_rects)
|
||||
rect.translate_by(-s_window_border_radius_mask.width(), 2);
|
||||
|
||||
if (window_type != WindowType::Notification) {
|
||||
IntPoint offset(-s_window_border_radius_mask.width(), 2);
|
||||
for (auto& rect : button_rects)
|
||||
rect.translate_by(offset);
|
||||
}
|
||||
return button_rects;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@ namespace Gfx {
|
|||
|
||||
class PlasticWindowTheme : public ClassicWindowTheme {
|
||||
virtual void paint_normal_frame(Painter& painter, WindowState window_state, WindowMode window_mode, IntRect const& window_rect, StringView window_title, Bitmap const& icon, Palette const& palette, IntRect const& leftmost_button_rect, int menu_row_count, bool window_modified) const override;
|
||||
virtual void paint_notification_frame(Painter&, WindowMode, IntRect const& window_rect, Palette const&, IntRect const& close_button_rect) const override;
|
||||
|
||||
virtual IntRect titlebar_rect(WindowType, WindowMode, IntRect const& window_rect, Palette const&) const override;
|
||||
virtual IntRect titlebar_text_rect(WindowType type, WindowMode mode, IntRect const& window_rect, Palette const& palette) const override
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue