Loading...
Searching...
No Matches
ControlTheme.h
Go to the documentation of this file.
1//
2// ControlTheme.h
3//
4
5#ifndef MALENA_CONTROLTHEME_H
6#define MALENA_CONTROLTHEME_H
7
8#pragma once
9
13
14namespace ml
15{
16 // ── ControlTheme ──────────────────────────────────────────────────────────
17
29 {
36 sf::Color mutedColor = sf::Color(120, 120, 120);
37 float padding = 8.f;
38
40 unsigned int fontSize = 14;
41 unsigned int fontSizeSmall = 11;
42
43 // ── applyFrom ─────────────────────────────────────────────────────────
44
45 ControlTheme& applyFrom(const Theme& t) override
46 {
50 errorColor = t.error;
54 mutedColor = t.muted;
55 padding = t.spacing;
56 font = t.font ? t.font : &FontManager<>::getDefault(); // ← guard
59 return *this;
60 }
61
62 // ── Assignment from parent ────────────────────────────────────────────
63
65 {
66 static_cast<GraphicTheme&>(*this) = g;
67 return *this;
68 }
69
70 // ── Getters / setters ─────────────────────────────────────────────────
71
72 [[nodiscard]] sf::Color getHoverColor() const { return hoverColor; }
73 [[nodiscard]] sf::Color getFocusColor() const { return focusColor; }
74 [[nodiscard]] sf::Color getErrorColor() const { return errorColor; }
75 [[nodiscard]] sf::Color getDisabledColor() const { return disabledColor; }
76 [[nodiscard]] sf::Color getDisabledTextColor() const { return disabledTextColor; }
77 [[nodiscard]] sf::Color getTextColor() const { return textColor; }
78 [[nodiscard]] sf::Color getMutedColor() const { return mutedColor; }
79 [[nodiscard]] float getPadding() const { return padding; }
80 [[nodiscard]] const sf::Font* getFont() const { return font; }
81 [[nodiscard]] unsigned int getFontSize() const { return fontSize; }
82 [[nodiscard]] unsigned int getFontSizeSmall() const { return fontSizeSmall; }
83
84 void setHoverColor(const sf::Color& c) { hoverColor = c; }
85 void setFocusColor(const sf::Color& c) { focusColor = c; }
86 void setErrorColor(const sf::Color& c) { errorColor = c; }
89 void setTextColor(const sf::Color& c) { textColor = c; }
90 void setMutedColor(const sf::Color& c) { mutedColor = c; }
91 void setPadding(float p) { padding = p; }
92 void setFont(const sf::Font& f) { font = &f; }
93 void setFont(const sf::Font&&) = delete;
94 void setFontSize(unsigned int s) { fontSize = s; }
95 void setFontSizeSmall(unsigned int s) { fontSizeSmall = s; }
96 };
97
98} // namespace ml
99
100#endif // MALENA_CONTROLTHEME_H
static const sf::Font & getDefault()
Return the built-in Arial font.
static const Color White
Definition Component.h:22
Theme tokens for interactive UI controls.
unsigned int getFontSizeSmall() const
ControlTheme & operator=(const GraphicTheme &g)
unsigned int fontSize
void setTextColor(const sf::Color &c)
void setHoverColor(const sf::Color &c)
void setFocusColor(const sf::Color &c)
sf::Color disabledColor
sf::Color getDisabledColor() const
sf::Color hoverColor
sf::Color focusColor
sf::Color getHoverColor() const
unsigned int fontSizeSmall
sf::Color getFocusColor() const
void setFont(const sf::Font &f)
sf::Color getErrorColor() const
sf::Color mutedColor
sf::Color getDisabledTextColor() const
sf::Color errorColor
void setFontSize(unsigned int s)
sf::Color getMutedColor() const
const sf::Font * getFont() const
void setDisabledTextColor(const sf::Color &c)
void setFont(const sf::Font &&)=delete
void setPadding(float p)
float getPadding() const
void setDisabledColor(const sf::Color &c)
sf::Color getTextColor() const
ControlTheme & applyFrom(const Theme &t) override
Populate all fields from the global Theme token set.
void setMutedColor(const sf::Color &c)
const sf::Font * font
void setFontSizeSmall(unsigned int s)
sf::Color textColor
unsigned int getFontSize() const
sf::Color disabledTextColor
void setErrorColor(const sf::Color &c)
Theme tokens for all visual components.
virtual GraphicTheme & applyFrom(const Theme &t)
Populate all fields from the global Theme token set.
Universal design token set applied across all Themeable components.
Definition Theme.h:70
float spacing
Definition Theme.h:135
unsigned int fontSize
Definition Theme.h:121
sf::Color error
Definition Theme.h:104
const sf::Font * font
Definition Theme.h:118
unsigned int fontSizeSmall
Definition Theme.h:124
sf::Color onSurface
Definition Theme.h:86
sf::Color disabled
Definition Theme.h:110
sf::Color muted
Definition Theme.h:95
sf::Color onDisabled
Definition Theme.h:113
sf::Color borderFocus
Definition Theme.h:101
sf::Color secondary
Definition Theme.h:77