![]() |
1.11 |
Customizable characteristics for drawing widgets. More...
#include <theme.h>

Public Types | |
| enum class | BorderFlag : uint32_t { top = detail::bit(0) , right = detail::bit(1) , bottom = detail::bit(2) , left = detail::bit(3) , drop_shadow = detail::bit(4) } |
| Border flags allow, when drawing a rectangle, control over what sides of the rectangle are drawn. More... | |
| using | BorderFlags = Flags< BorderFlag > |
| Border flags. | |
| enum class | FillFlag : uint32_t { solid = detail::bit(0) , blend = detail::bit(1) } |
| Fill flags are used to characterize how a widget's background and border should be drawn. More... | |
| using | FillFlags = Flags< FillFlag > |
| Fill flags. | |
Public Member Functions | |
| Theme () | |
| Theme (const Theme &)=default | |
| Theme (Theme &&) noexcept=default | |
| virtual | ~Theme () noexcept=default |
| virtual void | apply () |
| Apply the Theme. | |
| virtual DefaultDim | default_border () const |
| Get the default border width. | |
| virtual float | default_border_radius () const |
| Get the default border radius. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| Font & | font () |
| Get a reference to the theme Font. | |
| const Font & | font () const |
| Get a const reference to the theme Font. | |
| void | font (const Font &font) |
| Set the theme Font. | |
| EGT_NODISCARD const std::string & | name () const |
| Get the name of the Object. | |
| void | name (const std::string &name) |
| Set the name of the Object. | |
| Theme & | operator= (const Theme &)=default |
| Theme & | operator= (Theme &&) noexcept=default |
| Palette & | palette () |
| Get a reference to the theme Palette. | |
| const Palette & | palette () const |
| Get a const reference to the theme Palette. | |
| void | palette (const Palette &palette) |
| Set the theme palette. | |
Protected Member Functions | |
| Theme (const std::string &name) | |
| virtual void | init_draw () |
| Setup for initializing drawing. | |
| virtual void | init_font () |
| Setup for initializing the font. | |
| virtual void | init_palette () |
| Setup for initializing the palette. | |
| void | rounded_box (Painter &painter, const Rect &box, float border_radius) const |
| virtual void | rounded_box (Painter &painter, const RectF &box, float border_radius) const |
Protected Attributes | |
| Font | m_font |
| Default font instance used by the theme. | |
| std::string | m_name |
| A user defined name for the Object. | |
| Palette | m_palette |
| Palette instance used by the theme. | |
Customizable characteristics for drawing widgets.
Theme implements common characteristics of drawing widgets. This can be overloaded and supplied with different properties like Palette and Font to change how a Widget is rendered globally.
| using BorderFlags = Flags<BorderFlag> |
Border flags.
|
strong |
Border flags allow, when drawing a rectangle, control over what sides of the rectangle are drawn.
If no flags are specified, the default assumption is that all flags are drawn. The drop_shadow flag prevails over other flags. If it is set, top, right, bottom, and left flags are ignored.
| Enumerator | |
|---|---|
| top | |
| right | |
| bottom | |
| left | |
| drop_shadow | |
|
strong |
Fill flags are used to characterize how a widget's background and border should be drawn.
This is an optimization to control whether a solid fill is done, it's blended, or if nothing is set - nothing will be drawn.
| Enumerator | |
|---|---|
| solid | Overwrite and don't blend.
|
| blend | perform a blend |
| Theme | ( | ) |
|
virtualdefaultnoexcept |
|
explicitprotected |
|
inlinevirtual |
Apply the Theme.
Automatically called by global_theme() when setting a new theme.
|
inlinevirtual |
Get the default border width.
|
inlinevirtual |
Get the default border radius.
|
virtual |
Draw a box specifying the properties directly.
|
virtual |
Draw a box using properties directly from the widget.
|
virtual |
Draw a circle specifying the properties directly.
|
virtual |
Draw a circle using properties directly from the widget.
|
protectedvirtual |
|
protectedvirtual |
Setup for initializing the font.
Called by apply().
Reimplemented in CoconutTheme, and ShamrockTheme.
|
protectedvirtual |
Setup for initializing the palette.
Called by apply().
Reimplemented in CoconutTheme, LapisTheme, MidnightTheme, ShamrockTheme, SkyTheme, and UltraVioletTheme.
|
inline |
Get the name of the Object.
|
inline |
|
inline |
Set the theme palette.
|
protectedvirtual |
|
protected |
Default font instance used by the theme.
|
protected |
A user defined name for the Object.