summaryrefslogtreecommitdiff
path: root/Libraries/LibGfx/StylePainter.h
diff options
context:
space:
mode:
authorSarah <metalflakecobaltpaint@gmail.com>2020-08-12 19:54:17 +1000
committerAndreas Kling <kling@serenityos.org>2020-08-17 00:00:34 +0200
commitd0900228d064dde1d23cf0d7cbbda2ddbf739fcc (patch)
tree142dfb9731029cff616d0bcf553a0332565e2df5 /Libraries/LibGfx/StylePainter.h
parent868bd2e43d0322b6e0d4536c4e7dea721c559f8d (diff)
downloadserenity-d0900228d064dde1d23cf0d7cbbda2ddbf739fcc.zip
LibGfx: Add abstract StylePainter class
StylePainter's behavior is now handled by a static instance of BaseStylePainter. The original static behavior of StylePainter is left as-is for API compatibility.
Diffstat (limited to 'Libraries/LibGfx/StylePainter.h')
-rw-r--r--Libraries/LibGfx/StylePainter.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/Libraries/LibGfx/StylePainter.h b/Libraries/LibGfx/StylePainter.h
index a684dd8566..56391a1150 100644
--- a/Libraries/LibGfx/StylePainter.h
+++ b/Libraries/LibGfx/StylePainter.h
@@ -49,8 +49,28 @@ enum class FrameShape {
HorizontalLine
};
+// FIXME: should this be in its own header?
+class BaseStylePainter {
+public:
+ virtual ~BaseStylePainter() { }
+
+ virtual void paint_button(Painter&, const IntRect&, const Palette&, ButtonStyle, bool pressed, bool hovered = false, bool checked = false, bool enabled = true) = 0;
+ virtual void paint_tab_button(Painter&, const IntRect&, const Palette&, bool active, bool hovered, bool enabled) = 0;
+ virtual void paint_surface(Painter&, const IntRect&, const Palette&, bool paint_vertical_lines = true, bool paint_top_line = true) = 0;
+ virtual void paint_frame(Painter&, const IntRect&, const Palette&, FrameShape, FrameShadow, int thickness, bool skip_vertical_lines = false) = 0;
+ virtual void paint_window_frame(Painter&, const IntRect&, const Palette&) = 0;
+ virtual void paint_progress_bar(Painter&, const IntRect&, const Palette&, int min, int max, int value, const StringView& text) = 0;
+ virtual void paint_radio_button(Painter&, const IntRect&, const Palette&, bool is_checked, bool is_being_pressed) = 0;
+
+protected:
+ BaseStylePainter() { }
+};
+
class StylePainter {
public:
+ static BaseStylePainter& current();
+
+ // FIXME: These are here for API compatibility, we should probably remove them and move BaseStylePainter into here
static void paint_button(Painter&, const IntRect&, const Palette&, ButtonStyle, bool pressed, bool hovered = false, bool checked = false, bool enabled = true);
static void paint_tab_button(Painter&, const IntRect&, const Palette&, bool active, bool hovered, bool enabled);
static void paint_surface(Painter&, const IntRect&, const Palette&, bool paint_vertical_lines = true, bool paint_top_line = true);