2020-01-18 09:38:21 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
|
2019-03-28 17:32:38 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
2020-02-16 08:31:14 +01:00
|
|
|
#include <AK/Forward.h>
|
2022-05-17 20:47:35 +10:00
|
|
|
#include <LibGUI/TabWidget.h>
|
2020-02-16 08:31:14 +01:00
|
|
|
#include <LibGfx/Forward.h>
|
2021-09-16 21:07:58 +02:00
|
|
|
#include <LibGfx/Orientation.h>
|
2019-07-27 11:15:20 +02:00
|
|
|
|
2020-02-06 11:56:38 +01:00
|
|
|
namespace Gfx {
|
|
|
|
|
|
2019-06-07 17:13:23 +02:00
|
|
|
enum class ButtonStyle {
|
2019-06-07 11:46:55 +02:00
|
|
|
Normal,
|
2021-08-30 23:29:29 +02:00
|
|
|
ThickCap,
|
2021-04-13 16:18:20 +02:00
|
|
|
Coolbar,
|
2021-04-09 21:17:11 +02:00
|
|
|
Tray,
|
2019-06-07 11:46:55 +02:00
|
|
|
};
|
2023-04-29 16:47:52 -04:00
|
|
|
|
|
|
|
|
enum class FrameStyle {
|
2019-06-07 11:46:55 +02:00
|
|
|
NoFrame,
|
2022-02-25 11:39:17 -05:00
|
|
|
Window,
|
2023-04-29 16:47:52 -04:00
|
|
|
Plain,
|
|
|
|
|
RaisedBox,
|
|
|
|
|
SunkenBox,
|
|
|
|
|
RaisedContainer,
|
|
|
|
|
SunkenContainer,
|
|
|
|
|
RaisedPanel,
|
|
|
|
|
SunkenPanel,
|
2019-06-07 11:46:55 +02:00
|
|
|
};
|
2019-03-28 17:32:38 +01:00
|
|
|
|
2020-08-12 19:54:17 +10:00
|
|
|
// FIXME: should this be in its own header?
|
|
|
|
|
class BaseStylePainter {
|
|
|
|
|
public:
|
2022-03-14 13:26:37 -06:00
|
|
|
virtual ~BaseStylePainter() = default;
|
2020-08-12 19:54:17 +10:00
|
|
|
|
2022-01-24 14:22:02 -05:00
|
|
|
virtual void paint_button(Painter&, IntRect const&, Palette const&, ButtonStyle, bool pressed, bool hovered = false, bool checked = false, bool enabled = true, bool focused = false, bool default_button = false) = 0;
|
2022-08-07 20:08:16 -04:00
|
|
|
virtual void paint_tab_button(Painter&, IntRect const&, Palette const&, bool active, bool hovered, bool enabled, GUI::TabWidget::TabPosition position, bool in_active_window, bool accented) = 0;
|
2023-04-29 16:47:52 -04:00
|
|
|
virtual void paint_frame(Painter&, IntRect const&, Palette const&, FrameStyle, bool skip_vertical_lines = false) = 0;
|
2021-10-27 11:52:53 +01:00
|
|
|
virtual void paint_window_frame(Painter&, IntRect const&, Palette const&) = 0;
|
2021-11-11 00:55:02 +01:00
|
|
|
virtual void paint_progressbar(Painter&, IntRect const&, Palette const&, int min, int max, int value, StringView text, Orientation = Orientation::Horizontal) = 0;
|
2021-10-27 11:52:53 +01:00
|
|
|
virtual void paint_radio_button(Painter&, IntRect const&, Palette const&, bool is_checked, bool is_being_pressed) = 0;
|
|
|
|
|
virtual void paint_check_box(Painter&, IntRect const&, Palette const&, bool is_enabled, bool is_checked, bool is_being_pressed) = 0;
|
|
|
|
|
virtual void paint_transparency_grid(Painter&, IntRect const&, Palette const&) = 0;
|
2021-10-27 11:59:58 +01:00
|
|
|
virtual void paint_simple_rect_shadow(Painter&, IntRect const&, Bitmap const& shadow_bitmap, bool shadow_includes_frame = false, bool fill_content = false) = 0;
|
2020-08-12 19:54:17 +10:00
|
|
|
|
|
|
|
|
protected:
|
2022-03-14 13:26:37 -06:00
|
|
|
BaseStylePainter() = default;
|
2020-08-12 19:54:17 +10:00
|
|
|
};
|
|
|
|
|
|
2019-03-28 17:32:38 +01:00
|
|
|
class StylePainter {
|
|
|
|
|
public:
|
2020-08-12 19:54:17 +10:00
|
|
|
static BaseStylePainter& current();
|
|
|
|
|
|
|
|
|
|
// FIXME: These are here for API compatibility, we should probably remove them and move BaseStylePainter into here
|
2022-01-24 14:22:02 -05:00
|
|
|
static void paint_button(Painter&, IntRect const&, Palette const&, ButtonStyle, bool pressed, bool hovered = false, bool checked = false, bool enabled = true, bool focused = false, bool default_button = false);
|
2022-08-07 20:08:16 -04:00
|
|
|
static void paint_tab_button(Painter&, IntRect const&, Palette const&, bool active, bool hovered, bool enabled, GUI::TabWidget::TabPosition position, bool in_active_window, bool accented);
|
2023-04-29 16:47:52 -04:00
|
|
|
static void paint_frame(Painter&, IntRect const&, Palette const&, FrameStyle, bool skip_vertical_lines = false);
|
2021-10-27 11:52:53 +01:00
|
|
|
static void paint_window_frame(Painter&, IntRect const&, Palette const&);
|
2021-11-11 00:55:02 +01:00
|
|
|
static void paint_progressbar(Painter&, IntRect const&, Palette const&, int min, int max, int value, StringView text, Orientation = Orientation::Horizontal);
|
2021-10-27 11:52:53 +01:00
|
|
|
static void paint_radio_button(Painter&, IntRect const&, Palette const&, bool is_checked, bool is_being_pressed);
|
|
|
|
|
static void paint_check_box(Painter&, IntRect const&, Palette const&, bool is_enabled, bool is_checked, bool is_being_pressed);
|
|
|
|
|
static void paint_transparency_grid(Painter&, IntRect const&, Palette const&);
|
2021-10-27 11:59:58 +01:00
|
|
|
static void paint_simple_rect_shadow(Painter&, IntRect const&, Bitmap const& shadow_bitmap, bool shadow_includes_frame = false, bool fill_content = false);
|
2019-03-28 17:32:38 +01:00
|
|
|
};
|
2020-02-06 11:56:38 +01:00
|
|
|
|
|
|
|
|
}
|