14PROMEKI_NAMESPACE_BEGIN
55 TuiStyle(
const Color &fg,
const Color &bg, uint8_t attrs = None)
56 : _fg(fg), _bg(bg), _attrs(attrs), _attrMask(0xFF) {}
65 uint8_t
attrs()
const {
return _attrs; }
106 s._attrMask = attrMask;
117 bool operator==(
const TuiStyle &o)
const {
118 return _fg == o._fg && _bg == o._bg && _attrs == o._attrs && _attrMask == o._attrMask;
120 bool operator!=(
const TuiStyle &o)
const {
return !(*
this == o); }
125 uint8_t _attrs = None;
126 uint8_t _attrMask = 0x00;
142 bool focused()
const {
return _focused; }
143 bool enabled()
const {
return _enabled; }
144 bool pressed()
const {
return _pressed; }
145 bool selected()
const {
return _selected; }
147 void setFocused(
bool v) { _focused = v; }
148 void setEnabled(
bool v) { _enabled = v; }
149 void setPressed(
bool v) { _pressed = v; }
150 void setSelected(
bool v) { _selected = v; }
153 bool _focused =
false;
154 bool _enabled =
true;
155 bool _pressed =
false;
156 bool _selected =
false;
Widget state bundle fed into palette lookups.
Definition style.h:138
Visual properties of a TUI cell (everything except the character).
Definition style.h:35
bool hasBackground() const
Returns true if the background color is defined (not ignored).
Definition style.h:92
void setBackground(const Color &color)
Sets the background color.
Definition style.h:74
uint8_t attrs() const
Returns the attribute flags.
Definition style.h:65
uint8_t attrMask() const
Returns the attribute mask (1 = defined, 0 = ignored).
Definition style.h:68
void setAttrs(uint8_t attrs)
Sets all attribute flags (marks all bits as defined).
Definition style.h:77
static TuiStyle fromBackground(const Color &bg)
Creates a background-only style (foreground ignored).
Definition style.h:111
bool hasForeground() const
Returns true if the foreground color is defined (not ignored).
Definition style.h:89
static TuiStyle fromForeground(const Color &fg, uint8_t attrs=None, uint8_t attrMask=0)
Creates a foreground-only style (background ignored).
Definition style.h:102
Color foreground() const
Returns the foreground color.
Definition style.h:59
Attr
Text attribute flags.
Definition style.h:40
void setAttrs(uint8_t attrs, uint8_t mask)
Sets attribute flags with an explicit mask.
Definition style.h:83
TuiStyle merged(const TuiStyle &below) const
Merges this style on top of another.
void setForeground(const Color &color)
Sets the foreground color.
Definition style.h:71
TuiStyle(const Color &fg, const Color &bg, uint8_t attrs=None)
Constructs with foreground, background, and attributes (all defined).
Definition style.h:55
TuiStyle()=default
Default constructor. All properties are ignored.
Color background() const
Returns the background color.
Definition style.h:62