ladybird/Libraries/LibDraw/StylePainter.h
Andreas Kling a79bac428b LibGUI+LibDraw: Add "Palette" concept for scoped color theming
GApplication now has a palette. This palette contains all the system
theme colors by default, and is inherited by a new top-level GWidget.
New child widgets inherit their parents palette.

It is possible to override the GApplication palette, and the palette
of any GWidget.

The Palette object contains a bunch of colors, each corresponding to
a ColorRole. Each role has a convenience getter as well.

Each GWidget now has a background_role() and foreground_role(), which
are then looked up in their current palette when painting. This means
that you no longer alter the background color of a widget by setting
it directly, rather you alter either its background role, or the
widget's palette.
2019-12-24 21:27:16 +01:00

35 lines
1.1 KiB
C++

#pragma once
#include <LibDraw/Color.h>
class Painter;
class Palette;
class Rect;
enum class ButtonStyle {
Normal,
CoolBar
};
enum class FrameShadow {
Plain,
Raised,
Sunken
};
enum class FrameShape {
NoFrame,
Box,
Container,
Panel,
VerticalLine,
HorizontalLine
};
class StylePainter {
public:
static void paint_button(Painter&, const Rect&, const Palette&, ButtonStyle, bool pressed, bool hovered = false, bool checked = false, bool enabled = true);
static void paint_tab_button(Painter&, const Rect&, const Palette&, bool active, bool hovered, bool enabled);
static void paint_surface(Painter&, const Rect&, const Palette&, bool paint_vertical_lines = true, bool paint_top_line = true);
static void paint_frame(Painter&, const Rect&, const Palette&, FrameShape, FrameShadow, int thickness, bool skip_vertical_lines = false);
static void paint_window_frame(Painter&, const Rect&, const Palette&);
static void paint_progress_bar(Painter&, const Rect&, const Palette&, int min, int max, int value, const StringView& text = {});
};