Documentation
¶
Index ¶
- type BoxSizingType
- type Config
- type Container
- type DirectionType
- type DisplayType
- type Edges
- type FlexAlign
- type FlexDirection
- type FlexJustify
- type FlexWrap
- type Gap
- type Layout
- func (l *Layout) AbsoluteBottom() float32
- func (l *Layout) AbsoluteLeft() float32
- func (l *Layout) AbsoluteRight() float32
- func (l *Layout) AbsoluteTop() float32
- func (l *Layout) Border() *LayoutEdges
- func (l *Layout) Bottom() float32
- func (l *Layout) Direction() DirectionType
- func (l *Layout) HadOverflow() bool
- func (l *Layout) Height() float32
- func (l *Layout) Left() float32
- func (l *Layout) Margin() *LayoutEdges
- func (l *Layout) Padding() *LayoutEdges
- func (l *Layout) RawHeight() float32
- func (l *Layout) RawWidth() float32
- func (l *Layout) Right() float32
- func (l *Layout) Top() float32
- func (l *Layout) Width() float32
- type LayoutEdges
- type MeasureFunc
- type MeasureMode
- type Node
- func (n *Node) AppendChild(child *Node)
- func (n *Node) Apply(style *Style) error
- func (n *Node) Children() iter.Seq[*Node]
- func (n *Node) Clone() *Node
- func (n *Node) CloneRecursive() *Node
- func (n *Node) ComputeLayout(container Container) error
- func (n *Node) Free()
- func (n *Node) FreeRecursive()
- func (n *Node) GetAlignContent() FlexAlign
- func (n *Node) GetAlignItems() FlexAlign
- func (n *Node) GetAlignSelf() FlexAlign
- func (n *Node) GetAspectRatio() float32
- func (n *Node) GetBorder() *StyleEdges
- func (n *Node) GetBottom() Value
- func (n *Node) GetBoxSizing() BoxSizingType
- func (n *Node) GetChild(index int) *Node
- func (n *Node) GetChildCount() int
- func (n *Node) GetConfig() *Config
- func (n *Node) GetDirection() DirectionType
- func (n *Node) GetDisplay() DisplayType
- func (n *Node) GetFlexBasis() Value
- func (n *Node) GetFlexDirection() FlexDirection
- func (n *Node) GetFlexGrow() float32
- func (n *Node) GetFlexShrink() float32
- func (n *Node) GetFlexWrap() FlexWrap
- func (n *Node) GetGap() *StyleGap
- func (n *Node) GetHeight() Value
- func (n *Node) GetJustifyContent() FlexJustify
- func (n *Node) GetLayout() *Layout
- func (n *Node) GetLeft() Value
- func (n *Node) GetMargin() *StyleEdges
- func (n *Node) GetMaxHeight() Value
- func (n *Node) GetMaxWidth() Value
- func (n *Node) GetMinHeight() Value
- func (n *Node) GetMinWidth() Value
- func (n *Node) GetNodeType() NodeType
- func (n *Node) GetOverflow() OverflowType
- func (n *Node) GetPadding() *StyleEdges
- func (n *Node) GetParent() *Node
- func (n *Node) GetPosition() PositionType
- func (n *Node) GetRight() Value
- func (n *Node) GetTop() Value
- func (n *Node) GetWidth() Value
- func (n *Node) HasMeasureFunc() bool
- func (n *Node) HasNewLayout() bool
- func (n *Node) InsertChild(child *Node, index int)
- func (n *Node) IsDirty() bool
- func (n *Node) MarkDirty()
- func (n *Node) RemoveAllChildren()
- func (n *Node) RemoveChild(child *Node)
- func (n *Node) Reset()
- func (n *Node) SetAlignContent(align FlexAlign) error
- func (n *Node) SetAlignItems(align FlexAlign) error
- func (n *Node) SetAlignSelf(align FlexAlign) error
- func (n *Node) SetAspectRatio(aspectRatio float32) error
- func (n *Node) SetBorder(edges Edges) error
- func (n *Node) SetBottom(bottom Value) error
- func (n *Node) SetBoxSizing(boxSizing BoxSizingType) error
- func (n *Node) SetChildren(children []*Node)
- func (n *Node) SetConfig(config *Config)
- func (n *Node) SetDirection(direction DirectionType) error
- func (n *Node) SetDirty(dirty bool)
- func (n *Node) SetDisplay(display DisplayType) error
- func (n *Node) SetFlexBasis(flexBasis Value) error
- func (n *Node) SetFlexDirection(direction FlexDirection) error
- func (n *Node) SetFlexGrow(flexGrow float32) error
- func (n *Node) SetFlexShrink(flexShrink float32) error
- func (n *Node) SetFlexWrap(wrap FlexWrap) error
- func (n *Node) SetGap(gap Gap) error
- func (n *Node) SetHasNewLayout(hasNewLayout bool)
- func (n *Node) SetHeight(height Value) error
- func (n *Node) SetJustifyContent(justify FlexJustify) error
- func (n *Node) SetLeft(left Value) error
- func (n *Node) SetMargin(edges Edges) error
- func (n *Node) SetMaxHeight(maxHeight Value) error
- func (n *Node) SetMaxWidth(maxWidth Value) error
- func (n *Node) SetMeasureFunc(fn MeasureFunc)
- func (n *Node) SetMinHeight(minHeight Value) error
- func (n *Node) SetMinWidth(minWidth Value) error
- func (n *Node) SetNodeType(nodeType NodeType) error
- func (n *Node) SetOverflow(overflow OverflowType) error
- func (n *Node) SetPadding(edges Edges) error
- func (n *Node) SetParent(parent *Node)
- func (n *Node) SetPosition(position PositionType) error
- func (n *Node) SetRight(right Value) error
- func (n *Node) SetTop(top Value) error
- func (n *Node) SetWidth(width Value) error
- func (n *Node) Snapshot() *Node
- func (n *Node) UnsetMeasureFunc()
- type NodeType
- type OverflowType
- type PositionType
- type Size
- type Style
- type StyleEdges
- type StyleGap
- type Unit
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoxSizingType ¶
type BoxSizingType int
const ( ContentBox BoxSizingType = iota BorderBox )
func (BoxSizingType) String ¶
func (t BoxSizingType) String() string
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func (*Config) GetPointScaleFactor ¶
func (*Config) SetPointScaleFactor ¶
type Container ¶
type Container struct {
Width float32
Height float32
Direction DirectionType
}
type DirectionType ¶
type DirectionType int
const ( Inherit DirectionType = iota LTR RTL )
func (DirectionType) String ¶
func (t DirectionType) String() string
type DisplayType ¶
type DisplayType int
const ( Flex DisplayType = iota Contents None )
func (DisplayType) String ¶
func (t DisplayType) String() string
type Edges ¶
type Edges struct {
Top, Bottom, Left, Right Value
Start, End Value
Horizontal, Vertical Value
All Value
}
Edges represents values for the edges of a box. Note: Start and End will always be prioritized over Left and Right when both are set.
type FlexDirection ¶
type FlexDirection int
const ( Column FlexDirection = iota ColumnReverse Row RowReverse )
func (FlexDirection) String ¶
func (a FlexDirection) String() string
type FlexJustify ¶
type FlexJustify int
const ( JustifyStart FlexJustify = iota JustifyEnd JustifyCenter JustifySpaceBetween JustifySpaceAround JustifySpaceEvenly )
func (FlexJustify) String ¶
func (a FlexJustify) String() string
type Layout ¶
type Layout struct {
// contains filtered or unexported fields
}
func (*Layout) AbsoluteBottom ¶
func (*Layout) AbsoluteLeft ¶
func (*Layout) AbsoluteRight ¶
func (*Layout) AbsoluteTop ¶
func (*Layout) Border ¶
func (l *Layout) Border() *LayoutEdges
func (*Layout) Direction ¶
func (l *Layout) Direction() DirectionType
func (*Layout) HadOverflow ¶
func (*Layout) Margin ¶
func (l *Layout) Margin() *LayoutEdges
func (*Layout) Padding ¶
func (l *Layout) Padding() *LayoutEdges
type LayoutEdges ¶
type LayoutEdges struct {
// contains filtered or unexported fields
}
func (*LayoutEdges) Bottom ¶
func (e *LayoutEdges) Bottom() float32
func (*LayoutEdges) Left ¶
func (e *LayoutEdges) Left() float32
func (*LayoutEdges) Right ¶
func (e *LayoutEdges) Right() float32
func (*LayoutEdges) Top ¶
func (e *LayoutEdges) Top() float32
type MeasureFunc ¶
type MeasureFunc func(node *Node, width float32, widthMode MeasureMode, height float32, heightMode MeasureMode) Size
type MeasureMode ¶
type MeasureMode int
const ( MeasureModeUndefined MeasureMode = iota MeasureModeExactly MeasureModeAtMost )
func (MeasureMode) String ¶
func (m MeasureMode) String() string
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) AppendChild ¶
func (*Node) CloneRecursive ¶
func (*Node) ComputeLayout ¶
func (*Node) FreeRecursive ¶
func (n *Node) FreeRecursive()
func (*Node) GetAlignContent ¶
func (*Node) GetAlignItems ¶
func (*Node) GetAlignSelf ¶
func (*Node) GetAspectRatio ¶
func (*Node) GetBorder ¶
func (n *Node) GetBorder() *StyleEdges
func (*Node) GetBoxSizing ¶
func (n *Node) GetBoxSizing() BoxSizingType
func (*Node) GetChildCount ¶
func (*Node) GetDirection ¶
func (n *Node) GetDirection() DirectionType
func (*Node) GetDisplay ¶
func (n *Node) GetDisplay() DisplayType
func (*Node) GetFlexBasis ¶
func (*Node) GetFlexDirection ¶
func (n *Node) GetFlexDirection() FlexDirection
func (*Node) GetFlexGrow ¶
func (*Node) GetFlexShrink ¶
func (*Node) GetFlexWrap ¶
func (*Node) GetJustifyContent ¶
func (n *Node) GetJustifyContent() FlexJustify
func (*Node) GetMargin ¶
func (n *Node) GetMargin() *StyleEdges
func (*Node) GetMaxHeight ¶
func (*Node) GetMaxWidth ¶
func (*Node) GetMinHeight ¶
func (*Node) GetMinWidth ¶
func (*Node) GetNodeType ¶
func (*Node) GetOverflow ¶
func (n *Node) GetOverflow() OverflowType
func (*Node) GetPadding ¶
func (n *Node) GetPadding() *StyleEdges
func (*Node) GetPosition ¶
func (n *Node) GetPosition() PositionType
func (*Node) HasMeasureFunc ¶
func (*Node) HasNewLayout ¶
func (*Node) InsertChild ¶
func (*Node) MarkDirty ¶
func (n *Node) MarkDirty()
MarkDirty marks the node as dirty. This will cause the next layout computation to recalculate this node and its children.
Note: this method should only be used for nodes with a custom measure function. Nodes without a measure function are marked dirty automatically when their style properties are changed.
func (*Node) RemoveAllChildren ¶
func (n *Node) RemoveAllChildren()
func (*Node) RemoveChild ¶
func (*Node) SetAlignContent ¶
func (*Node) SetAlignItems ¶
func (*Node) SetAlignSelf ¶
func (*Node) SetAspectRatio ¶
func (*Node) SetBorder ¶
SetBorder sets the border widths for the node. Note: Borders can only be set in points.
func (*Node) SetBoxSizing ¶
func (n *Node) SetBoxSizing(boxSizing BoxSizingType) error
func (*Node) SetChildren ¶
func (*Node) SetDirection ¶
func (n *Node) SetDirection(direction DirectionType) error
func (*Node) SetDirty ¶
SetDirty directly sets the dirty flag on a node without propagating to parent.
func (*Node) SetDisplay ¶
func (n *Node) SetDisplay(display DisplayType) error
func (*Node) SetFlexBasis ¶
func (*Node) SetFlexDirection ¶
func (n *Node) SetFlexDirection(direction FlexDirection) error
func (*Node) SetFlexGrow ¶
func (*Node) SetFlexShrink ¶
func (*Node) SetFlexWrap ¶
func (*Node) SetGap ¶
SetGap sets the gap sizes for the node. Note: Gaps can be set in points or percent.
func (*Node) SetHasNewLayout ¶
func (*Node) SetJustifyContent ¶
func (n *Node) SetJustifyContent(justify FlexJustify) error
func (*Node) SetMargin ¶
SetMargin sets the margin widths for the node. Note: Margins can be set in points, percent, or auto.
func (*Node) SetMaxHeight ¶
func (*Node) SetMaxWidth ¶
func (*Node) SetMeasureFunc ¶
func (n *Node) SetMeasureFunc(fn MeasureFunc)
func (*Node) SetMinHeight ¶
func (*Node) SetMinWidth ¶
func (*Node) SetNodeType ¶
func (*Node) SetOverflow ¶
func (n *Node) SetOverflow(overflow OverflowType) error
func (*Node) SetPadding ¶
SetPadding sets the padding for the node. Note: Padding can only be set in points or percent.
func (*Node) SetPosition ¶
func (n *Node) SetPosition(position PositionType) error
func (*Node) Snapshot ¶
Snapshot creates a deep clone of the node tree while preserving the dirty state. Unlike CloneRecursive which marks cloned nodes as dirty, Snapshot maintains the original dirty status, allowing cached layout computations to be reused.
func (*Node) UnsetMeasureFunc ¶
func (n *Node) UnsetMeasureFunc()
type OverflowType ¶
type OverflowType int
const ( Visible OverflowType = iota Hidden Scroll )
func (OverflowType) String ¶
func (t OverflowType) String() string
type PositionType ¶
type PositionType int
const ( Static PositionType = iota Relative Absolute )
func (PositionType) String ¶
func (t PositionType) String() string
type Style ¶
type Style struct {
// Display & Layout
Display DisplayType
FlexDirection FlexDirection
JustifyContent FlexJustify
AlignItems FlexAlign
AlignSelf FlexAlign
AlignContent FlexAlign
FlexWrap FlexWrap
Direction DirectionType
// Dimensions
Width, Height Value
MinWidth, MinHeight Value
MaxWidth, MaxHeight Value
AspectRatio float32
// Spacing
Padding Edges
Margin Edges
Border Edges
Gap Gap
// Flex item properties
FlexGrow float32
FlexShrink float32
FlexBasis Value
// Positioning
Position PositionType
Top, Right, Bottom, Left Value
// Overflow
Overflow OverflowType
// Box Sizing
BoxSizing BoxSizingType
}
type StyleEdges ¶
type StyleEdges struct {
// contains filtered or unexported fields
}
func (*StyleEdges) GetBottom ¶
func (e *StyleEdges) GetBottom() Value
func (*StyleEdges) GetEnd ¶
func (e *StyleEdges) GetEnd() Value
func (*StyleEdges) GetLeft ¶
func (e *StyleEdges) GetLeft() Value
func (*StyleEdges) GetRight ¶
func (e *StyleEdges) GetRight() Value
func (*StyleEdges) GetStart ¶
func (e *StyleEdges) GetStart() Value
func (*StyleEdges) GetTop ¶
func (e *StyleEdges) GetTop() Value
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
func FitContent ¶
func FitContent() Value
func MaxContent ¶
func MaxContent() Value