layoutnode

package
v0.1.64 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2026 License: MIT Imports: 12 Imported by: 0

README

Layout Node

Is the core UI Tree Node. Carrying information about itself and it's children. It uses Layout Elements to construct the UI.

Modifiers

Modifiers can Modifier the Node's behavior by adding and removing Layout Elements and or children. Even wrap the owner node itself

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyElementStore = modifier.EmptyElementStore
View Source
var EmptyWidgetConstructor = NewLayoutNodeWidgetConstructor(func(node LayoutNode) GioLayoutWidget {
	return ZeroGioLayoutWidget
})
View Source
var GetScopedIdentityManager = identity.GetScopedIdentityManager
View Source
var ZeroGioLayoutWidget = func(gtx LayoutContext) LayoutDimensions {
	return LayoutDimensions{
		Size: image.Pt(0, 0),
	}
}

Functions

func DebugLayoutNode

func DebugLayoutNode(node LayoutNode) string

DebugLayoutNode returns a formatted string representation of the layout node and its children for debugging purposes.

func NewLayoutNodeWidgetConstructor

func NewLayoutNodeWidgetConstructor(makeFunc func(node LayoutNode) GioLayoutWidget) layoutNodeWidgetConstructor

Types

type ChainNode

type ChainNode = node.ChainNode

type DrawModifierNode

type DrawModifierNode interface {
	LayoutNode
	AttachDrawModifier(attach func(widget LayoutWidget) LayoutWidget)
}

type DrawOp

type DrawOp = op.CallOp

type Element

type Element = modifier.Element

type ElementStore

type ElementStore = modifier.ElementStore

type GioLayoutWidget

type GioLayoutWidget = layout.Widget

type Identifier

type Identifier = identity.Identifier

type IdentityManager

type IdentityManager = identity.IdentityManager

type InspectableModifier

type InspectableModifier = modifier.InspectableModifier

type LayoutConstraints

type LayoutConstraints = layout.Constraints

type LayoutContext

type LayoutContext = layout.Context

type LayoutContextReceiver

type LayoutContextReceiver = func(gtx LayoutContext)

func NewLayoutContextReceiver

func NewLayoutContextReceiver(widget GioLayoutWidget) LayoutContextReceiver

type LayoutDimensions

type LayoutDimensions = layout.Dimensions

type LayoutDirection

type LayoutDirection int

LayoutDirection represents the layout direction

const (
	LayoutDirectionLTR LayoutDirection = iota
	LayoutDirectionRTL
)

type LayoutModifierNode

type LayoutModifierNode interface {
	LayoutNode
	AttachLayoutModifier(attach func(widget LayoutWidget) LayoutWidget)
}

type LayoutNode

type LayoutNode interface {
	TreeNode

	LayoutNodeChildren() []LayoutNode

	WithChildren(children []LayoutNode) LayoutNode

	Modifier(func(modifier ui.Modifier) ui.Modifier)
	UnwrapModifier() ui.Modifier

	WithSlotsAssoc(k string, v any) LayoutNode // this can be better
	FindSlot(k string) maybe.Maybe[any]

	GenerateID() Identifier
	ResetIdentifierKeyCounter()
	SupportState

	GetWidget() GioLayoutWidget

	SetWidgetConstructor(constructor LayoutNodeWidgetConstructor)
	GetWidgetConstructor() LayoutNodeWidgetConstructor

	IsEmpty() bool

	SetLayoutResult(LayoutResult)
	GetLayoutResult() maybe.Maybe[LayoutResult]

	Layout(gtx LayoutContext) LayoutDimensions
	Draw(gtx LayoutContext) DrawOp
}

func NewLayoutNode

func NewLayoutNode(id NodeID, key string, slotStore immap.ImmutableMap[any], memo Memo, persistentState PersistentState) LayoutNode

type LayoutNodeWidgetConstructor

type LayoutNodeWidgetConstructor interface {
	Make(node LayoutNode) GioLayoutWidget
}

type LayoutResult

type LayoutResult struct {
	Dimensions LayoutDimensions
	DrawOp     op.CallOp
}

type LayoutWidget

type LayoutWidget interface {
	Map(mapFun func(LayoutWidget) LayoutWidget) LayoutWidget
	Layout(gtx LayoutContext) LayoutDimensions
}

func NewLayoutWidget

func NewLayoutWidget(innerWidget GioLayoutWidget) LayoutWidget

type Memo

type Memo = state.Memo

type ModifierElement

type ModifierElement = modifier.ModifierElement

type MutableValue

type MutableValue = state.MutableValue

type NodeCoordinator

type NodeCoordinator interface {
	LayoutNode
	DrawModifierNode
	LayoutModifierNode
	PointerInputModifierNode
	ParentDataModifierNode

	PointerPhase(gtx LayoutContext)

	Elements() ElementStore

	Expand()
}

Wrapper to allow for inner node expansion

func NewNodeCoordinator

func NewNodeCoordinator(node LayoutNode) NodeCoordinator

type NodeID

type NodeID = node.NodeID

type ParentDataModifierNode

type ParentDataModifierNode interface {
	LayoutNode
	AttachParentDataModifier(attach func(elements ElementStore) ElementStore)
}

type PersistentState

type PersistentState = state.PersistentState

type PointerInputModifierNode

type PointerInputModifierNode interface {
	LayoutNode
	AttachPointerInputModifier(attach func(widget LayoutWidget) LayoutWidget)
}

type PointerWidget

type PointerWidget interface {
	Map(mapFun func(PointerWidget) PointerWidget) PointerWidget
	Update(gtx LayoutContext)
}

type Slots

type Slots = immap.ImmutableMap[any]

type SupportState

type SupportState = state.SupportState

type TreeNode

type TreeNode = node.TreeNode

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL