14#include <egt/detail/enum.h>
15#include <egt/detail/meta.h>
18#include <egt/geometry.h>
19#include <egt/palette.h>
68 m_reset_list.push_back(func);
74 for (
auto& x : m_reset_list)
82 static std::vector<ResetFunction> m_reset_list;
125 m_drawable(widget, painter, rect);
162 solid = detail::bit(0),
164 blend = detail::bit(1),
181 top = detail::bit(0),
182 right = detail::bit(1),
184 left = detail::bit(3),
185 drop_shadow = detail::bit(4),
199 EGT_NODISCARD const std::
string& name()
const {
return m_name; }
209 void name(
const std::string& name) { m_name =
name; }
277 float border_radius = 0.0,
279 Image* background =
nullptr)
const;
328 explicit
Theme(const std::
string& name);
330 inline
void rounded_box(
Painter& painter, const
Rect& box,
float border_radius)
const
332 rounded_box(painter,
RectF(box.x(), box.y(), box.width(), box.height()), border_radius);
32 bit RGBA color.
Definition color.h:41
Drawable function object.
Definition theme.h:39
std::function< void(T &widget, Painter &painter, const Rect &rect)> DrawFunction
Definition of the draw function.
Definition theme.h:45
virtual void operator()(T &widget, Painter &painter, const Rect &rect)=0
Implementation of the actual draw function.
Keeps track of what's been changed with Drawer::draw() changes.
Definition theme.h:60
static void add(const ResetFunction &func)
Add a custom reset function.
Definition theme.h:66
std::function< void()> ResetFunction
Reset function type.
Definition theme.h:63
static void reset()
Execute reset functions.
Definition theme.h:72
Manager of the Drawable for each widget type.
Definition theme.h:104
static void draw(T &widget, Painter &painter, const Rect &rect)
Call the Drawable.
Definition theme.h:123
static void draw(typename Drawable< T >::DrawFunction d)
Set the default Drawable for all widgets of type T.
Definition theme.h:110
Manages a font and properties of a font.
Definition font.h:35
Raster image resource used for drawing or displaying.
Definition image.h:39
Drawing interface for 2D graphics.
Definition painter.h:45
Color palette that contains a 2 dimensional array of colors.
Definition palette.h:40
ColorId
The Pattern identifier in the Palette.
Definition palette.h:239
A Pattern which can store one or more colors at different offsets (steps) which can be used to create...
Definition pattern.h:55
Customizable characteristics for drawing widgets.
Definition theme.h:146
virtual void draw_box(Painter &painter, const FillFlags &type, const Rect &rect, const Pattern &border, const Pattern &bg, DefaultDim border_width=0, DefaultDim margin_width=0, float border_radius=0.0, const BorderFlags &border_flags={}, Image *background=nullptr) const
Draw a box specifying the properties directly.
Flags< BorderFlag > BorderFlags
Border flags.
Definition theme.h:189
void font(const Font &font)
Set the theme Font.
Definition theme.h:254
virtual void draw_circle(Painter &painter, const Widget &widget, Palette::ColorId bg, Palette::ColorId border) const
Draw a circle using properties directly from the widget.
Theme(const Theme &)=default
virtual ~Theme() noexcept=default
const Palette & palette() const
Get a const reference to the theme Palette.
Definition theme.h:222
Palette & palette()
Get a reference to the theme Palette.
Definition theme.h:214
virtual void apply()
Apply the Theme.
Definition theme.h:317
virtual void init_draw()
Setup for initializing drawing.
void palette(const Palette &palette)
Set the theme palette.
Definition theme.h:230
virtual void draw_box(Painter &painter, const Widget &widget, Palette::ColorId bg, Palette::ColorId border) const
Draw a box using properties directly from the widget.
const Font & font() const
Get a const reference to the theme Font.
Definition theme.h:246
Palette m_palette
Palette instance used by the theme.
Definition theme.h:338
FillFlag
Fill flags are used to characterize how a widget's background and border should be drawn.
Definition theme.h:157
virtual void init_palette()
Setup for initializing the palette.
BorderFlag
Border flags allow, when drawing a rectangle, control over what sides of the rectangle are drawn.
Definition theme.h:180
Theme(Theme &&) noexcept=default
virtual float default_border_radius() const
Get the default border radius.
Definition theme.h:307
Font m_font
Default font instance used by the theme.
Definition theme.h:344
Font & font()
Get a reference to the theme Font.
Definition theme.h:238
void name(const std::string &name)
Set the name of the Object.
Definition theme.h:209
virtual DefaultDim default_border() const
Get the default border width.
Definition theme.h:301
virtual void rounded_box(Painter &painter, const RectF &box, float border_radius) const
virtual void draw_circle(Painter &painter, const FillFlags &type, const Rect &rect, const Pattern &border, const Pattern &bg, DefaultDim border_width=0, DefaultDim margin_width=0) const
Draw a circle specifying the properties directly.
std::string m_name
A user defined name for the Object.
Definition theme.h:341
virtual void init_font()
Setup for initializing the font.
Theme & operator=(const Theme &)=default
T & top(T &widget)
Helper to set alignment of a widget.
Definition widgetflags.h:494
T & right(T &widget)
Helper to set alignment of a widget.
Definition widgetflags.h:468
T & left(T &widget)
Helper to set alignment of a widget.
Definition widgetflags.h:442
EGT_API Theme & global_theme()
Get the global theme.
T & bottom(T &widget)
Helper to set alignment of a widget.
Definition widgetflags.h:520
Theme::BorderFlags operator|(Theme::BorderFlag lhs, Theme::BorderFlag rhs)
BorderFlags operator.
Definition theme.h:369
int DefaultDim
Define the default dimension type used for geometry.
Definition geometry.h:34
EGT framework namespace.
Definition animation.h:24
When using enum_to_string() and enum_from_string(), this type needs to be defined and specialized to ...
Definition enum.h:48