TachyonUI 0.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
414 int16_t start{ kAuto };
415 int16_t span{ 1 };
416 int16_t gap{ 0 };
417
418 bool operator==(const GridAxisProperties&) const noexcept = default;
419 };
420
435
436 // ------------------------------------------------------------------------
437 // Container for layout type specific properties
438 // ------------------------------------------------------------------------
439
442 {
445
446 static constexpr int32_t kAutoSize = -1;
447 static constexpr int32_t kUnboundedMax = std::numeric_limits<int32_t>::max();
448
449 int32_t width = kAutoSize;
450 int32_t height = kAutoSize;
451 int32_t minWidth = 0;
453 int32_t minHeight = 0;
455
456 bool operator==(const LayoutData&) const noexcept = default;
457 };
458
459 // ------------------------------------------------------------------------
460 // Break Behavior (CSS break-after: auto | always | avoid | left | right)
461 // ------------------------------------------------------------------------
462
464 enum class BreakBehavior : uint8_t
465 {
470 };
471
472 // ------------------------------------------------------------------------
473 // Mouse Cursor Types
474 // ------------------------------------------------------------------------
475
495
496 // ------------------------------------------------------------------------
497 // Color Styles
498 // ------------------------------------------------------------------------
499
518
519 class VisualColorStyle;
524 {
525 public:
526 static constexpr int16_t one = 15360;
527
529 short4 transformationX = { one, 0, 0, 0 };
530 short4 transformationY = { 0, one, 0, 0 };
532 short2 animSpeed = { 0, 0 };
533
537 void SetAnimSpeed(float x, float y = 0.0f);
541 color4b GetFirstColor() const noexcept
542 {
543 return gradient.stopCount != 0 ? gradient.stops[0].GetColor4b() : color4b{ 0, 0, 0, 0 };
544 }
545
550 ImageIndex textureIndex,
551 GradientHandle& outHandle) const;
552
553
555 static ColorStyle Create(color4b color);
557 static ColorStyle Create(color4f color);
574 };
575
579 class alignas(16) VisualColorStyle
580 {
581 public:
582 static constexpr int16_t one = 15360;
583
584 short4 transformationX = { one, 0, 0, 0 };
585 short4 transformationY = { 0, one, 0, 0 };
586
589
592 uint16_t gradientPage = 0;
593
595
596 short2 animSpeed = { 0, 0 };
597
601 void SetAnimSpeed(float x, float y = 0.0f);
602
613
614 bool operator==(const VisualColorStyle& other) const noexcept
615 {
616 return transformationX == other.transformationX &&
617 transformationY == other.transformationY &&
618 textureIndex == other.textureIndex &&
619 colorUV == other.colorUV &&
620 gradientPage == other.gradientPage &&
621 type == other.type &&
622 animSpeed == other.animSpeed;
623 }
624
629 static VisualColorStyle Create(GradientManager& gradientManager, color4b color, GradientHandle& outHandle);
630 static VisualColorStyle Create(GradientManager& gradientManager, color4f color, GradientHandle& outHandle);
631 static VisualColorStyle Create(GradientManager& gradientManager, color4b color1, color4b color2, ColorType type, GradientHandle& outHandle);
632 static VisualColorStyle Create(GradientManager& gradientManager, color4f color1, color4f color2, ColorType type, GradientHandle& outHandle);
633 static VisualColorStyle Create(GradientManager& gradientManager, color4b color1, color4b color2, color4b color3, ColorType type, GradientHandle& outHandle);
634 static VisualColorStyle Create(GradientManager& gradientManager, color4f color1, color4f color2, color4f color3, ColorType type, GradientHandle& outHandle);
635 static VisualColorStyle Create(GradientManager& gradientManager, color4b color1, color4b color2, color4b color3, color4b color4, ColorType type, GradientHandle& outHandle);
636 static VisualColorStyle Create(GradientManager& gradientManager, color4f color1, color4f color2, color4f color3, color4f color4, ColorType type, GradientHandle& outHandle);
637 static VisualColorStyle Create(GradientManager& gradientManager, Gradient gradient, ColorType type, GradientHandle& outHandle);
639 };
640
641
642 // ------------------------------------------------------------------------
643 // Complete Style Definition
644 // ------------------------------------------------------------------------
645
647 enum class StateLayer : uint8_t
648 {
651 };
652
682
686 struct Style
687 {
688 static constexpr int16_t kAuto = -1;
689
693 static constexpr int kStateCount = int(ElementState::Disabled) + 1;
694
696 struct States
697 {
699
700 StyleState& operator[](ElementState state) { return slots[size_t(state)]; }
701 const StyleState& operator[](ElementState state) const { return slots[size_t(state)]; }
702 StyleState& operator[](int slot) { return slots[slot]; }
703 const StyleState& operator[](int slot) const { return slots[slot]; }
704
705 StyleState* begin() { return slots; }
707 const StyleState* begin() const { return slots; }
708 const StyleState* end() const { return slots + kStateCount; }
709 };
710
713
718 float borderDashSize = 0.0f;
719 float borderDashOffset = 0.0f;
724
726
727 uint16_t iconTextGap = 0;
728 uint16_t iconSize = 0;
729 int16_t iconOffsetY = 0;
730
739 bool clampScroll : 1 = true;
740
742 constexpr void SetOverflow(Overflow o) noexcept { overflowX = o; overflowY = o; }
743
745 };
746
747
748 // ------------------------------------------------------------------------
749 // Optimized Runtime Styles
750 // ------------------------------------------------------------------------
751
755 {
756 static constexpr int16_t kAuto = -1;
757
761
764
765 uint16_t iconTextGap = 0;
766 uint16_t iconSize = 0;
767 int16_t iconOffsetY = 0;
768
769 // Display
777 bool clampScroll : 1 = true;
778
780
782 uint64_t GetHashCode() const noexcept
783 {
784 const auto& ld = layoutData;
786 ld.width, ld.height, ld.minWidth, ld.maxWidth, ld.minHeight, ld.maxHeight,
788 uint8_t(display), uint8_t(visibility), uint8_t(overflowX), uint8_t(overflowY),
790 }
791
792 bool operator==(const LayoutStyle &other) const noexcept = default;
793
795 constexpr bool IsInFlow() const
796 {
797 return display != Display::None &&
799 }
800
802 constexpr bool IsFlexContainer() const
803 {
804 return display == Display::Flex;
805 }
806
808 constexpr int16_t GetMinWidth() const
809 {
811 }
812
814 constexpr int16_t GetMinHeight() const
815 {
817 }
818
820 constexpr short2 GetMinSize() const
821 {
822 return { GetMinWidth(), GetMinHeight() };
823 }
824
827 {
828 int16_t left = borderWidths.left + padding.left;
829 int16_t right = borderWidths.right + padding.right;
830 int16_t top = borderWidths.top + padding.top;
831 int16_t bottom = borderWidths.bottom + padding.bottom;
832
833 int16_t w = std::max<int16_t>(0, static_cast<uint16_t>(borderBox.w - static_cast<uint32_t>(left + right)));
834 int16_t h = std::max<int16_t>(0, static_cast<uint16_t>(borderBox.h - static_cast<uint32_t>(top + bottom)));
835
836 return IntRect
837 {
838 int16_t(borderBox.x + left),
839 int16_t(borderBox.y + top),
840 w, h
841 };
842 }
843
845 IntRect GetContentRect(const IntRect& outer) const
846 {
847 int16_t left = margin.left + borderWidths.left + padding.left;
848 int16_t right = margin.right + borderWidths.right + padding.right;
849 int16_t top = margin.top + borderWidths.top + padding.top;
850 int16_t bottom = margin.bottom + borderWidths.bottom + padding.bottom;
851
852 int16_t w = std::max<int16_t>(0, static_cast<int16_t>(outer.w - static_cast<int32_t>(left + right)));
853 int16_t h = std::max<int16_t>(0, static_cast<int16_t>(outer.h - static_cast<int32_t>(top + bottom)));
854
855 return IntRect
856 {
857 int16_t(outer.x + left),
858 int16_t(outer.y + top),
859 w, h
860 };
861 }
862
864 IntRect GetBorderRect(const IntRect& outer) const
865 {
866 int16_t w = std::max<int16_t>(0, static_cast<int16_t>(outer.w - margin.Horizontal()));
867 int16_t h = std::max<int16_t>(0, static_cast<int16_t>(outer.h - margin.Vertical()));
868
869 return IntRect
870 {
871 int16_t(outer.x + margin.left),
872 int16_t(outer.y + margin.top),
873 w, h
874 };
875 }
876
878 IntRect GetPaddingRect(const IntRect& outer) const
879 {
880 int16_t l = margin.left + borderWidths.left;
881 int16_t r = margin.right + borderWidths.right;
882 int16_t t = margin.top + borderWidths.top;
883 int16_t b = margin.bottom + borderWidths.bottom;
884
885 int16_t w = std::max<int16_t>(0, static_cast<int16_t>(outer.w - static_cast<int32_t>(l + r)));
886 int16_t h = std::max<int16_t>(0, static_cast<int16_t>(outer.h - static_cast<int32_t>(t + b)));
887
888 return IntRect
889 {
890 int16_t(outer.x + l),
891 int16_t(outer.y + t),
892 w, h
893 };
894 }
895
897 inline int32_t GetBorderBoxWidth() const noexcept
898 {
899 return (int32_t)(padding.Horizontal() + borderWidths.Horizontal());
900 }
901 };
902
905 {
906 int16_t x = 0;
907 int16_t y = 0;
908 uint16_t blur = 0;
909 int16_t spread = 0;
911
913 constexpr bool IsNone() const { return color == VisualColorStyleIndex::Invalid; }
914 bool operator==(const VisualShadow&) const noexcept = default;
915 };
916
921 {
924 uint32_t insetRing = 0;
925 float opacity = -1.0f;
926
927 bool operator==(const VisualShadowStyle&) const noexcept = default;
928 };
929
932 struct alignas(16) VisualBoxStyle
933 {
936
943 uint16_t borderDashSize = 0;
944 uint16_t borderDashOffset = 0;
947 uint16_t shadowIndex = 0;
948 // Total: 32 bytes
949
964
965 bool operator==(const VisualBoxStyle& other) const noexcept
966 {
967 return borderWidths == other.borderWidths &&
968 borderRadius == other.borderRadius &&
969 borderColorIndex[0] == other.borderColorIndex[0] &&
970 borderColorIndex[1] == other.borderColorIndex[1] &&
971 borderColorIndex[2] == other.borderColorIndex[2] &&
972 borderColorIndex[3] == other.borderColorIndex[3] &&
973 backgroundColorIndex == other.backgroundColorIndex &&
974 borderDashSize == other.borderDashSize &&
975 borderDashOffset == other.borderDashOffset &&
976 shadowIndex == other.shadowIndex;
977 }
978 };
979
983 {
990 uint16_t iconTextGap = 0;
991 uint16_t iconSize = 0;
992 int16_t iconOffsetY = 0;
995
1008
1009 bool operator==(const VisualTextStyle& other) const noexcept
1010 {
1011 return textStyle == other.textStyle &&
1012 textColorIndex == other.textColorIndex &&
1013 iconColorIndex == other.iconColorIndex &&
1014 std::ranges::equal(decorationColorIndex, other.decorationColorIndex) &&
1015 iconTextGap == other.iconTextGap &&
1016 iconSize == other.iconSize &&
1017 iconOffsetY == other.iconOffsetY &&
1018 iconSide == other.iconSide &&
1019 std::ranges::equal(textShadows, other.textShadows);
1020 }
1021 };
1022
1023}
A fill: solid color, gradient or texture, as used for backgrounds, borders, text and icons.
Definition gui_style.h:524
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:532
static constexpr int16_t one
1.0 as a half float
Definition gui_style.h:526
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:541
Gradient gradient
colors; SolidColor uses the first stop
Definition gui_style.h:528
short4 transformationY
second row of the 2x3 gradient transform (half floats)
Definition gui_style.h:530
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:531
static ColorStyle Create(color4b c0, color4b c1, color4b c2, ColorType type)
Three stops at 0, 0.5 and 1.
VisualColorStyle ToVisualStyle(GradientManager &gradientManager, ImageIndex textureIndex, GradientHandle &outHandle) const
Bakes the GPU-facing style and acquires its atlas slot.
short4 transformationX
first row of the 2x3 gradient transform (half floats)
Definition gui_style.h:529
The atlas that the colors of color styles are baked into: pages of 2D textures, one row per gradient,...
Definition gui_gradient_manager.h:64
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:580
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:594
short2 animSpeed
half floats, see ColorStyle::SetAnimSpeed
Definition gui_style.h:596
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:603
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:585
uint16_t gradientPage
Logical gradient atlas page (0..GradientManager::PageCount()-1) that colorUV is in; the renderer maps...
Definition gui_style.h:592
short4 transformationX
as ColorStyle, with the gradient angle applied
Definition gui_style.h:584
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:587
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:582
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:614
static VisualColorStyle Create(GradientManager &gradientManager, color4f color, GradientHandle &outHandle)
ColorType type
Definition gui_style.h:588
@ None
Definition gui_element_flags.h:19
ImageIndex
Index of an image in the graphics context's image set, as the shaders sample it.
Definition gui_image.h:37
@ Invalid
Definition gui_image.h:37
@ 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:465
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:503
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:478
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:648
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:466
@ Always
Force a line break after this element (CSS: always / right).
Definition gui_style.h:467
@ Before
Force a line break before this element (CSS: left).
Definition gui_style.h:468
@ Avoid
Prevent a line break between this and the next element (CSS: avoid).
Definition gui_style.h:469
@ 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:510
@ LinearGradient
ramp along an axis (CSS: linear-gradient)
Definition gui_style.h:507
@ SDFGradient
ramp by depth inside the shape: 0 on its edge, 1 at its deepest point (a box's middle,...
Definition gui_style.h:516
@ InterpolatedTriangle
three colors blended by vertex weights
Definition gui_style.h:511
@ SolidColor
the first stop's color
Definition gui_style.h:504
@ CircularAngularGradient
ramp by distance from the center
Definition gui_style.h:508
@ RepeatedTexture
Style::textureIndex tiled at its pixel size.
Definition gui_style.h:506
@ InterpolatedBox
four corner colors blended across the box
Definition gui_style.h:512
@ StretchedTexture
Style::textureIndex stretched over the box.
Definition gui_style.h:505
@ EllipsoidAngularGradient
ramp by distance from the center, relative to the box size
Definition gui_style.h:509
@ Crosshair
Crosshair for precision selection.
Definition gui_style.h:482
@ Wait
Wait/busy cursor.
Definition gui_style.h:481
@ EwResize
CSS ew-resize: bidirectional east-west arrow (left/right movement).
Definition gui_style.h:486
@ NsResize
CSS ns-resize: bidirectional north-south arrow (up/down movement).
Definition gui_style.h:487
@ Pointer
Pointing hand for clickable items.
Definition gui_style.h:483
@ Default
Default arrow cursor.
Definition gui_style.h:479
@ ColResize
CSS col-resize: edge of a column being moved (left/right).
Definition gui_style.h:484
@ NeswResize
CSS nesw-resize: diagonal (northeast-southwest).
Definition gui_style.h:489
@ RowResize
CSS row-resize: edge of a row being moved (up/down).
Definition gui_style.h:485
@ NwseResize
CSS nwse-resize: diagonal (northwest-southeast).
Definition gui_style.h:488
@ NotAllowed
CSS not-allowed.
Definition gui_style.h:491
@ 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:649
@ Content
the state's text color over its background: 8% hovered, 14% pressed
Definition gui_style.h:650
@ 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:6
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:26
Up to kMaxStops color stops plus an angle and interpolation color space.
Definition gui_style_gradient.h:91
std::array< ColorStop, kMaxStops > stops
the first stopCount are in use
Definition gui_style_gradient.h:94
uint8_t stopCount
stops in use
Definition gui_style_gradient.h:96
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 kAuto
start: auto-place
Definition gui_style.h:408
int16_t start
first track the item covers; kAuto = auto-place
Definition gui_style.h:414
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:416
int16_t span
tracks the item covers
Definition gui_style.h:415
Grid container and item properties.
Definition gui_style.h:423
bool operator==(const GridProperties &) const noexcept=default
GridAxisProperties column
CSS: grid-column, column-gap.
Definition gui_style.h:424
JustifyContent justifyItems
CSS: justify-items, when alignItemsSelf isn't Stretch.
Definition gui_style.h:429
JustifyContent justifyContent
CSS: justify-content.
Definition gui_style.h:427
AlignItems alignItemsSelf
Stretch: items fill their cell's width (CSS: justify-items: stretch).
Definition gui_style.h:431
GridAxisProperties row
CSS: grid-row, row-gap.
Definition gui_style.h:425
AlignItems alignItems
CSS: align-items.
Definition gui_style.h:428
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:407
Flex / grid properties and CSS sizes of a style. Sizes are in CSS px in a Style.
Definition gui_style.h:442
int32_t maxWidth
CSS: max-width.
Definition gui_style.h:452
static constexpr int32_t kAutoSize
width / height 'auto'
Definition gui_style.h:446
int32_t minWidth
CSS: min-width.
Definition gui_style.h:451
bool operator==(const LayoutData &) const noexcept=default
int32_t width
CSS: width.
Definition gui_style.h:449
int32_t minHeight
CSS: min-height.
Definition gui_style.h:453
int32_t maxHeight
CSS: max-height.
Definition gui_style.h:454
int32_t height
CSS: height.
Definition gui_style.h:450
static constexpr int32_t kUnboundedMax
no max-width / max-height
Definition gui_style.h:447
GridProperties grid
used when display is Grid (and by grid items)
Definition gui_style.h:444
FlexProperties flex
used when display is Flex (and by flex items)
Definition gui_style.h:443
The layout part of a registered Style, in pixels; shared by every style with the same values.
Definition gui_style.h:755
constexpr bool IsInFlow() const
Takes part in layout: not display: none and not collapsed.
Definition gui_style.h:795
IconSide iconSide
see Style::iconSide
Definition gui_style.h:774
bool operator==(const LayoutStyle &other) const noexcept=default
Overflow overflowX
see Style::overflowX
Definition gui_style.h:772
BoxEdges padding
pixels
Definition gui_style.h:759
IntRect GetPaddingBoxContentRect(const IntRect &borderBox) const
The content box of a border-box rect: borderBox minus border and padding.
Definition gui_style.h:826
int16_t iconOffsetY
vertical nudge of an icon-only element in pixels; positive = up
Definition gui_style.h:767
int32_t GetBorderBoxWidth() const noexcept
Horizontal padding plus border widths, in pixels.
Definition gui_style.h:897
uint64_t GetHashCode() const noexcept
Hash of a subset of the fields, for deduplication; operator== settles collisions.
Definition gui_style.h:782
LayoutData layoutData
flex, grid and size properties, in pixels
Definition gui_style.h:762
BoxEdges borderWidths
pixels
Definition gui_style.h:760
static constexpr int16_t kAuto
Definition gui_style.h:756
bool clampScroll
see Style::clampScroll
Definition gui_style.h:777
uint16_t iconTextGap
space between icon and text, pixels
Definition gui_style.h:765
IntRect GetBorderRect(const IntRect &outer) const
The border box of a margin-box rect: outer minus margin.
Definition gui_style.h:864
IntRect GetContentRect(const IntRect &outer) const
The content box of a margin-box rect: outer minus margin, border and padding.
Definition gui_style.h:845
constexpr short2 GetMinSize() const
GetMinWidth and GetMinHeight together.
Definition gui_style.h:820
TextLayoutStyle textLayoutStyle
see Style::textLayoutStyle
Definition gui_style.h:763
IntRect GetPaddingRect(const IntRect &outer) const
The padding box of a margin-box rect: outer minus margin and border.
Definition gui_style.h:878
Display display
see Style::display
Definition gui_style.h:770
AlignItems alignSelf
see Style::alignSelf
Definition gui_style.h:775
BreakBehavior breakBehavior
see Style::breakBehavior
Definition gui_style.h:776
MouseCursor cursor
see Style::cursor
Definition gui_style.h:779
constexpr int16_t GetMinWidth() const
Horizontal margin + border + padding: the narrowest the element can be.
Definition gui_style.h:808
uint16_t iconSize
icon size in pixels; 0 = its natural size
Definition gui_style.h:766
constexpr bool IsFlexContainer() const
display is Flex.
Definition gui_style.h:802
Visibility visibility
see Style::visibility
Definition gui_style.h:771
constexpr int16_t GetMinHeight() const
Vertical margin + border + padding: the shortest the element can be.
Definition gui_style.h:814
BoxEdges margin
pixels
Definition gui_style.h:758
Overflow overflowY
see Style::overflowY
Definition gui_style.h:773
The visual properties of one element state (normal, :hover, :active, ...).
Definition gui_style.h:656
ColorStyle textColor
CSS: color; none = transparent.
Definition gui_style.h:661
ColorStyle borderColors[4]
[0]=top, [1]=right, [2]=bottom, [3]=left
Definition gui_style.h:660
ColorStyle decorationColors[4]
CSS: text-<under|bottom|over|through>line-color, in that order (see DecorationLine); none = the text ...
Definition gui_style.h:665
void SetBorderColor(const ColorStyle &c)
Sets all four border colors to c.
Definition gui_style.h:675
BoxShadow textShadow[kMaxTextShadows]
CSS: text-shadow, under the text, its decorations and its icon; the first is drawn on top.
Definition gui_style.h:669
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:677
ColorStyle backgroundColor
CSS: background.
Definition gui_style.h:659
ColorStyle iconColor
-tachyon-icon-color; none = the text color
Definition gui_style.h:662
BoxShadow boxShadow[kMaxBoxShadows]
CSS: box-shadow; the first is drawn on top.
Definition gui_style.h:666
TextStyle textStyle
font and text metrics
Definition gui_style.h:657
float opacity
CSS: opacity, 0 to 1: the element and everything in it drawn that much opaque.
Definition gui_style.h:672
A style's states, indexed by ElementState (or by slot number).
Definition gui_style.h:697
StyleState & operator[](ElementState state)
Definition gui_style.h:700
const StyleState * begin() const
Definition gui_style.h:707
StyleState & operator[](int slot)
Definition gui_style.h:702
const StyleState & operator[](ElementState state) const
Definition gui_style.h:701
StyleState * begin()
Definition gui_style.h:705
StyleState * end()
Definition gui_style.h:706
StyleState slots[kStateCount]
Definition gui_style.h:698
const StyleState & operator[](int slot) const
Definition gui_style.h:703
const StyleState * end() const
Definition gui_style.h:708
A complete style, as parsed from CSS or built in code: layout properties plus the visual properties o...
Definition gui_style.h:687
static constexpr int kStateCount
one per state slot
Definition gui_style.h:693
uint16_t iconTextGap
space between icon and text, CSS px
Definition gui_style.h:727
BoxCorners borderRadius
CSS px.
Definition gui_style.h:717
Display display
CSS: display.
Definition gui_style.h:732
BreakBehavior breakBehavior
CSS: break-after.
Definition gui_style.h:738
ImageIndex textureIndex
texture of the texture color types
Definition gui_style.h:731
BoxEdges margin
CSS px.
Definition gui_style.h:714
uint16_t iconSize
icon size in CSS px; 0 = its natural size
Definition gui_style.h:728
Overflow overflowY
CSS: overflow-y.
Definition gui_style.h:735
AlignItems alignSelf
CSS: align-self; Auto = the container's align-items.
Definition gui_style.h:737
TextLayoutStyle textLayoutStyle
shared by all states
Definition gui_style.h:712
float borderDashSize
dash length in CSS px; 0 = solid
Definition gui_style.h:718
Visibility visibility
CSS: visibility.
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:723
BoxEdges borderWidths
CSS px.
Definition gui_style.h:716
static constexpr int16_t kAuto
Definition gui_style.h:688
bool clampScroll
clamp the scroll offset to the content; false = unbounded
Definition gui_style.h:739
MouseCursor cursor
CSS: cursor.
Definition gui_style.h:744
BoxEdges padding
CSS px.
Definition gui_style.h:715
int16_t iconOffsetY
vertical nudge of the icon in CSS px; positive = up
Definition gui_style.h:729
float borderDashOffset
offset into the dash pattern, CSS px
Definition gui_style.h:719
LayoutData layoutData
flex, grid and size properties
Definition gui_style.h:725
Overflow overflowX
CSS: overflow-x.
Definition gui_style.h:734
States states
one per state slot
Definition gui_style.h:711
BoxShadow focusRing
:focus-visible box-shadow, over the state's shadows
Definition gui_style.h:720
IconSide iconSide
CSS: -tachyon-icon-side.
Definition gui_style.h:736
constexpr void SetOverflow(Overflow o) noexcept
CSS overflow shorthand: sets both axes.
Definition gui_style.h:742
The box part of one state of a registered Style, in pixels; uploaded to the GPU as is (32 bytes).
Definition gui_style.h:933
VisualColorStyleIndex borderColorIndex[4]
Per-edge border colors: [0]=top, [1]=right, [2]=bottom, [3]=left.
Definition gui_style.h:938
BoxEdges borderWidths
pixels
Definition gui_style.h:934
uint16_t borderDashOffset
offset into the dash pattern, pixels
Definition gui_style.h:944
uint64_t GetHashCode() const noexcept
Hash for deduplication.
Definition gui_style.h:951
uint16_t shadowIndex
1-based index of the state's VisualShadowStyle (shadows, opacity), 0 = none; read on the CPU only.
Definition gui_style.h:947
VisualColorStyleIndex backgroundColorIndex
background color
Definition gui_style.h:942
uint16_t borderDashSize
dash length in pixels; 0 = solid
Definition gui_style.h:943
BoxCorners borderRadius
pixels
Definition gui_style.h:935
bool operator==(const VisualBoxStyle &other) const noexcept
Definition gui_style.h:965
What a state draws on the CPU only: its shadows and its opacity.
Definition gui_style.h:921
VisualShadow ring
the focus ring (Style::focusRing)
Definition gui_style.h:923
VisualShadow layers[kMaxBoxShadows]
the state's box-shadow layers
Definition gui_style.h:922
uint32_t insetRing
1 + flat GPU index of the outline's box style, 0 = none
Definition gui_style.h:924
float opacity
StyleState::opacity; below 0 = not set.
Definition gui_style.h:925
bool operator==(const VisualShadowStyle &) const noexcept=default
A BoxShadow in pixels with its color registered. No color is no shadow.
Definition gui_style.h:905
constexpr bool IsNone() const
No color: no shadow.
Definition gui_style.h:913
VisualColorStyleIndex color
Definition gui_style.h:910
uint16_t blur
Definition gui_style.h:908
bool operator==(const VisualShadow &) const noexcept=default
int16_t y
Definition gui_style.h:907
int16_t x
see BoxShadow, in pixels
Definition gui_style.h:906
int16_t spread
Definition gui_style.h:909
The text part of one state of a registered Style, in pixels.
Definition gui_style.h:983
uint16_t iconSize
icon size in pixels; 0 = its natural size
Definition gui_style.h:991
VisualColorStyleIndex decorationColorIndex[4]
Per DecorationLine; the text color unless set.
Definition gui_style.h:988
bool operator==(const VisualTextStyle &other) const noexcept
Definition gui_style.h:1009
VisualShadow textShadows[kMaxTextShadows]
see StyleState::textShadow
Definition gui_style.h:994
IconSide iconSide
see Style::iconSide
Definition gui_style.h:993
VisualColorStyleIndex iconColorIndex
the text color unless set
Definition gui_style.h:986
int16_t iconOffsetY
vertical nudge of the icon in pixels; positive = up
Definition gui_style.h:992
VisualColorStyleIndex textColorIndex
registered text color
Definition gui_style.h:985
TextStyle textStyle
in pixels
Definition gui_style.h:984
uint64_t GetHashCode() const noexcept
Definition gui_style.h:996
uint16_t iconTextGap
space between icon and text, pixels
Definition gui_style.h:990
Definition gui_base_types.h:384
byte a
Definition gui_base_types.h:385
Definition gui_base_types.h:395
Definition gui_base_types.h:150
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:219
Definition gui_base_types.h:313
Definition gui_base_types.h:335
Definition gui_base_types.h:350