From d0900228d064dde1d23cf0d7cbbda2ddbf739fcc Mon Sep 17 00:00:00 2001 From: Sarah Date: Wed, 12 Aug 2020 19:54:17 +1000 Subject: 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. --- Libraries/LibGfx/StylePainter.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'Libraries/LibGfx/StylePainter.h') 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); -- cgit v1.2.3