TachyonUI 1.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
gui_style.h
Go to the documentation of this file.
1// GUI Style System: defines the visual and layout properties of elements.
2//
3// Styles follow a CSS-like box model with margin, padding, and border.
4// Each element can have layout styles (sizing, positioning, flex/grid properties)
5// and visual styles (colors, gradients, borders, text styling) that vary by
6// element state (hover, active, focused, selected, disabled).
7//
8// Styles are defined in .css theme files and managed by StyleManager/StyleSheet.
9
10#pragma once
11
13#include <gui_core/gui_hash.h>
18
19#include <algorithm>
20
21namespace tachyon
22{
25
26 class GradientManager;
27 struct GradientHandle;
28
29 // ------------------------------------------------------------------------
30 // Style Indices
31 // ------------------------------------------------------------------------
33 enum class VisualColorStyleIndex : uint16_t { Invalid = 0 };
34
35
36 // ------------------------------------------------------------------------
37 // Element State
38 // ------------------------------------------------------------------------
39
41 enum class ElementState : uint8_t
42 {
43 None = 0,
44 Active = 1 << 0,
45 Hover = 1 << 1,
46 Focused = 1 << 2,
47 Selected = 1 << 3,
48 Selection = 1 << 4,
49 Disabled = 1 << 5,
52 Invalid = 1 << 6,
53
55 };
57
58 // ------------------------------------------------------------------------
59 // Box Model Types
60 // ------------------------------------------------------------------------
61
62
63 struct BoxEdges
64 {
65 uint16_t top = 0;
66 uint16_t right = 0;
67 uint16_t bottom = 0;
68 uint16_t left = 0;
69
70 constexpr BoxEdges() = default;
72 constexpr BoxEdges(uint16_t all) : top(all), right(all), bottom(all), left(all) {}
74 constexpr BoxEdges(uint16_t vertical, uint16_t horizontal)
75 : top(vertical), right(horizontal), bottom(vertical), left(horizontal) {}
76
77 constexpr BoxEdges(uint16_t t, uint16_t r, uint16_t b, uint16_t l)
78 : top(t), right(r), bottom(b), left(l) {}
79
80 constexpr uint16_t Horizontal() const { return left + right; }
81 constexpr uint16_t Vertical() const { return top + bottom; }
83 constexpr bool IsZero() const { return top == 0 && right == 0 && bottom == 0 && left == 0; }
84
85 bool operator==(const BoxEdges&) const noexcept = default;
86 };
87
90 {
91 uint16_t topLeft = 0;
92 uint16_t topRight = 0;
93 uint16_t bottomRight = 0;
94 uint16_t bottomLeft = 0;
95
96 constexpr BoxCorners() = default;
98 constexpr BoxCorners(uint16_t all)
99 : topLeft(all), topRight(all), bottomRight(all), bottomLeft(all) {}
100
101 constexpr BoxCorners(uint16_t tl, uint16_t tr, uint16_t br, uint16_t bl)
102 : topLeft(tl), topRight(tr), bottomRight(br), bottomLeft(bl) {}
103
105 constexpr bool IsZero() const
106 {
107 return topLeft == 0 && topRight == 0 && bottomRight == 0 && bottomLeft == 0;
108 }
109
110 bool operator==(const BoxCorners&) const noexcept = default;
111 };
112
114 inline constexpr int kMaxBoxShadows = 2;
116 inline constexpr int kMaxTextShadows = kMaxBoxShadows;
117
121 {
122 int16_t x = 0;
123 int16_t y = 0;
124 uint16_t blur = 0;
125 int16_t spread = 0;
127 bool inset = false;
128
130 constexpr bool IsNone() const { return color.a == 0; }
131 bool operator==(const BoxShadow&) const noexcept = default;
132 };
133
136 {
138 static constexpr int16_t kAuto = std::numeric_limits<int16_t>::min();
139
140 int16_t top = kAuto;
141 int16_t right = kAuto;
142 int16_t bottom = kAuto;
143 int16_t left = kAuto;
144
145 constexpr EdgeInset() = default;
147 constexpr EdgeInset(int16_t all) : top(all), right(all), bottom(all), left(all) {}
149 constexpr EdgeInset(int16_t vertical, int16_t horizontal)
150 : top(vertical), right(horizontal), bottom(vertical), left(horizontal) {}
151
152 constexpr EdgeInset(int16_t t, int16_t r, int16_t b, int16_t l)
153 : top(t), right(r), bottom(b), left(l) {}
154
155 bool operator==(const EdgeInset&) const noexcept = default;
156 };
157
158 // ------------------------------------------------------------------------
159 // Layout Properties
160 // ------------------------------------------------------------------------
161
170
172 enum class FlexWrap : uint8_t
173 {
177 };
178
180 enum class AlignItems : uint8_t
181 {
187 };
188
199
212
223
225 enum class Display : uint8_t
226 {
230 };
231
233 enum class Overflow : uint8_t
234 {
238 };
239
241 enum class Visibility : uint8_t
242 {
245 };
246
248 enum class IconSide : uint8_t
249 {
250 None = 0,
251
256 };
257
261 enum class AnchorPlacement : uint8_t
262 {
263 None = 0,
264
265 // Horizontal
266 OutsideLeft = (1 << 0),
267 CenterLeft = (2 << 0),
268 InsideLeft = (3 << 0),
269 CenterHorz = (4 << 0),
270 InsideRight = (5 << 0),
271 CenterRight = (6 << 0),
272 OutsideRight = (7 << 0),
273
274 HorizontalMask = (0xF << 0),
275
276 // Vertical
277 OutsideTop = (1 << 4),
278 CenterTop = (2 << 4),
279 InsideTop = (3 << 4),
280 CenterVert = (4 << 4),
281 InsideBottom = (5 << 4),
282 CenterBottom = (6 << 4),
283 OutsideBottom = (7 << 4),
284
285 VerticalMask = (0xF << 4),
286
287 // Common combinations
289
294
299 };
301
303 enum class AnchorPlacementAxis : uint8_t
304 {
305 None = 0,
309 Center = 4,
313 };
314
329
331 constexpr AnchorPlacementAxis GetHorizontalAxis(AnchorPlacement p) { return (AnchorPlacementAxis)((uint8_t)p & 0x0F); }
333 constexpr AnchorPlacementAxis GetVerticalAxis(AnchorPlacement p) { return (AnchorPlacementAxis)(((uint8_t)p >> 4) & 0x0F); }
334
337 {
338 return (AnchorPlacement)((uint8_t)h | ((uint8_t)v << 4));
339 }
340
341
342 // ------------------------------------------------------------------------
343 // Flex Container Properties
344 // ------------------------------------------------------------------------
345
366
367 // ------------------------------------------------------------------------
368 // Grid Track Definition
369 // ------------------------------------------------------------------------
370
373 {
375 enum class Type : uint8_t
376 {
381 };
382
384 float value = 1.0f;
386 float minPx = 0.0f;
387
389 static constexpr GridTrack Auto() { return { .type = Type::Auto, .value = 1.0f }; }
391 static constexpr GridTrack Fixed(float value) { return { .type = Type::Fixed, .value = value }; }
393 static constexpr GridTrack Fractional(float value, float minPx = 0.0f)
394 { return { .type = Type::Fractional, .value = value, .minPx = minPx }; }
395
396 static constexpr GridTrack Default() { return { .type = Type::Default, .value = 0.0f }; }
397
398 bool operator==(const GridTrack& other) const noexcept = default;
399 };
400
401 // ------------------------------------------------------------------------
402 // Grid Container Properties
403 // ------------------------------------------------------------------------
404
407 {
408 static constexpr int16_t kAuto = -1;
409
413
416 static constexpr int16_t kMaxTracks = 1000;
417 int16_t start{ kAuto };
418 int16_t span{ 1 };
419 int16_t gap{ 0 };
420
421 bool operator==(const GridAxisProperties&) const noexcept = default;
422 };
423
438
439 // ------------------------------------------------------------------------
440 // Container for layout type specific properties
441 // ------------------------------------------------------------------------
442
445 {
448
449 static constexpr int32_t kAutoSize = -1;
450 static constexpr int32_t kUnboundedMax = std::numeric_limits<int32_t>::max();
451
452 int32_t width = kAutoSize;
453 int32_t height = kAutoSize;
454 int32_t minWidth = 0;
456 int32_t minHeight = 0;
458
459 bool operator==(const LayoutData&) const noexcept = default;
460 };
461
462 // ------------------------------------------------------------------------
463 // Break Behavior (CSS break-after: auto | always | avoid | left | right)
464 // ------------------------------------------------------------------------
465
467 enum class BreakBehavior : uint8_t
468 {
473 };
474
475 // ------------------------------------------------------------------------
476 // Mouse Cursor Types
477 // ------------------------------------------------------------------------
478
498
499 // ------------------------------------------------------------------------
500 // Color Styles
501 // ------------------------------------------------------------------------
502
521
522 class VisualColorStyle;
527 {
528 public:
529 static constexpr int16_t one = 15360;
530
532 short4 transformationX = { one, 0, 0, 0 };
533 short4 transformationY = { 0, one, 0, 0 };
535 short2 animSpeed = { 0, 0 };
539 uint16_t variable = 0;
540
546 void SetAnimSpeed(float x, float y = 0.0f);
550 color4b GetFirstColor() const noexcept
551 {
552 return gradient.stopCount != 0 ? gradient.stops[0].GetColor4b() : color4b{ 0, 0, 0, 0 };
553 }
554
560 ImageIndex textureIndex,
561 GradientHandle& outHandle,
562 std::span<const color4b> row = {}) const;
563
564
566 static ColorStyle Create(color4b color);
568 static ColorStyle Create(color4f color);
585 };
586
590 class alignas(16) VisualColorStyle
591 {
592 public:
593 static constexpr int16_t one = 15360;
594
595 short4 transformationX = { one, 0, 0, 0 };
596 short4 transformationY = { 0, one, 0, 0 };
597
600
603 uint16_t gradientPage = 0;
604
606
607 short2 animSpeed = { 0, 0 };
608
612 void SetAnimSpeed(float x, float y = 0.0f);
613
624
625 bool operator==(const VisualColorStyle& other) const noexcept
626 {
627 return transformationX == other.transformationX &&
628 transformationY == other.transformationY &&
629 textureIndex == other.textureIndex &&
630 colorUV == other.colorUV &&
631 gradientPage == other.gradientPage &&
632 type == other.type &&
633 animSpeed == other.animSpeed;
634 }
635
640 static VisualColorStyle Create(GradientManager& gradientManager, color4b color, GradientHandle& outHandle);
641 static VisualColorStyle Create(GradientManager& gradientManager, color4f color, GradientHandle& outHandle);
642 static VisualColorStyle Create(GradientManager& gradientManager, color4b color1, color4b color2, ColorType type, GradientHandle& outHandle);
643 static VisualColorStyle Create(GradientManager& gradientManager, color4f color1, color4f color2, ColorType type, GradientHandle& outHandle);
644 static VisualColorStyle Create(GradientManager& gradientManager, color4b color1, color4b color2, color4b color3, ColorType type, GradientHandle& outHandle);
645 static VisualColorStyle Create(GradientManager& gradientManager, color4f color1, color4f color2, color4f color3, ColorType type, GradientHandle& outHandle);
646 static VisualColorStyle Create(GradientManager& gradientManager, color4b color1, color4b color2, color4b color3, color4b color4, ColorType type, GradientHandle& outHandle);
647 static VisualColorStyle Create(GradientManager& gradientManager, color4f color1, color4f color2, color4f color3, color4f color4, ColorType type, GradientHandle& outHandle);
648 static VisualColorStyle Create(GradientManager& gradientManager, Gradient gradient, ColorType type, GradientHandle& outHandle);
650 };
651
652
653 // ------------------------------------------------------------------------
654 // Complete Style Definition
655 // ------------------------------------------------------------------------
656
658 enum class StateLayer : uint8_t
659 {
663 };
664
694
698 struct Style
699 {
700 static constexpr int16_t kAuto = -1;
701
705 static constexpr int kStateCount = int(ElementState::Disabled) + 1;
706
708 struct States
709 {
711
712 StyleState& operator[](ElementState state) { return slots[size_t(state)]; }
713 const StyleState& operator[](ElementState state) const { return slots[size_t(state)]; }
714 StyleState& operator[](int slot) { return slots[slot]; }
715 const StyleState& operator[](int slot) const { return slots[slot]; }
716
717 StyleState* begin() { return slots; }
719 const StyleState* begin() const { return slots; }
720 const StyleState* end() const { return slots + kStateCount; }
721 };
722
725
730 float borderDashSize = 0.0f;
731 float borderDashOffset = 0.0f;
739 uint8_t stateLayerHover = 8;
740 uint8_t stateLayerPressed = 14;
741
743
744 uint16_t iconTextGap = 0;
745 uint16_t iconSize = 0;
746 int16_t iconOffsetY = 0;
747
756 bool clampScroll : 1 = true;
757
759 constexpr void SetOverflow(Overflow o) noexcept { overflowX = o; overflowY = o; }
760
762 };
763
764
765 // ------------------------------------------------------------------------
766 // Optimized Runtime Styles
767 // ------------------------------------------------------------------------
768
772 {
773 static constexpr int16_t kAuto = -1;
774
778
781
782 uint16_t iconTextGap = 0;
783 uint16_t iconSize = 0;
784 int16_t iconOffsetY = 0;
785
786 // Display
794 bool clampScroll : 1 = true;
795
797
799 uint64_t GetHashCode() const noexcept
800 {
801 const auto& ld = layoutData;
803 ld.width, ld.height, ld.minWidth, ld.maxWidth, ld.minHeight, ld.maxHeight,
805 uint8_t(display), uint8_t(visibility), uint8_t(overflowX), uint8_t(overflowY),
807 }
808
809 bool operator==(const LayoutStyle &other) const noexcept = default;
810
812 constexpr bool IsInFlow() const
813 {
814 return display != Display::None &&
816 }
817
819 constexpr bool IsFlexContainer() const
820 {
821 return display == Display::Flex;
822 }
823
825 constexpr int16_t GetMinWidth() const
826 {
828 }
829
831 constexpr int16_t GetMinHeight() const
832 {
834 }
835
837 constexpr short2 GetMinSize() const
838 {
839 return { GetMinWidth(), GetMinHeight() };
840 }
841
844 {
845 return Inset(borderBox,
846 int32_t(borderWidths.left) + padding.left,
847 int32_t(borderWidths.top) + padding.top,
848 int32_t(borderWidths.right) + padding.right,
849 int32_t(borderWidths.bottom) + padding.bottom);
850 }
851
853 IntRect GetContentRect(const IntRect& outer) const
854 {
855 return Inset(outer,
857 int32_t(margin.top) + borderWidths.top + padding.top,
860 }
861
863 IntRect GetBorderRect(const IntRect& outer) const
864 {
865 return Inset(outer, margin.left, margin.top, margin.right, margin.bottom);
866 }
867
869 IntRect GetPaddingRect(const IntRect& outer) const
870 {
871 return Inset(outer,
872 int32_t(margin.left) + borderWidths.left,
873 int32_t(margin.top) + borderWidths.top,
874 int32_t(margin.right) + borderWidths.right,
875 int32_t(margin.bottom) + borderWidths.bottom);
876 }
877
880 static constexpr IntRect Inset(const IntRect& r, int32_t left, int32_t top, int32_t right, int32_t bottom)
881 {
882 return IntRect{ r.x + left, r.y + top, std::max(0, r.w - (left + right)), std::max(0, r.h - (top + bottom)) };
883 }
884
886 inline int32_t GetBorderBoxWidth() const noexcept
887 {
888 return (int32_t)(padding.Horizontal() + borderWidths.Horizontal());
889 }
890 };
891
894 {
895 int16_t x = 0;
896 int16_t y = 0;
897 uint16_t blur = 0;
898 int16_t spread = 0;
900
902 constexpr bool IsNone() const { return color == VisualColorStyleIndex::Invalid; }
903 bool operator==(const VisualShadow&) const noexcept = default;
904 };
905
910 {
913 uint32_t insetRing = 0;
914 uint32_t insetRingUnder = 0;
915 float opacity = -1.0f;
916
917 bool operator==(const VisualShadowStyle&) const noexcept = default;
918 };
919
922 struct alignas(16) VisualBoxStyle
923 {
926
933 uint16_t borderDashSize = 0;
934 uint16_t borderDashOffset = 0;
937 uint16_t shadowIndex = 0;
938 // Total: 32 bytes
939
954
955 bool operator==(const VisualBoxStyle& other) const noexcept
956 {
957 return borderWidths == other.borderWidths &&
958 borderRadius == other.borderRadius &&
959 borderColorIndex[0] == other.borderColorIndex[0] &&
960 borderColorIndex[1] == other.borderColorIndex[1] &&
961 borderColorIndex[2] == other.borderColorIndex[2] &&
962 borderColorIndex[3] == other.borderColorIndex[3] &&
963 backgroundColorIndex == other.backgroundColorIndex &&
964 borderDashSize == other.borderDashSize &&
965 borderDashOffset == other.borderDashOffset &&
966 shadowIndex == other.shadowIndex;
967 }
968 };
969
973 {
980 uint16_t iconTextGap = 0;
981 uint16_t iconSize = 0;
982 int16_t iconOffsetY = 0;
985
998
999 bool operator==(const VisualTextStyle& other) const noexcept
1000 {
1001 return textStyle == other.textStyle &&
1002 textColorIndex == other.textColorIndex &&
1003 iconColorIndex == other.iconColorIndex &&
1004 std::ranges::equal(decorationColorIndex, other.decorationColorIndex) &&
1005 iconTextGap == other.iconTextGap &&
1006 iconSize == other.iconSize &&
1007 iconOffsetY == other.iconOffsetY &&
1008 iconSide == other.iconSide &&
1009 std::ranges::equal(textShadows, other.textShadows);
1010 }
1011 };
1012
1013}
A fill: solid color, gradient or texture, as used for backgrounds, borders, text and icons.
Definition gui_style.h:527
uint16_t variable
The theme variable the fill came from, as numbered in StyleSheet::colorVariables (from 1); 0 for none...
Definition gui_style.h:539
VisualColorStyle ToVisualStyle(GradientManager &gradientManager, ImageIndex textureIndex, GradientHandle &outHandle, std::span< const color4b > row={}) const
Bakes the GPU-facing style and acquires its atlas slot.
void SetAnimSpeed(float x, float y=0.0f)
Scroll speed over time: x along the gradient (or texture U), y texture V.
static ColorStyle Create(color4b c0, color4b c1, color4b c2, color4b c3, ColorType type)
Four stops at 0, 0.25, 0.5 and 1.
float3x2 GetTransformation() const
The 2x3 gradient transform as floats.
short2 animSpeed
half floats, see SetAnimSpeed
Definition gui_style.h:535
static constexpr int16_t one
1.0 as a half float
Definition gui_style.h:529
static ColorStyle Create(color4f color)
A SolidColor style.
static ColorStyle Create(color4f c0, color4f c1, color4f c2, ColorType type)
Three stops at 0, 0.5 and 1.
static ColorStyle Create(color4b c0, color4b c1, ColorType type)
Two stops at 0 and 1.
static ColorStyle Create(color4f c0, color4f c1, ColorType type)
Two stops at 0 and 1.
void SetTransformation(float3 x, float3 y)
Sets the 2x3 transform applied to gradient coordinates, row by row.
color4b GetFirstColor() const noexcept
The first stop's color, which is all of a SolidColor; transparent without stops.
Definition gui_style.h:550
Gradient gradient
colors; SolidColor uses the first stop
Definition gui_style.h:531
short4 transformationY
second row of the 2x3 gradient transform (half floats)
Definition gui_style.h:533
static ColorStyle Create(color4f c0, color4f c1, color4f c2, color4f c3, ColorType type)
Four stops at 0, 0.25, 0.5 and 1.
static ColorStyle Create(color4b color)
A SolidColor style.
static ColorStyle Create(Gradient gradient, ColorType type)
Any gradient with any type.
ColorType type
how the fill is painted
Definition gui_style.h:534
static ColorStyle Create(color4b c0, color4b c1, color4b c2, ColorType type)
Three stops at 0, 0.5 and 1.
short4 transformationX
first row of the 2x3 gradient transform (half floats)
Definition gui_style.h:532
The atlas that the colors of color styles are baked into: pages of 2D textures, one row per gradient,...
Definition gui_gradient_manager.h:65
How a text block is laid out in its box; shared by all states of a Style.
Definition gui_style_text.h:190
uint64_t GetHashCode() const noexcept
What text is measured and laid out from: font, metrics and decoration lines.
Definition gui_style_text.h:260
uint64_t GetHashCode() const noexcept
GPU form of a ColorStyle, uploaded as is: the gradient is baked into an atlas slot that colorUV / gra...
Definition gui_style.h:591
static VisualColorStyle Create(GradientManager &gradientManager, color4b color1, color4b color2, color4b color3, ColorType type, GradientHandle &outHandle)
ImageIndex textureIndex
texture of the texture types
Definition gui_style.h:605
short2 animSpeed
half floats, see ColorStyle::SetAnimSpeed
Definition gui_style.h:607
static VisualColorStyle Create(GradientManager &gradientManager, color4b color1, color4b color2, ColorType type, GradientHandle &outHandle)
static VisualColorStyle Create(GradientManager &gradientManager, Gradient gradient, ColorType type, GradientHandle &outHandle)
uint64_t GetHashCode() const noexcept
Definition gui_style.h:614
static VisualColorStyle Create(GradientManager &gradientManager, color4b color, GradientHandle &outHandle)
void SetTransformation(float3 x, float3 y)
See ColorStyle::SetTransformation.
short4 transformationY
as ColorStyle, with the gradient angle applied
Definition gui_style.h:596
uint16_t gradientPage
Logical gradient atlas page (0..GradientManager::PageCount()-1) that colorUV is in; the renderer maps...
Definition gui_style.h:603
short4 transformationX
as ColorStyle, with the gradient angle applied
Definition gui_style.h:595
void SetAnimSpeed(float x, float y=0.0f)
See ColorStyle::SetAnimSpeed.
ushort2 colorUV
texel of the gradient in its atlas page
Definition gui_style.h:598
static VisualColorStyle Create(GradientManager &gradientManager, color4b color1, color4b color2, color4b color3, color4b color4, ColorType type, GradientHandle &outHandle)
static constexpr int16_t one
1.0 as a half float
Definition gui_style.h:593
static VisualColorStyle Create(GradientManager &gradientManager, color4f color1, color4f color2, color4f color3, color4f color4, ColorType type, GradientHandle &outHandle)
static VisualColorStyle Create(GradientManager &gradientManager, color4f color1, color4f color2, ColorType type, GradientHandle &outHandle)
static VisualColorStyle Create(GradientManager &gradientManager, color4f color1, color4f color2, color4f color3, ColorType type, GradientHandle &outHandle)
bool operator==(const VisualColorStyle &other) const noexcept
Definition gui_style.h:625
static VisualColorStyle Create(GradientManager &gradientManager, color4f color, GradientHandle &outHandle)
ColorType type
Definition gui_style.h:599
@ Always
every frame, as often as the display refreshes
Definition gui_redraw.h:16
@ None
Definition gui_element_flags.h:18
ImageIndex
Index of an image in the graphics context's image set, as the shaders sample it.
Definition gui_image.h:99
@ Invalid
Definition gui_image.h:99
@ Default
Definition gui_command_manager.h:26
@ Move
it's at screenPos
Definition gui_input_enums.h:67
@ Text
dropped: text, in data
Definition gui_input_enums.h:69
@ Right
Definition gui_input_enums.h:42
@ Left
Definition gui_input_enums.h:40
constexpr AnchorPlacementAxis GetVerticalAxis(AnchorPlacement p)
Vertical part of an AnchorPlacement.
Definition gui_style.h:333
JustifyContent
Main-axis distribution of items (CSS: justify-content; grids also justify-items).
Definition gui_style.h:191
BreakBehavior
Line breaks around an item in a wrapping flex container (CSS: break-after).
Definition gui_style.h:468
FlexDirection
Main axis of a flex container (CSS: flex-direction).
Definition gui_style.h:164
ColorType
How a ColorStyle paints a shape.
Definition gui_style.h:506
constexpr AnchorPlacementAxis GetHorizontalAxis(AnchorPlacement p)
Horizontal part of an AnchorPlacement.
Definition gui_style.h:331
MouseCursor
Mouse cursor shown over an element (CSS: cursor).
Definition gui_style.h:481
constexpr AnchorPlacement MakeAnchorPlacement(AnchorPlacementAxis h, AnchorPlacementAxis v)
Combines a horizontal and a vertical placement.
Definition gui_style.h:336
VisualColorStyleIndex
Index into StyleManager's color style pool; Invalid (0) draws nothing (transparent).
Definition gui_style.h:33
Display
How an element lays out its children (CSS: display).
Definition gui_style.h:226
TACHYON_ENUM_OPERATORS(AnchorPlacement)
AnchorPlacement
Where an anchored element sits relative to its target: one horizontal and one vertical AnchorPlacemen...
Definition gui_style.h:262
PositionType
How an element is positioned; modeled on CSS position, but set in code, not CSS.
Definition gui_style.h:215
StateLayer
How a style's hover and pressed backgrounds are made.
Definition gui_style.h:659
IconSide
Where an element's icon sits relative to its text (CSS: -tachyon-icon-side).
Definition gui_style.h:249
constexpr int kMaxBoxShadows
CSS box-shadow layers per state; the first is drawn on top.
Definition gui_style.h:114
constexpr int kMaxTextShadows
CSS text-shadow layers per state; the first is drawn on top.
Definition gui_style.h:116
FlexWrap
Whether flex items wrap onto more lines (CSS: flex-wrap).
Definition gui_style.h:173
AlignContent
Distributes cross-axis space between wrap lines (align-items aligns within a line).
Definition gui_style.h:203
constexpr AnchorPlacementAxis FlipAxis(AnchorPlacementAxis p)
Mirrors a placement: Min <-> Max; Center and None are unchanged.
Definition gui_style.h:316
ElementState
Interaction state bits of an element; they pick the Style::states variant it draws with.
Definition gui_style.h:42
Visibility
CSS: visibility.
Definition gui_style.h:242
Overflow
What happens to content larger than the box (CSS: overflow, overflow-x, overflow-y).
Definition gui_style.h:234
AnchorPlacementAxis
Anchor placement along one axis; the 4-bit value of one AnchorPlacement nibble.
Definition gui_style.h:304
AlignItems
Cross-axis alignment of items (CSS: align-items, align-self).
Definition gui_style.h:181
@ SpaceEvenly
Equal space between all items.
Definition gui_style.h:197
@ FlexStart
Pack to start.
Definition gui_style.h:192
@ SpaceAround
Space around items.
Definition gui_style.h:196
@ SpaceBetween
Space between items.
Definition gui_style.h:195
@ Auto
No forced breaks, no keep-with-next.
Definition gui_style.h:469
@ Before
Force a line break before this element (CSS: left).
Definition gui_style.h:471
@ Avoid
Prevent a line break between this and the next element (CSS: avoid).
Definition gui_style.h:472
@ Column
Vertical, top to bottom.
Definition gui_style.h:167
@ RowReverse
Horizontal, right to left.
Definition gui_style.h:166
@ ColumnReverse
Vertical, bottom to top.
Definition gui_style.h:168
@ Row
Horizontal, left to right.
Definition gui_style.h:165
@ RadialGradient
ramp by angle around the center (CSS: radial-gradient)
Definition gui_style.h:513
@ LinearGradient
ramp along an axis (CSS: linear-gradient)
Definition gui_style.h:510
@ SDFGradient
ramp by depth inside the shape: 0 on its edge, 1 at its deepest point (a box's middle,...
Definition gui_style.h:519
@ InterpolatedTriangle
three colors blended by vertex weights
Definition gui_style.h:514
@ SolidColor
the first stop's color
Definition gui_style.h:507
@ CircularAngularGradient
ramp by distance from the center
Definition gui_style.h:511
@ RepeatedTexture
Style::textureIndex tiled at its pixel size.
Definition gui_style.h:509
@ InterpolatedBox
four corner colors blended across the box
Definition gui_style.h:515
@ StretchedTexture
Style::textureIndex stretched over the box.
Definition gui_style.h:508
@ EllipsoidAngularGradient
ramp by distance from the center, relative to the box size
Definition gui_style.h:512
@ Crosshair
Crosshair for precision selection.
Definition gui_style.h:485
@ Wait
Wait/busy cursor.
Definition gui_style.h:484
@ EwResize
CSS ew-resize: bidirectional east-west arrow (left/right movement).
Definition gui_style.h:489
@ NsResize
CSS ns-resize: bidirectional north-south arrow (up/down movement).
Definition gui_style.h:490
@ Pointer
Pointing hand for clickable items.
Definition gui_style.h:486
@ Default
Default arrow cursor.
Definition gui_style.h:482
@ ColResize
CSS col-resize: edge of a column being moved (left/right).
Definition gui_style.h:487
@ NeswResize
CSS nesw-resize: diagonal (northeast-southwest).
Definition gui_style.h:492
@ RowResize
CSS row-resize: edge of a row being moved (up/down).
Definition gui_style.h:488
@ NwseResize
CSS nwse-resize: diagonal (northwest-southeast).
Definition gui_style.h:491
@ NotAllowed
CSS not-allowed.
Definition gui_style.h:494
@ Invalid
Definition gui_style.h:33
@ Flex
Flexbox container.
Definition gui_style.h:227
@ Grid
Grid container.
Definition gui_style.h:228
@ None
Not rendered, removed from layout.
Definition gui_style.h:229
@ OutsideTop
Definition gui_style.h:277
@ OutsideTopLeft
Definition gui_style.h:295
@ InsideTopLeft
Definition gui_style.h:290
@ InsideTopRight
Definition gui_style.h:291
@ InsideTop
Definition gui_style.h:279
@ CenterCenter
Definition gui_style.h:288
@ InsideBottomLeft
Definition gui_style.h:292
@ OutsideBottomRight
Definition gui_style.h:298
@ InsideRight
Definition gui_style.h:270
@ OutsideTopRight
Definition gui_style.h:296
@ OutsideBottom
Definition gui_style.h:283
@ OutsideLeft
Definition gui_style.h:266
@ InsideBottomRight
Definition gui_style.h:293
@ InsideBottom
Definition gui_style.h:281
@ InsideLeft
Definition gui_style.h:268
@ OutsideRight
Definition gui_style.h:272
@ CenterHorz
Definition gui_style.h:269
@ OutsideBottomLeft
Definition gui_style.h:297
@ CenterVert
Definition gui_style.h:280
@ Relative
in flow, offset from its natural position
Definition gui_style.h:216
@ Fixed
out of flow in overlay space; doesn't scroll with the parent
Definition gui_style.h:219
@ Absolute
out of flow in content space; scrolls with the parent
Definition gui_style.h:218
@ Anchored
placed relative to another element (AnchorPlacement)
Definition gui_style.h:217
@ Sticky
in flow like Relative, clamped to the parent's scroll viewport edge
Definition gui_style.h:221
@ Centered
centered in the parent
Definition gui_style.h:220
@ None
as the CSS gives them
Definition gui_style.h:660
@ Light
white over its background, as strong: brighter, whatever the text color
Definition gui_style.h:662
@ Content
the state's text color over its background: 8% hovered, 14% pressed (or the style's strengths)
Definition gui_style.h:661
@ Bottom
Definition gui_style.h:255
@ Left
Definition gui_style.h:252
@ Top
Definition gui_style.h:254
@ WrapReverse
Multi-line, reversed.
Definition gui_style.h:176
@ NoWrap
Single line.
Definition gui_style.h:174
@ Wrap
Multi-line.
Definition gui_style.h:175
@ FlexStart
Pack lines to start (default here; no stretching).
Definition gui_style.h:204
@ VisualMask
Definition gui_style.h:54
@ Active
being pressed or dragged (CSS: :active)
Definition gui_style.h:44
@ Selection
text-selection highlight; combines with Active, Hover, Focused, Selected
Definition gui_style.h:48
@ Selected
selected item (CSS: :selected)
Definition gui_style.h:47
@ Focused
has keyboard focus (CSS: :focus)
Definition gui_style.h:46
@ Disabled
exclusive: overrides every other visual bit
Definition gui_style.h:49
@ Hover
under the mouse (CSS: :hover)
Definition gui_style.h:45
@ Collapsed
Not rendered, removed from layout.
Definition gui_style.h:244
@ Visible
Rendered normally.
Definition gui_style.h:243
@ Auto
Content clipped, scrollbars shown when needed.
Definition gui_style.h:235
@ Hidden
Content clipped, no scrollbars.
Definition gui_style.h:236
@ Visible
Content not clipped.
Definition gui_style.h:237
@ OutsideMax
beyond the far edge (right / bottom)
Definition gui_style.h:312
@ OutsideMin
beyond the near edge (left / top)
Definition gui_style.h:306
@ CenterMax
centered on the far edge
Definition gui_style.h:311
@ InsideMin
inside, against the near edge
Definition gui_style.h:308
@ InsideMax
inside, against the far edge (right / bottom)
Definition gui_style.h:310
@ CenterMin
centered on the near edge
Definition gui_style.h:307
@ Auto
align-self only: inherit from container's align-items
Definition gui_style.h:182
@ Center
Center on cross axis.
Definition gui_style.h:185
@ FlexStart
Align to start of cross axis.
Definition gui_style.h:183
@ FlexEnd
Align to end of cross axis.
Definition gui_style.h:184
@ Stretch
Stretch to fill container.
Definition gui_style.h:186
#define TACHYON_ENUM_OPERATORS(EnumType)
Definition gui_enum_operators.h:8
uint64_t CalculateBytes(const void *data, size_t len)
FNV-1a hash of len bytes at data.
Definition gui_hash.h:41
uint64_t Calculate(std::string_view str)
FNV-1a hash of str; same result as CalculateConst.
Definition gui_hash.h:29
constexpr uint64_t Combine(uint64_t a, uint64_t b)
Order-dependent combine; repeated values don't cancel out.
Definition gui_hash.h:65
Definition gui_logging.h:24
Per-corner values (border radius).
Definition gui_style.h:90
constexpr bool IsZero() const
All corners are 0 (square).
Definition gui_style.h:105
uint16_t bottomLeft
Definition gui_style.h:94
constexpr BoxCorners()=default
constexpr BoxCorners(uint16_t all)
All four corners the same.
Definition gui_style.h:98
bool operator==(const BoxCorners &) const noexcept=default
constexpr BoxCorners(uint16_t tl, uint16_t tr, uint16_t br, uint16_t bl)
In CSS order: top-left, top-right, bottom-right, bottom-left.
Definition gui_style.h:101
uint16_t topLeft
Definition gui_style.h:91
uint16_t topRight
Definition gui_style.h:92
uint16_t bottomRight
Definition gui_style.h:93
Per-side values of the box model (margin, padding, border widths).
Definition gui_style.h:64
constexpr BoxEdges(uint16_t vertical, uint16_t horizontal)
Top/bottom and left/right, like the two-value CSS shorthand.
Definition gui_style.h:74
constexpr uint16_t Vertical() const
top + bottom
Definition gui_style.h:81
constexpr bool IsZero() const
All edges are 0.
Definition gui_style.h:83
constexpr BoxEdges(uint16_t t, uint16_t r, uint16_t b, uint16_t l)
In CSS order: top, right, bottom, left.
Definition gui_style.h:77
constexpr BoxEdges()=default
constexpr BoxEdges(uint16_t all)
All four edges the same.
Definition gui_style.h:72
uint16_t right
Definition gui_style.h:66
uint16_t bottom
Definition gui_style.h:67
constexpr uint16_t Horizontal() const
left + right
Definition gui_style.h:80
uint16_t top
Definition gui_style.h:65
uint16_t left
Definition gui_style.h:68
bool operator==(const BoxEdges &) const noexcept=default
One CSS box-shadow layer, outside the border box.
Definition gui_style.h:121
int16_t x
horizontal offset in CSS px
Definition gui_style.h:122
color4b color
transparent = no shadow
Definition gui_style.h:126
int16_t y
vertical offset in CSS px
Definition gui_style.h:123
int16_t spread
CSS px the shadow grows by (shrinks when negative).
Definition gui_style.h:125
bool inset
an outline inside the border box; :focus-visible only
Definition gui_style.h:127
uint16_t blur
blur radius in CSS px
Definition gui_style.h:124
bool operator==(const BoxShadow &) const noexcept=default
constexpr bool IsNone() const
Transparent: no shadow.
Definition gui_style.h:130
int16_t left
Definition gui_style.h:143
static constexpr int16_t kAuto
"Not set". Insets can be negative, so the sentinel is the lowest int16_t.
Definition gui_style.h:138
constexpr EdgeInset()=default
constexpr EdgeInset(int16_t t, int16_t r, int16_t b, int16_t l)
In CSS order: top, right, bottom, left.
Definition gui_style.h:152
constexpr EdgeInset(int16_t vertical, int16_t horizontal)
Top/bottom and left/right.
Definition gui_style.h:149
constexpr EdgeInset(int16_t all)
All four insets the same.
Definition gui_style.h:147
bool operator==(const EdgeInset &) const noexcept=default
int16_t right
Definition gui_style.h:141
int16_t top
Definition gui_style.h:140
int16_t bottom
Definition gui_style.h:142
Flexbox properties: the container's (direction, wrap, alignment, gap) and the item's own (grow,...
Definition gui_style.h:349
FlexWrap wrap
CSS: flex-wrap.
Definition gui_style.h:359
uint16_t flexShrink
CSS: flex-shrink (whole numbers).
Definition gui_style.h:353
static constexpr int16_t kAuto
flexBasis 'auto'
Definition gui_style.h:350
AlignContent alignContent
CSS: align-content.
Definition gui_style.h:362
FlexDirection direction
CSS: flex-direction.
Definition gui_style.h:358
uint16_t flexGrow
CSS: flex-grow (whole numbers).
Definition gui_style.h:352
bool operator==(const FlexProperties &) const noexcept=default
AlignItems alignItems
CSS: align-items.
Definition gui_style.h:360
int16_t flexBasis
CSS: flex-basis; kAuto = auto.
Definition gui_style.h:354
JustifyContent justifyContent
CSS: justify-content.
Definition gui_style.h:361
uint16_t gap
CSS: gap, between flex items.
Definition gui_style.h:356
Handle to a reference-counted GradientManager atlas slot.
Definition gui_gradient_manager.h:27
Up to kMaxStops color stops plus an angle and interpolation color space.
Definition gui_style_gradient.h:93
std::array< ColorStop, kMaxStops > stops
the first stopCount are in use
Definition gui_style_gradient.h:96
uint8_t stopCount
stops in use
Definition gui_style_gradient.h:98
A grid item's placement and track request along one axis, plus the container's gap.
Definition gui_style.h:407
static constexpr int16_t kMaxTracks
The most tracks a grid has along an axis: a start or span past it is clamped, so a stray number can't...
Definition gui_style.h:416
static constexpr int16_t kAuto
start: auto-place
Definition gui_style.h:408
int16_t start
first track the item covers; kAuto = auto-place
Definition gui_style.h:417
bool operator==(const GridAxisProperties &) const noexcept=default
GridTrack track
Size the item asks for its column / row; across the items in a track, Fixed beats Fractional beats Au...
Definition gui_style.h:412
int16_t gap
container: space between tracks (CSS: column-gap / row-gap)
Definition gui_style.h:419
int16_t span
tracks the item covers
Definition gui_style.h:418
Grid container and item properties.
Definition gui_style.h:426
bool operator==(const GridProperties &) const noexcept=default
GridAxisProperties column
CSS: grid-column, column-gap.
Definition gui_style.h:427
JustifyContent justifyItems
CSS: justify-items, when alignItemsSelf isn't Stretch.
Definition gui_style.h:432
JustifyContent justifyContent
CSS: justify-content.
Definition gui_style.h:430
AlignItems alignItemsSelf
Stretch: items fill their cell's width (CSS: justify-items: stretch).
Definition gui_style.h:434
GridAxisProperties row
CSS: grid-row, row-gap.
Definition gui_style.h:428
AlignItems alignItems
CSS: align-items.
Definition gui_style.h:431
Size of one grid column or row (CSS: -tachyon-grid-column-track / -row-track).
Definition gui_style.h:373
static constexpr GridTrack Auto()
Fits its content.
Definition gui_style.h:389
float value
Meaning depends on type: pixels for Fixed, fraction for Fractional.
Definition gui_style.h:384
static constexpr GridTrack Fixed(float value)
value pixels (CSS px in a Style).
Definition gui_style.h:391
static constexpr GridTrack Fractional(float value, float minPx=0.0f)
value fr of the free space, on top of max(minPx, content).
Definition gui_style.h:393
Type type
Definition gui_style.h:383
Type
How value is read.
Definition gui_style.h:376
@ Auto
fits content
Definition gui_style.h:379
@ Fixed
value is in pixels (e.g., 100.0f)
Definition gui_style.h:377
@ Default
defers to the element's style (only valid in LayoutOverride)
Definition gui_style.h:380
@ Fractional
fractional unit (e.g., 1.0f = 1fr)
Definition gui_style.h:378
static constexpr GridTrack Default()
Defers to the element's style (LayoutOverride only).
Definition gui_style.h:396
bool operator==(const GridTrack &other) const noexcept=default
float minPx
Fractional tracks only: size = max(minPx, content) + fractional share of free space.
Definition gui_style.h:386
Definition gui_base_types.h:406
Flex / grid properties and CSS sizes of a style. Sizes are in CSS px in a Style.
Definition gui_style.h:445
int32_t maxWidth
CSS: max-width.
Definition gui_style.h:455
static constexpr int32_t kAutoSize
width / height 'auto'
Definition gui_style.h:449
int32_t minWidth
CSS: min-width.
Definition gui_style.h:454
bool operator==(const LayoutData &) const noexcept=default
int32_t width
CSS: width.
Definition gui_style.h:452
int32_t minHeight
CSS: min-height.
Definition gui_style.h:456
int32_t maxHeight
CSS: max-height.
Definition gui_style.h:457
int32_t height
CSS: height.
Definition gui_style.h:453
static constexpr int32_t kUnboundedMax
no max-width / max-height
Definition gui_style.h:450
GridProperties grid
used when display is Grid (and by grid items)
Definition gui_style.h:447
FlexProperties flex
used when display is Flex (and by flex items)
Definition gui_style.h:446
The layout part of a registered Style, in pixels; shared by every style with the same values.
Definition gui_style.h:772
constexpr bool IsInFlow() const
Takes part in layout: not display: none and not collapsed.
Definition gui_style.h:812
IconSide iconSide
see Style::iconSide
Definition gui_style.h:791
bool operator==(const LayoutStyle &other) const noexcept=default
Overflow overflowX
see Style::overflowX
Definition gui_style.h:789
BoxEdges padding
pixels
Definition gui_style.h:776
IntRect GetPaddingBoxContentRect(const IntRect &borderBox) const
The content box of a border-box rect: borderBox minus border and padding.
Definition gui_style.h:843
int16_t iconOffsetY
vertical nudge of an icon-only element in pixels; positive = up
Definition gui_style.h:784
int32_t GetBorderBoxWidth() const noexcept
Horizontal padding plus border widths, in pixels.
Definition gui_style.h:886
uint64_t GetHashCode() const noexcept
Hash of a subset of the fields, for deduplication; operator== settles collisions.
Definition gui_style.h:799
LayoutData layoutData
flex, grid and size properties, in pixels
Definition gui_style.h:779
BoxEdges borderWidths
pixels
Definition gui_style.h:777
static constexpr int16_t kAuto
Definition gui_style.h:773
bool clampScroll
see Style::clampScroll
Definition gui_style.h:794
uint16_t iconTextGap
space between icon and text, pixels
Definition gui_style.h:782
IntRect GetBorderRect(const IntRect &outer) const
The border box of a margin-box rect: outer minus margin.
Definition gui_style.h:863
IntRect GetContentRect(const IntRect &outer) const
The content box of a margin-box rect: outer minus margin, border and padding.
Definition gui_style.h:853
constexpr short2 GetMinSize() const
GetMinWidth and GetMinHeight together.
Definition gui_style.h:837
TextLayoutStyle textLayoutStyle
see Style::textLayoutStyle
Definition gui_style.h:780
IntRect GetPaddingRect(const IntRect &outer) const
The padding box of a margin-box rect: outer minus margin and border.
Definition gui_style.h:869
Display display
see Style::display
Definition gui_style.h:787
AlignItems alignSelf
see Style::alignSelf
Definition gui_style.h:792
BreakBehavior breakBehavior
see Style::breakBehavior
Definition gui_style.h:793
MouseCursor cursor
see Style::cursor
Definition gui_style.h:796
constexpr int16_t GetMinWidth() const
Horizontal margin + border + padding: the narrowest the element can be.
Definition gui_style.h:825
uint16_t iconSize
icon size in pixels; 0 = its natural size
Definition gui_style.h:783
constexpr bool IsFlexContainer() const
display is Flex.
Definition gui_style.h:819
Visibility visibility
see Style::visibility
Definition gui_style.h:788
constexpr int16_t GetMinHeight() const
Vertical margin + border + padding: the shortest the element can be.
Definition gui_style.h:831
static constexpr IntRect Inset(const IntRect &r, int32_t left, int32_t top, int32_t right, int32_t bottom)
r shrunk by the given edges, never below an empty size.
Definition gui_style.h:880
BoxEdges margin
pixels
Definition gui_style.h:775
Overflow overflowY
see Style::overflowY
Definition gui_style.h:790
The visual properties of one element state (normal, :hover, :active, ...).
Definition gui_style.h:668
ColorStyle textColor
CSS: color; none = transparent.
Definition gui_style.h:673
ColorStyle borderColors[4]
[0]=top, [1]=right, [2]=bottom, [3]=left
Definition gui_style.h:672
ColorStyle decorationColors[4]
CSS: text-<under|bottom|over|through>line-color, in that order (see DecorationLine); none = the text ...
Definition gui_style.h:677
void SetBorderColor(const ColorStyle &c)
Sets all four border colors to c.
Definition gui_style.h:687
BoxShadow textShadow[kMaxTextShadows]
CSS: text-shadow, under the text, its decorations and its icon; the first is drawn on top.
Definition gui_style.h:681
void SetBorderColor(const ColorStyle &t, const ColorStyle &r, const ColorStyle &b, const ColorStyle &l)
Per-edge border colors, in CSS order.
Definition gui_style.h:689
ColorStyle backgroundColor
CSS: background.
Definition gui_style.h:671
ColorStyle iconColor
-tachyon-icon-color; none = the text color
Definition gui_style.h:674
BoxShadow boxShadow[kMaxBoxShadows]
CSS: box-shadow; the first is drawn on top.
Definition gui_style.h:678
TextStyle textStyle
font and text metrics
Definition gui_style.h:669
float opacity
CSS: opacity, 0 to 1: the element and everything in it drawn that much opaque.
Definition gui_style.h:684
A style's states, indexed by ElementState (or by slot number).
Definition gui_style.h:709
StyleState & operator[](ElementState state)
Definition gui_style.h:712
const StyleState * begin() const
Definition gui_style.h:719
StyleState & operator[](int slot)
Definition gui_style.h:714
const StyleState & operator[](ElementState state) const
Definition gui_style.h:713
StyleState * begin()
Definition gui_style.h:717
StyleState * end()
Definition gui_style.h:718
StyleState slots[kStateCount]
Definition gui_style.h:710
const StyleState & operator[](int slot) const
Definition gui_style.h:715
const StyleState * end() const
Definition gui_style.h:720
A complete style, as parsed from CSS or built in code: layout properties plus the visual properties o...
Definition gui_style.h:699
static constexpr int kStateCount
one per state slot
Definition gui_style.h:705
uint16_t iconTextGap
space between icon and text, CSS px
Definition gui_style.h:744
BoxCorners borderRadius
CSS px.
Definition gui_style.h:729
Display display
CSS: display.
Definition gui_style.h:749
BreakBehavior breakBehavior
CSS: break-after.
Definition gui_style.h:755
ImageIndex textureIndex
texture of the texture color types
Definition gui_style.h:748
uint8_t stateLayerPressed
one per state slot
Definition gui_style.h:740
BoxEdges margin
CSS px.
Definition gui_style.h:726
uint16_t iconSize
icon size in CSS px; 0 = its natural size
Definition gui_style.h:745
Overflow overflowY
CSS: overflow-y.
Definition gui_style.h:752
AlignItems alignSelf
CSS: align-self; Auto = the container's align-items.
Definition gui_style.h:754
TextLayoutStyle textLayoutStyle
shared by all states
Definition gui_style.h:724
float borderDashSize
dash length in CSS px; 0 = solid
Definition gui_style.h:730
Visibility visibility
CSS: visibility.
Definition gui_style.h:750
BoxShadow focusRingUnder
a second inset :focus-visible outline, under focusRing
Definition gui_style.h:733
StateLayer stateLayer
-tachyon-state-layer: Content makes the hovered and pressed backgrounds from the state's text color o...
Definition gui_style.h:736
BoxEdges borderWidths
CSS px.
Definition gui_style.h:728
static constexpr int16_t kAuto
Definition gui_style.h:700
bool clampScroll
clamp the scroll offset to the content; false = unbounded
Definition gui_style.h:756
MouseCursor cursor
CSS: cursor.
Definition gui_style.h:761
BoxEdges padding
CSS px.
Definition gui_style.h:727
int16_t iconOffsetY
vertical nudge of the icon in CSS px; positive = up
Definition gui_style.h:746
float borderDashOffset
offset into the dash pattern, CSS px
Definition gui_style.h:731
uint8_t stateLayerHover
How strong the state layer is hovered and pressed, in percent: -tachyon-state-layer: content 16% 28%.
Definition gui_style.h:739
LayoutData layoutData
flex, grid and size properties
Definition gui_style.h:742
Overflow overflowX
CSS: overflow-x.
Definition gui_style.h:751
States states
one per state slot
Definition gui_style.h:723
BoxShadow focusRing
:focus-visible box-shadow, over the state's shadows
Definition gui_style.h:732
IconSide iconSide
CSS: -tachyon-icon-side.
Definition gui_style.h:753
constexpr void SetOverflow(Overflow o) noexcept
CSS overflow shorthand: sets both axes.
Definition gui_style.h:759
The box part of one state of a registered Style, in pixels; uploaded to the GPU as is (32 bytes).
Definition gui_style.h:923
VisualColorStyleIndex borderColorIndex[4]
Per-edge border colors: [0]=top, [1]=right, [2]=bottom, [3]=left.
Definition gui_style.h:928
BoxEdges borderWidths
pixels
Definition gui_style.h:924
uint16_t borderDashOffset
offset into the dash pattern, pixels
Definition gui_style.h:934
uint64_t GetHashCode() const noexcept
Hash for deduplication.
Definition gui_style.h:941
uint16_t shadowIndex
1-based index of the state's VisualShadowStyle (shadows, opacity), 0 = none; read on the CPU only.
Definition gui_style.h:937
VisualColorStyleIndex backgroundColorIndex
background color
Definition gui_style.h:932
uint16_t borderDashSize
dash length in pixels; 0 = solid
Definition gui_style.h:933
BoxCorners borderRadius
pixels
Definition gui_style.h:925
bool operator==(const VisualBoxStyle &other) const noexcept
Definition gui_style.h:955
What a state draws on the CPU only: its shadows and its opacity.
Definition gui_style.h:910
VisualShadow ring
the focus ring (Style::focusRing)
Definition gui_style.h:912
uint32_t insetRingUnder
as insetRing, the second outline, drawn under it
Definition gui_style.h:914
VisualShadow layers[kMaxBoxShadows]
the state's box-shadow layers
Definition gui_style.h:911
uint32_t insetRing
1 + flat GPU index of the outline's box style, 0 = none
Definition gui_style.h:913
float opacity
StyleState::opacity; below 0 = not set.
Definition gui_style.h:915
bool operator==(const VisualShadowStyle &) const noexcept=default
A BoxShadow in pixels with its color registered. No color is no shadow.
Definition gui_style.h:894
constexpr bool IsNone() const
No color: no shadow.
Definition gui_style.h:902
VisualColorStyleIndex color
Definition gui_style.h:899
uint16_t blur
Definition gui_style.h:897
bool operator==(const VisualShadow &) const noexcept=default
int16_t y
Definition gui_style.h:896
int16_t x
see BoxShadow, in pixels
Definition gui_style.h:895
int16_t spread
Definition gui_style.h:898
The text part of one state of a registered Style, in pixels.
Definition gui_style.h:973
uint16_t iconSize
icon size in pixels; 0 = its natural size
Definition gui_style.h:981
VisualColorStyleIndex decorationColorIndex[4]
Per DecorationLine; the text color unless set.
Definition gui_style.h:978
bool operator==(const VisualTextStyle &other) const noexcept
Definition gui_style.h:999
VisualShadow textShadows[kMaxTextShadows]
see StyleState::textShadow
Definition gui_style.h:984
IconSide iconSide
see Style::iconSide
Definition gui_style.h:983
VisualColorStyleIndex iconColorIndex
the text color unless set
Definition gui_style.h:976
int16_t iconOffsetY
vertical nudge of the icon in pixels; positive = up
Definition gui_style.h:982
VisualColorStyleIndex textColorIndex
registered text color
Definition gui_style.h:975
TextStyle textStyle
in pixels
Definition gui_style.h:974
uint64_t GetHashCode() const noexcept
Definition gui_style.h:986
uint16_t iconTextGap
space between icon and text, pixels
Definition gui_style.h:980
Definition gui_base_types.h:383
byte a
Definition gui_base_types.h:384
Definition gui_base_types.h:394
Definition gui_base_types.h:149
2D affine transform matrix (2 rows x 3 columns): x' = r0.x*x + r0.y*y + r0.z y' = r1....
Definition gui_base_types.h:218
Definition gui_base_types.h:312
Definition gui_base_types.h:334
Definition gui_base_types.h:349