2020-01-18 05:38:21 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 05:38:21 -03:00
|
|
|
*/
|
|
|
|
|
|
2020-02-06 08:07:05 -03:00
|
|
|
#include <LibGfx/Bitmap.h>
|
2020-08-12 06:54:17 -03:00
|
|
|
#include <LibGfx/ClassicStylePainter.h>
|
2020-02-06 08:04:00 -03:00
|
|
|
#include <LibGfx/Painter.h>
|
|
|
|
|
#include <LibGfx/Palette.h>
|
|
|
|
|
#include <LibGfx/StylePainter.h>
|
2019-02-10 04:11:01 -02:00
|
|
|
|
2020-02-06 07:56:38 -03:00
|
|
|
namespace Gfx {
|
|
|
|
|
|
2020-08-12 06:54:17 -03:00
|
|
|
BaseStylePainter& StylePainter::current()
|
2019-05-05 09:39:37 -03:00
|
|
|
{
|
2020-08-12 06:54:17 -03:00
|
|
|
static ClassicStylePainter style;
|
|
|
|
|
return style;
|
2019-05-05 09:39:37 -03:00
|
|
|
}
|
|
|
|
|
|
2022-08-07 21:08:16 -03:00
|
|
|
void StylePainter::paint_tab_button(Painter& painter, IntRect const& rect, Palette const& palette, bool active, bool hovered, bool enabled, GUI::TabWidget::TabPosition position, bool in_active_window, bool accented)
|
2019-03-27 16:48:23 -03:00
|
|
|
{
|
2022-08-07 21:08:16 -03:00
|
|
|
current().paint_tab_button(painter, rect, palette, active, hovered, enabled, position, in_active_window, accented);
|
2019-03-27 16:48:23 -03:00
|
|
|
}
|
|
|
|
|
|
2022-04-01 14:58:27 -03:00
|
|
|
void StylePainter::paint_button(Painter& painter, IntRect const& rect, Palette const& palette, ButtonStyle button_style, bool pressed, bool hovered, bool checked, bool enabled, bool focused, bool default_button)
|
2019-02-10 04:11:01 -02:00
|
|
|
{
|
2022-01-24 16:22:02 -03:00
|
|
|
current().paint_button(painter, rect, palette, button_style, pressed, hovered, checked, enabled, focused, default_button);
|
2019-02-10 04:11:01 -02:00
|
|
|
}
|
2019-03-04 06:47:54 -03:00
|
|
|
|
2022-04-01 14:58:27 -03:00
|
|
|
void StylePainter::paint_frame(Painter& painter, IntRect const& rect, Palette const& palette, FrameShape shape, FrameShadow shadow, int thickness, bool skip_vertical_lines)
|
2019-04-09 22:43:46 -03:00
|
|
|
{
|
2020-08-12 06:54:17 -03:00
|
|
|
current().paint_frame(painter, rect, palette, shape, shadow, thickness, skip_vertical_lines);
|
2019-04-09 22:43:46 -03:00
|
|
|
}
|
2019-04-16 12:02:26 -03:00
|
|
|
|
2022-04-01 14:58:27 -03:00
|
|
|
void StylePainter::paint_window_frame(Painter& painter, IntRect const& rect, Palette const& palette)
|
2019-04-16 12:02:26 -03:00
|
|
|
{
|
2020-08-12 06:54:17 -03:00
|
|
|
current().paint_window_frame(painter, rect, palette);
|
2019-04-16 12:02:26 -03:00
|
|
|
}
|
2019-08-14 15:31:46 -03:00
|
|
|
|
2022-04-01 14:58:27 -03:00
|
|
|
void StylePainter::paint_progressbar(Painter& painter, IntRect const& rect, Palette const& palette, int min, int max, int value, StringView text, Orientation orientation)
|
2019-08-14 15:31:46 -03:00
|
|
|
{
|
2021-04-13 11:18:20 -03:00
|
|
|
current().paint_progressbar(painter, rect, palette, min, max, value, text, orientation);
|
2020-01-08 16:29:12 -03:00
|
|
|
}
|
|
|
|
|
|
2022-04-01 14:58:27 -03:00
|
|
|
void StylePainter::paint_radio_button(Painter& painter, IntRect const& rect, Palette const& palette, bool is_checked, bool is_being_pressed)
|
2020-01-08 16:29:12 -03:00
|
|
|
{
|
2020-08-12 06:54:17 -03:00
|
|
|
current().paint_radio_button(painter, rect, palette, is_checked, is_being_pressed);
|
2020-01-08 16:29:12 -03:00
|
|
|
}
|
2020-02-06 07:56:38 -03:00
|
|
|
|
2022-04-01 14:58:27 -03:00
|
|
|
void StylePainter::paint_check_box(Painter& painter, IntRect const& rect, Palette const& palette, bool is_enabled, bool is_checked, bool is_being_pressed)
|
2020-09-11 12:21:53 -03:00
|
|
|
{
|
|
|
|
|
current().paint_check_box(painter, rect, palette, is_enabled, is_checked, is_being_pressed);
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-01 14:58:27 -03:00
|
|
|
void StylePainter::paint_transparency_grid(Painter& painter, IntRect const& rect, Palette const& palette)
|
2020-09-25 11:33:12 -03:00
|
|
|
{
|
|
|
|
|
current().paint_transparency_grid(painter, rect, palette);
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-27 07:59:58 -03:00
|
|
|
void StylePainter::paint_simple_rect_shadow(Painter& painter, IntRect const& rect, Bitmap const& shadow_bitmap, bool shadow_includes_frame, bool fill_content)
|
|
|
|
|
{
|
|
|
|
|
current().paint_simple_rect_shadow(painter, rect, shadow_bitmap, shadow_includes_frame, fill_content);
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-06 07:56:38 -03:00
|
|
|
}
|