Documentation
¶
Index ¶
- Constants
- Variables
- func BindSortableListItems[T any](sl *SortableList, items *Array[T])
- func GlyphScale(img engine.Image, desiredPx float64) float64
- func IconArrowDown() engine.Image
- func IconArrowUp() engine.Image
- func IconCheckmark() engine.Image
- func IconChevronDown() engine.Image
- func IconChevronLeft() engine.Image
- func IconChevronRight() engine.Image
- func IconChevronUp() engine.Image
- func IconCloseX() engine.Image
- func IconFilter() engine.Image
- func IconGripDotsH() engine.Image
- func IconGripDotsSquare() engine.Image
- func IconGripDotsV() engine.Image
- func IconGripLinesH() engine.Image
- func IconGripLinesV() engine.Image
- func IconHamburger() engine.Image
- func IconMinus() engine.Image
- func IconPasswordDot() engine.Image
- func IconPlus() engine.Image
- func IconRadioDot() engine.Image
- func IconSearch() engine.Image
- func LayoutNineSlice(nodes *NineSliceNodes, ns *NineSlice, w, h float64)
- func LerpColor(a, b sg.Color, t float64) sg.Color
- func PasswordDotGlyph() engine.Image
- func RoundedRectBorderMesh(w, h, r, bw float64, segments int) ([]engine.Vertex, []uint16)
- func RoundedRectGradientMesh(w, h, cornerRadius float64, segments int, g *GradientColors) ([]engine.Vertex, []uint16)
- func RoundedRectPoints(w, h, r float64, segments int) []sg.Vec2
- func SetGlyphSheet(pngData []byte)
- func SetRowClickSelects(col *DataTableColumn, enable bool)
- func SetScene(s *sg.Scene)
- func SetSearchBoxFunc[T any](sb *SearchBox, results *Array[T], fn func(query string) []T)
- func SetSearchBoxIntoFunc[T any](sb *SearchBox, results *Array[T], fn func(query string, results *Array[T]))
- func ShowToast(message string, variant Variant, opts ...ToastOption)
- func SubRegion(base sg.TextureRegion, x, y, w, h uint16) sg.TextureRegion
- func TreeCollapseGlyph() engine.Image
- func TreeExpandGlyph() engine.Image
- func UpdateEllipsisLabel(comp *Component, text string)
- func WordBoundaries(runes []rune, pos int) (lo, hi int)
- type Accordion
- func (a *Accordion) AddSection(section AccordionSection) *Accordion
- func (a *Accordion) BindExpanded(ref *Ref[string])
- func (a *Accordion) Close(id string)
- func (a *Accordion) Dispose()
- func (a *Accordion) ExpandedID() string
- func (a *Accordion) IsExpanded(id string) bool
- func (a *Accordion) Open(id string)
- func (a *Accordion) RemoveSection(id string)
- func (a *Accordion) Section(id string) *AccordionSection
- func (a *Accordion) SetAnimated(v bool)
- func (a *Accordion) SetExclusive(v bool)
- func (a *Accordion) SetExpanded(id string, v bool)
- func (a *Accordion) SetFont(source *sg.FontFamily, size float64)
- func (a *Accordion) SetOnToggle(fn func(id string, expanded bool))
- func (a *Accordion) SetSize(w, h float64)
- func (a *Accordion) Toggle(id string)
- func (a *Accordion) Update(dt float32)
- type AccordionSection
- type Alignment
- type Anchor
- type AnchorLayout
- type AnimPlayMode
- type AnimatedImage
- func (a *AnimatedImage) CurrentFrame() int
- func (a *AnimatedImage) FrameCount() int
- func (a *AnimatedImage) IsPlaying() bool
- func (a *AnimatedImage) LoadGIF(g *gif.GIF)
- func (a *AnimatedImage) Pause()
- func (a *AnimatedImage) Play()
- func (a *AnimatedImage) SetAtlas(img engine.Image, frameWidth, frameHeight int)
- func (a *AnimatedImage) SetCornerRadius(r float64)
- func (a *AnimatedImage) SetFPS(fps float64)
- func (a *AnimatedImage) SetFrame(n int)
- func (a *AnimatedImage) SetFrames(frames []sg.TextureRegion)
- func (a *AnimatedImage) SetOnComplete(fn func())
- func (a *AnimatedImage) SetOnFrameChanged(fn func(frame int))
- func (a *AnimatedImage) SetPlayMode(mode AnimPlayMode)
- func (a *AnimatedImage) SetScaleMode(mode ImageScaleMode)
- func (a *AnimatedImage) SetSize(w, h float64)
- func (a *AnimatedImage) SetTint(c sg.Color)
- func (a *AnimatedImage) Stop()
- func (a *AnimatedImage) Update(dt float64)
- func (a *AnimatedImage) UpdateVisuals()
- type Array
- type Background
- type BackgroundProperty
- type BackgroundType
- type Badge
- func (b *Badge) SetCount(n int)
- func (b *Badge) SetDotMode(v bool)
- func (b *Badge) SetMaxCount(n int)
- func (b *Badge) SetPadding(top, right, bottom, left float64)
- func (b *Badge) SetSize(w, h float64)
- func (b *Badge) SetText(text string)
- func (b *Badge) SizeToContent()
- func (b *Badge) Text() string
- func (b *Badge) UpdateVisuals()
- type BindHandle
- type Button
- func (b *Button) AutoSize() bool
- func (b *Button) BindText(ref *Ref[string])
- func (b *Button) Dispose()
- func (b *Button) HasOnClickCallback() bool
- func (b *Button) LabelHeight() float64
- func (b *Button) LabelLabel() *Label
- func (b *Button) LabelText() string
- func (b *Button) LabelWidth() float64
- func (b *Button) SetAutoSize(v bool)
- func (b *Button) SetEnabled(v bool)
- func (b *Button) SetOnClick(fn func())
- func (b *Button) SetSize(w, h float64)
- func (b *Button) SetText(t string)
- func (b *Button) SimulateOnClick()
- func (b *Button) TextOY() float64
- func (b *Button) UpdateVisuals()
- type CalendarSelector
- func (cs *CalendarSelector) BindDate(ref *Ref[time.Time])
- func (cs *CalendarSelector) ClearMaxDate()
- func (cs *CalendarSelector) ClearMinDate()
- func (cs *CalendarSelector) ClosePopup()
- func (cs *CalendarSelector) Date() time.Time
- func (cs *CalendarSelector) Dispose()
- func (cs *CalendarSelector) IsPopupMode() bool
- func (cs *CalendarSelector) NextButton() *Button
- func (cs *CalendarSelector) OpenPopup()
- func (cs *CalendarSelector) PrevButton() *Button
- func (cs *CalendarSelector) SetDate(t time.Time)
- func (cs *CalendarSelector) SetEnabled(v bool)
- func (cs *CalendarSelector) SetMaxDate(t time.Time)
- func (cs *CalendarSelector) SetMinDate(t time.Time)
- func (cs *CalendarSelector) SetMonth(year, month int)
- func (cs *CalendarSelector) SetOnDateSelected(fn func(time.Time))
- func (cs *CalendarSelector) SetPopupMode(v bool)
- func (cs *CalendarSelector) SetSize(w, h float64)
- func (cs *CalendarSelector) TriggerButton() *Button
- func (cs *CalendarSelector) UpdateVisuals()
- type CellClipMode
- type CellCoord
- type CellStyle
- type Checkbox
- func (c *Checkbox) BindValue(ref *Ref[bool])
- func (c *Checkbox) BoxNode() *sg.Node
- func (c *Checkbox) CheckNode() *sg.Node
- func (c *Checkbox) CheckboxLabel() *Label
- func (c *Checkbox) Checked() bool
- func (c *Checkbox) Dispose()
- func (c *Checkbox) SetCheckIcon(img engine.Image)
- func (c *Checkbox) SetChecked(v bool)
- func (c *Checkbox) SetEnabled(v bool)
- func (c *Checkbox) SetOnChange(fn func(bool))
- func (c *Checkbox) SetText(text string)
- func (c *Checkbox) UpdateVisuals()
- type ColorMode
- type ColorPicker
- func (cp *ColorPicker) BindValue(ref *Ref[sg.Color])
- func (cp *ColorPicker) Cancel()
- func (cp *ColorPicker) Close()
- func (cp *ColorPicker) Open()
- func (cp *ColorPicker) SetDefaultMode(mode ColorMode)
- func (cp *ColorPicker) SetOnChange(fn func(sg.Color))
- func (cp *ColorPicker) SetOnCommit(fn func(sg.Color))
- func (cp *ColorPicker) SetShowAlpha(show bool)
- func (cp *ColorPicker) SetSize(w, h float64)
- func (cp *ColorPicker) SetValue(c sg.Color)
- func (cp *ColorPicker) UpdateVisuals()
- func (cp *ColorPicker) Value() sg.Color
- type ColorPickerManager
- type ColorProperty
- type Component
- func (c *Component) AddAnchoredChild(child UIElement, anchor Anchor, offsetX, offsetY float64)
- func (c *Component) AddChild(child UIElement)
- func (c *Component) AddRawChild(node *sg.Node)
- func (c *Component) AddToNode(parent *sg.Node)
- func (c *Component) AddToScene(scene *sg.Scene)
- func (c *Component) AnchorOf(child UIElement) (anchor Anchor, offsetX, offsetY float64, ok bool)
- func (c *Component) ApplyBackgroundForTest(bg Background)
- func (c *Component) ApplyBorderForTest(color sg.Color, width float64, bg Background)
- func (c *Component) BaseComp() *Component
- func (c *Component) BgContainer() *sg.Node
- func (c *Component) BgGradientMesh() *sg.Node
- func (c *Component) BgNode() *sg.Node
- func (c *Component) BgPoly() *sg.Node
- func (c *Component) BindEnabled(ref *Ref[bool])
- func (c *Component) BindVisible(ref *Ref[bool])
- func (c *Component) BorderBot() *sg.Node
- func (c *Component) BorderLeft() *sg.Node
- func (c *Component) BorderPoly() *sg.Node
- func (c *Component) BorderRight() *sg.Node
- func (c *Component) BorderTop() *sg.Node
- func (c *Component) BorderWidth() float64
- func (c *Component) Children() []*Component
- func (c *Component) ClearContextMenu()
- func (c *Component) ClearTooltip()
- func (c *Component) Dispose()
- func (c *Component) EffectiveTheme() *Theme
- func (c *Component) FireEvent(name string)
- func (c *Component) GetTooltip() *Tooltip
- func (c *Component) HandleKey(key engine.Key) bool
- func (c *Component) HasBgSliceNodes() bool
- func (c *Component) HitShape() sg.HitShape
- func (c *Component) InitBackgroundForTest(name string)
- func (c *Component) InitBorderForTest(name string)
- func (c *Component) IsDisposed() bool
- func (c *Component) IsDrawDirty() bool
- func (c *Component) IsEnabled() bool
- func (c *Component) IsFocused() bool
- func (c *Component) IsHovered() bool
- func (c *Component) IsInteractable() bool
- func (c *Component) IsLayoutDirty() bool
- func (c *Component) IsPressed() bool
- func (c *Component) IsVisible() bool
- func (c *Component) MarkDrawDirty()
- func (c *Component) MarkLayoutDirty()
- func (c *Component) Name() string
- func (c *Component) Node() *sg.Node
- func (c *Component) NumChildren() int
- func (c *Component) OnClick(fn func(sg.ClickContext))
- func (c *Component) Parent() *Component
- func (c *Component) RemoveChild(child UIElement)
- func (c *Component) RemoveRawChild(node *sg.Node)
- func (c *Component) ResizeBackgroundForTest(w, h float64)
- func (c *Component) ResizeBorderForTest(w, h float64)
- func (c *Component) SetAnchor(child UIElement, anchor Anchor, offsetX, offsetY float64)
- func (c *Component) SetContextMenu(cm *ContextMenu)
- func (c *Component) SetCursorShape(shape engine.CursorShapeType)
- func (c *Component) SetEnabled(v bool)
- func (c *Component) SetFocused(v bool)
- func (c *Component) SetHandleKey(fn func(engine.Key) bool)
- func (c *Component) SetHitShape(s sg.HitShape)
- func (c *Component) SetInteractable(v bool)
- func (c *Component) SetOnActivate(fn func())
- func (c *Component) SetOnEvent(name string, fn func())
- func (c *Component) SetOnThemeChangeForTest(fn func())
- func (c *Component) SetOnTooltipHide(fn func())
- func (c *Component) SetOnTooltipShow(fn func())
- func (c *Component) SetPosition(x, y float64)
- func (c *Component) SetTheme(t *Theme)
- func (c *Component) SetTooltip(tt *Tooltip)
- func (c *Component) SetTooltipText(text string, source *sg.FontFamily, size float64)
- func (c *Component) SetUserData(v any)
- func (c *Component) SetVariant(v Variant)
- func (c *Component) SetVisible(v bool)
- func (c *Component) SetZIndex(z int)
- func (c *Component) SimulateDirtyDraw(v bool)
- func (c *Component) SimulateHover(v bool)
- func (c *Component) SimulatePress(v bool)
- func (c *Component) SizeToContent()
- func (c *Component) State() ComponentState
- func (c *Component) UpdateLayout()
- func (c *Component) UserData() any
- func (c *Component) Variant() Variant
- func (c *Component) WorldBounds() (x, y, w, h float64)
- func (c *Component) WorldCenter() (cx, cy float64)
- func (c *Component) ZIndex() int
- type ComponentState
- type Computed
- type Config
- type ContextMenu
- type Controller
- type DataTable
- func (dt *DataTable) AddColumn(col DataTableColumn)
- func (dt *DataTable) BindItems(items *Array[any])
- func (dt *DataTable) BindScrollPos(ref *Ref[float64])
- func (dt *DataTable) BindSearchFilter(ref *Ref[string])
- func (dt *DataTable) BindSearchInput(ti *TextInput)
- func (dt *DataTable) BindSelectedIndexes(getFn func() []int, setFn func([]int))
- func (dt *DataTable) ClearColumnFilter(colKey string)
- func (dt *DataTable) ClearSelection()
- func (dt *DataTable) DataTableDisplayCount() int
- func (dt *DataTable) DataTableDisplayIndexes() []int
- func (dt *DataTable) DataTableScrollBar() *ScrollBar
- func (dt *DataTable) DataTableScrollPos() *Ref[float64]
- func (dt *DataTable) DataTableSelectedIndexes() []int
- func (dt *DataTable) DeselectRow(index int)
- func (dt *DataTable) Dispose()
- func (dt *DataTable) IsSelected(index int) bool
- func (dt *DataTable) OnColumn(key string, col DataTableColumn)
- func (dt *DataTable) Rebuild()
- func (dt *DataTable) Refresh()
- func (dt *DataTable) ResetFiltersAndSort()
- func (dt *DataTable) ScrollToBottom()
- func (dt *DataTable) ScrollToRow(index int)
- func (dt *DataTable) ScrollToTop()
- func (dt *DataTable) SelectAll()
- func (dt *DataTable) SelectRow(index int)
- func (dt *DataTable) SelectedIndexes() []int
- func (dt *DataTable) SetColumnFilter(colKey string, values []string)
- func (dt *DataTable) SetColumns(cols []DataTableColumn)
- func (dt *DataTable) SetDefaultSort(key string, dir SortDirection)
- func (dt *DataTable) SetEmptyComponent(comp *Component)
- func (dt *DataTable) SetFilterFunc(fn func(data any) bool)
- func (dt *DataTable) SetFont(source *sg.FontFamily, size float64)
- func (dt *DataTable) SetHeaderHeight(h float64)
- func (dt *DataTable) SetItems(items []any)
- func (dt *DataTable) SetOnCellClick(fn func(coord CellCoord, data any))
- func (dt *DataTable) SetOnCellDoubleClick(fn func(coord CellCoord, data any))
- func (dt *DataTable) SetOnMultiSort(fn func([]SortKey))
- func (dt *DataTable) SetOnSelectionChanged(fn func(indexes []int))
- func (dt *DataTable) SetOnSort(fn func(key string, dir SortDirection))
- func (dt *DataTable) SetOnSortScroll(v OnSortScroll)
- func (dt *DataTable) SetRowClickSelects(v bool)
- func (dt *DataTable) SetRowHeight(h float64)
- func (dt *DataTable) SetScrollMode(m ScrollMode)
- func (dt *DataTable) SetSelectedIndexes(indexes []int)
- func (dt *DataTable) SetSelectionMode(m SelectionMode)
- func (dt *DataTable) SetShowColumnDividers(v bool)
- func (dt *DataTable) SetShowHeader(v bool)
- func (dt *DataTable) SetShowRowDividers(v bool)
- func (dt *DataTable) SetShowScrollBar(v bool)
- func (dt *DataTable) SetSize(w, h float64)
- func (dt *DataTable) SetSortKeys(keys []SortKey)
- func (dt *DataTable) SetSortedColumn(key string, dir SortDirection)
- func (dt *DataTable) SetZebraStriping(v bool)
- func (dt *DataTable) SortKeys() []SortKey
- func (dt *DataTable) SortedColumn() (string, SortDirection)
- func (dt *DataTable) ToggleRowSelection(index int)
- func (dt *DataTable) Update()
- type DataTableColumn
- type DragAxis
- type DragGripStyle
- type DragHandle
- func (dh *DragHandle) Axis() DragAxis
- func (dh *DragHandle) ClearTarget()
- func (dh *DragHandle) GripNodes() []*sg.Node
- func (dh *DragHandle) GripStyle() DragGripStyle
- func (dh *DragHandle) Max() float64
- func (dh *DragHandle) Min() float64
- func (dh *DragHandle) SetAxis(axis DragAxis)
- func (dh *DragHandle) SetEnabled(v bool)
- func (dh *DragHandle) SetGripStyle(style DragGripStyle)
- func (dh *DragHandle) SetMax(v float64)
- func (dh *DragHandle) SetMin(v float64)
- func (dh *DragHandle) SetOnDrag(fn func(delta float64))
- func (dh *DragHandle) SetOnDragEnd(fn func(value float64))
- func (dh *DragHandle) SetOnDragStart(fn func())
- func (dh *DragHandle) SetSize(w, h float64)
- func (dh *DragHandle) SetTarget(comp *Component)
- func (dh *DragHandle) Target() *Component
- func (dh *DragHandle) UpdateVisuals()
- type FillMode
- type FloatProperty
- type FocusManager
- func (fm *FocusManager) Bind(combo KeyCombo, fn func() bool) BindHandle
- func (fm *FocusManager) BindScoped(comp *Component, combo KeyCombo, fn func() bool)
- func (fm *FocusManager) ClearFocus()
- func (fm *FocusManager) Focused() *Component
- func (fm *FocusManager) Register(c *Component)
- func (fm *FocusManager) SetFocus(c *Component)
- func (fm *FocusManager) TabNext()
- func (fm *FocusManager) TabPrev()
- func (fm *FocusManager) Unbind(handle BindHandle)
- func (fm *FocusManager) Unregister(c *Component)
- func (fm *FocusManager) Update()
- type Gradient
- type GradientColors
- type GradientEditor
- func (ge *GradientEditor) BindValue(ref *Ref[render.Gradient])
- func (ge *GradientEditor) SetAllowedModes(modes ...render.GradientMode)
- func (ge *GradientEditor) SetOnChange(fn func(render.Gradient))
- func (ge *GradientEditor) SetShowModeSelector(show bool)
- func (ge *GradientEditor) SetSize(w, h float64)
- func (ge *GradientEditor) SetValue(g render.Gradient)
- func (ge *GradientEditor) UpdateVisuals()
- func (ge *GradientEditor) Value() render.Gradient
- type GradientMode
- type IconButton
- func (ib *IconButton) BindActive(ref *Ref[bool])
- func (ib *IconButton) Dispose()
- func (ib *IconButton) IconNode() *sg.Node
- func (ib *IconButton) IsActive() bool
- func (ib *IconButton) SetActive(v bool)
- func (ib *IconButton) SetEnabled(v bool)
- func (ib *IconButton) SetIconImage(img engine.Image)
- func (ib *IconButton) SetIconKey(key string)
- func (ib *IconButton) SetIconSize(w, h float64)
- func (ib *IconButton) SetLabel(text string, source *sg.FontFamily, size float64)
- func (ib *IconButton) SetLabelPosition(pos IconLabelPosition)
- func (ib *IconButton) SetOnClick(fn func())
- func (ib *IconButton) SetSize(w, h float64)
- func (ib *IconButton) SimulateOnClick()
- func (ib *IconButton) UpdateVisuals()
- type IconLabelPosition
- type Image
- func (im *Image) ClearImage()
- func (im *Image) ImgNode() *sg.Node
- func (im *Image) ImgPosition() (x, y float64)
- func (im *Image) ImgSize() (w, h float64)
- func (im *Image) ScaleMode() ImageScaleMode
- func (im *Image) SetAlpha(a float32)
- func (im *Image) SetCornerRadius(r float64)
- func (im *Image) SetImage(img engine.Image)
- func (im *Image) SetRegion(region sg.TextureRegion)
- func (im *Image) SetScaleMode(mode ImageScaleMode)
- func (im *Image) SetSize(w, h float64)
- func (im *Image) SetTint(c sg.Color)
- func (im *Image) SizeToContent()
- func (im *Image) Tint() sg.Color
- func (im *Image) UpdateVisuals()
- type ImageCropper
- func (c *ImageCropper) CropRect() image.Rectangle
- func (c *ImageCropper) Dispose()
- func (c *ImageCropper) SetAspectRatio(w, h float64)
- func (c *ImageCropper) SetCropRect(x, y, w, h float64)
- func (c *ImageCropper) SetImage(img engine.Image)
- func (c *ImageCropper) SetMaxSize(w, h float64)
- func (c *ImageCropper) SetMinSize(w, h float64)
- func (c *ImageCropper) SetOnCropChanged(fn func(rect image.Rectangle))
- func (c *ImageCropper) SetShowGrid(v bool)
- func (c *ImageCropper) SetSize(w, h float64)
- func (c *ImageCropper) UpdateVisuals()
- type ImageScaleMode
- type InputField
- func (f *InputField) BindValue(ref *Ref[string])
- func (f *InputField) ClearValidation()
- func (f *InputField) Dispose()
- func (f *InputField) Input() *TextInput
- func (f *InputField) SetEnabled(v bool)
- func (f *InputField) SetLabel(text string)
- func (f *InputField) SetLabelPosition(pos LabelPosition)
- func (f *InputField) SetMaxLength(n int)
- func (f *InputField) SetOnBlur(fn func())
- func (f *InputField) SetOnChange(fn func(string))
- func (f *InputField) SetOnSubmit(fn func(string))
- func (f *InputField) SetPlaceholder(v string)
- func (f *InputField) SetReadOnly(v bool)
- func (f *InputField) SetRequired(v bool)
- func (f *InputField) SetRequiredMarker(s string)
- func (f *InputField) SetSize(w, h float64)
- func (f *InputField) SetValidationMessage(msg string)
- func (f *InputField) SetValidationState(state ValidationState)
- func (f *InputField) SetValue(v string)
- func (f *InputField) SetWidth(w float64)
- func (f *InputField) Value() string
- type InputFieldGroup
- type InputManager
- func (im *InputManager) Consume(key engine.Key)
- func (im *InputManager) FireListeners()
- func (im *InputManager) IsKeyAvailable(key engine.Key) bool
- func (im *InputManager) IsKeyJustAvailable(key engine.Key) bool
- func (im *InputManager) IsKeyJustReleased(key engine.Key) bool
- func (im *InputManager) OnKeyDown(key engine.Key, fn func()) ListenerHandle
- func (im *InputManager) OnKeyHeld(key engine.Key, fn func()) ListenerHandle
- func (im *InputManager) OnKeyUp(key engine.Key, fn func()) ListenerHandle
- func (im *InputManager) RemoveListener(handle ListenerHandle)
- func (im *InputManager) Update()
- type Insets
- type KeyBinding
- type KeyCombo
- type KeybindInput
- func (k *KeybindInput) BindValue(ref *Ref[KeyBinding])
- func (k *KeybindInput) Binding() KeyBinding
- func (k *KeybindInput) ClearBinding()
- func (k *KeybindInput) CombosEnabled() bool
- func (k *KeybindInput) Dispose()
- func (k *KeybindInput) IsListening() bool
- func (k *KeybindInput) SetBinding(binding KeyBinding)
- func (k *KeybindInput) SetCombosEnabled(v bool)
- func (k *KeybindInput) SetEnabled(v bool)
- func (k *KeybindInput) SetListening(v bool)
- func (k *KeybindInput) SetOnBindingChanged(fn func(binding KeyBinding))
- func (k *KeybindInput) SetOnConflict(fn func(existing KeyBinding) bool)
- func (k *KeybindInput) SetSize(w, h float64)
- func (k *KeybindInput) UpdateVisuals()
- type Label
- func (l *Label) BindText(ref *Ref[string])
- func (l *Label) Dispose()
- func (l *Label) Font() *sg.FontFamily
- func (l *Label) SetAlign(a sg.TextAlign)
- func (l *Label) SetBold(bold bool)
- func (l *Label) SetColor(c sg.Color)
- func (l *Label) SetFont(source *sg.FontFamily)
- func (l *Label) SetFontSize(size float64)
- func (l *Label) SetItalic(italic bool)
- func (l *Label) SetSharpness(s float64)
- func (l *Label) SetText(t string)
- func (l *Label) SetWrapWidth(w float64)
- func (l *Label) Text() string
- func (l *Label) TextNode() *sg.Node
- type LabelPosition
- type LabelStyle
- type LayoutLineForTest
- type LayoutMode
- type LineFragmentForTest
- type List
- func (l *List) BindItems(arr *Array[ListItem])
- func (l *List) BindSelected(ref *Ref[int])
- func (l *List) ClearSelection()
- func (l *List) Dispose()
- func (l *List) ItemCount() int
- func (l *List) Items() []ListItem
- func (l *List) ListScrollBar() *ScrollBar
- func (l *List) ListScrollPos() *Ref[float64]
- func (l *List) ListSelHighlight() *sg.Node
- func (l *List) PoolSize() int
- func (l *List) ScrollToIndex(idx int)
- func (l *List) ScrollToSelection()
- func (l *List) SelectFirst()
- func (l *List) SelectLast()
- func (l *List) SelectNext()
- func (l *List) SelectPrevious()
- func (l *List) Selectable() bool
- func (l *List) Selected() int
- func (l *List) SelectedItem() any
- func (l *List) SelectedRef() *Ref[int]
- func (l *List) SetItems(items []ListItem)
- func (l *List) SetOnChange(fn func(int))
- func (l *List) SetRenderItem(fn func(int, any) *Component)
- func (l *List) SetSelectable(enabled bool)
- func (l *List) SetSelected(idx int)
- func (l *List) SetSize(w, h float64)
- func (l *List) Update()
- type ListItem
- type ListenerHandle
- type MaskedInput
- func (mi *MaskedInput) BindRawValue(ref *Ref[string])
- func (mi *MaskedInput) BindValue(ref *Ref[string])
- func (mi *MaskedInput) CellCount() int
- func (mi *MaskedInput) CellNodeForSlot(slotIdx int) *sg.Node
- func (mi *MaskedInput) Clear()
- func (mi *MaskedInput) DeleteBack()
- func (mi *MaskedInput) DeleteForward()
- func (mi *MaskedInput) Dispose()
- func (mi *MaskedInput) GetCursorPos() int
- func (mi *MaskedInput) GetSelEnd() int
- func (mi *MaskedInput) GetSelStart() int
- func (mi *MaskedInput) HasSelection() bool
- func (mi *MaskedInput) InsertText(s string)
- func (mi *MaskedInput) IsComplete() bool
- func (mi *MaskedInput) IsEmpty() bool
- func (mi *MaskedInput) Mask() string
- func (mi *MaskedInput) MaskPlaceholder() rune
- func (mi *MaskedInput) MoveCursorLeft()
- func (mi *MaskedInput) MoveCursorRight()
- func (mi *MaskedInput) Placeholder() string
- func (mi *MaskedInput) RawToDisplayIndex(rawIdx int) int
- func (mi *MaskedInput) RawValue() string
- func (mi *MaskedInput) SelectAll()
- func (mi *MaskedInput) SelectedText() string
- func (mi *MaskedInput) SetCursorPos(pos int)
- func (mi *MaskedInput) SetDebugSlots(v bool)
- func (mi *MaskedInput) SetEnabled(v bool)
- func (mi *MaskedInput) SetMask(mask string)
- func (mi *MaskedInput) SetMaskPlaceholder(ch rune)
- func (mi *MaskedInput) SetMaxLength(n int)
- func (mi *MaskedInput) SetOnBlur(fn func())
- func (mi *MaskedInput) SetOnChange(fn func(string))
- func (mi *MaskedInput) SetOnComplete(fn func(raw, formatted string))
- func (mi *MaskedInput) SetOnIncomplete(fn func(raw, formatted string))
- func (mi *MaskedInput) SetOnRawChange(fn func(string))
- func (mi *MaskedInput) SetOnSubmit(fn func(string))
- func (mi *MaskedInput) SetPlaceholder(p string)
- func (mi *MaskedInput) SetRawValue(v string)
- func (mi *MaskedInput) SetSize(w, h float64)
- func (mi *MaskedInput) SetValue(v string)
- func (mi *MaskedInput) SetWidth(w float64)
- func (mi *MaskedInput) SnapCursorToFirstEmptyForTest()
- func (mi *MaskedInput) Submit()
- func (mi *MaskedInput) Update()
- func (mi *MaskedInput) UpdateVisuals()
- func (mi *MaskedInput) Value() string
- func (mi *MaskedInput) VisualDisplayIdxForTest(rawIdx int) int
- type MenuBar
- type MenuBarEntry
- type MenuBarGroup
- type MenuItem
- type MenuPopup
- type MenuPopupGroup
- type MenuPopupManager
- type MeterBar
- func (mb *MeterBar) BindValue(ref *Ref[float64])
- func (mb *MeterBar) ClearFillColor()
- func (mb *MeterBar) Dispose()
- func (mb *MeterBar) FillNode() *sg.Node
- func (mb *MeterBar) FillWidth() float64
- func (mb *MeterBar) LabelComp() *Label
- func (mb *MeterBar) SetFillColor(c sg.Color)
- func (mb *MeterBar) SetProgress(v float64)
- func (mb *MeterBar) SetRange(min, max float64)
- func (mb *MeterBar) SetShowLabel(show bool, source *sg.FontFamily, displaySize float64)
- func (mb *MeterBar) SetSize(w, h float64)
- func (mb *MeterBar) SetValue(v float64)
- func (mb *MeterBar) Value() float64
- type ModifierMask
- type NavDrawer
- func (d *NavDrawer) Backdrop() *sg.Node
- func (d *NavDrawer) BindOpen(ref *Ref[bool])
- func (d *NavDrawer) Close()
- func (d *NavDrawer) Dispose()
- func (d *NavDrawer) DrawerPanel() *Panel
- func (d *NavDrawer) IsOpen() bool
- func (d *NavDrawer) IsPinned() bool
- func (d *NavDrawer) Open()
- func (d *NavDrawer) SetAnchor(anchor NavDrawerAnchor)
- func (d *NavDrawer) SetAnimationDuration(seconds float32)
- func (d *NavDrawer) SetCloseOnBackdropClick(v bool)
- func (d *NavDrawer) SetContent(comp UIElement)
- func (d *NavDrawer) SetOnClose(fn func())
- func (d *NavDrawer) SetOnOpen(fn func())
- func (d *NavDrawer) SetPinned(v bool)
- func (d *NavDrawer) SetSize(w, h float64)
- func (d *NavDrawer) SetWidth(w float64)
- func (d *NavDrawer) Toggle()
- func (d *NavDrawer) Update(dt float32)
- type NavDrawerAnchor
- type NineSlice
- type NineSliceNodes
- type NumberStepper
- func (ns *NumberStepper) BindValue(ref *Ref[float64])
- func (ns *NumberStepper) DecrementButton() *Button
- func (ns *NumberStepper) Dispose()
- func (ns *NumberStepper) IncrementButton() *Button
- func (ns *NumberStepper) InputField() *TextInput
- func (ns *NumberStepper) SetDecimals(n int)
- func (ns *NumberStepper) SetEnabled(v bool)
- func (ns *NumberStepper) SetMax(v float64)
- func (ns *NumberStepper) SetMin(v float64)
- func (ns *NumberStepper) SetOnChange(fn func(float64))
- func (ns *NumberStepper) SetPageStep(v float64)
- func (ns *NumberStepper) SetSize(w, h float64)
- func (ns *NumberStepper) SetStep(v float64)
- func (ns *NumberStepper) SetValue(v float64)
- func (ns *NumberStepper) Value() float64
- type OnSortScroll
- type OptionRotator
- func (or *OptionRotator) BindOptions(arr *Array[string])
- func (or *OptionRotator) BindSelected(ref *Ref[int])
- func (or *OptionRotator) BindValue(ref *Ref[string])
- func (or *OptionRotator) Dispose()
- func (or *OptionRotator) Next()
- func (or *OptionRotator) Options() []string
- func (or *OptionRotator) Prev()
- func (or *OptionRotator) Selected() int
- func (or *OptionRotator) SelectedRef() *Ref[int]
- func (or *OptionRotator) SetChevronIcons(left, right engine.Image)
- func (or *OptionRotator) SetEnabled(v bool)
- func (or *OptionRotator) SetOnChange(fn func(int, string))
- func (or *OptionRotator) SetOptions(opts []string)
- func (or *OptionRotator) SetSelected(i int)
- func (or *OptionRotator) SetSize(w, h float64)
- func (or *OptionRotator) SetWrap(v bool)
- func (or *OptionRotator) UpdateVisuals()
- func (or *OptionRotator) Value() string
- type Orientation
- type Outline
- type Panel
- func (p *Panel) AddChild(child UIElement)
- func (p *Panel) SetAlignment(a Alignment)
- func (p *Panel) SetBackground(c sg.Color)
- func (p *Panel) SetBorder(c sg.Color, width float64)
- func (p *Panel) SetCornerRadii(tl, tr, br, bl float64)
- func (p *Panel) SetJustify(j Alignment)
- func (p *Panel) SetLayout(mode LayoutMode)
- func (p *Panel) SetPadding(top, right, bottom, left float64)
- func (p *Panel) SetSize(w, h float64)
- func (p *Panel) SetSpacing(s float64)
- type PanelGroup
- type Popover
- func (p *Popover) Close()
- func (p *Popover) IsOpen() bool
- func (p *Popover) Open(trigger *Component)
- func (p *Popover) SetContent(comp UIElement)
- func (p *Popover) SetContentSize(w, h float64)
- func (p *Popover) SetOnClose(fn func())
- func (p *Popover) SetOnOpen(fn func())
- func (p *Popover) SetPreferredSide(side PopoverSide)
- func (p *Popover) SetShowCloseButton(v bool)
- func (p *Popover) SetTitle(text string, font *sg.FontFamily, size float64)
- type PopoverManager
- type PopoverSide
- type ProgressBar
- type Radio
- func (rg *Radio) AddOption(text string, source *sg.FontFamily, displaySize float64) *RadioButton
- func (rg *Radio) BindSelected(ref *Ref[int])
- func (rg *Radio) Buttons() []*RadioButton
- func (rg *Radio) Dispose()
- func (rg *Radio) Selected() int
- func (rg *Radio) SetColumns(n int)
- func (rg *Radio) SetOnChange(fn func(int))
- func (rg *Radio) SetSelected(idx int)
- func (rg *Radio) SetVerticalFirst(v bool)
- type RadioButton
- type ReactiveTreeNode
- type Rect
- type Ref
- type RichText
- func (rt *RichText) AddBoldItalicSpan(text string, color sg.Color) *RichText
- func (rt *RichText) AddBoldSpan(text string, color sg.Color) *RichText
- func (rt *RichText) AddItalicSpan(text string, color sg.Color) *RichText
- func (rt *RichText) AddSpan(text string) *RichText
- func (rt *RichText) AddStyledSpan(text string, source *sg.FontFamily, color sg.Color, outline *Outline) *RichText
- func (rt *RichText) AddTextSpan(span TextSpan) *RichText
- func (rt *RichText) ClearSpans() *RichText
- func (rt *RichText) Color() sg.Color
- func (rt *RichText) Dirty() bool
- func (rt *RichText) Dispose()
- func (rt *RichText) HeadingScale() [3]float64
- func (rt *RichText) ImageForTest() engine.Image
- func (rt *RichText) LayoutLinesForTest() []LayoutLineForTest
- func (rt *RichText) OnLinkClickForTest() func(string)
- func (rt *RichText) Render()
- func (rt *RichText) ResolveColorForTest(span TextSpan) sg.Color
- func (rt *RichText) ResolveFontForTest(span TextSpan) *sg.FontFamily
- func (rt *RichText) ResolveOutlineForTest(span TextSpan) *Outline
- func (rt *RichText) SetAlign(a sg.TextAlign)
- func (rt *RichText) SetColor(c sg.Color)
- func (rt *RichText) SetDirtyForTest(v bool)
- func (rt *RichText) SetHeadingScale(h1, h2, h3 float64)
- func (rt *RichText) SetMarkup(markup string) error
- func (rt *RichText) SetOnLinkClick(fn func(url string))
- func (rt *RichText) SetOutline(o *Outline)
- func (rt *RichText) SetSpans(spans []TextSpan) *RichText
- func (rt *RichText) SetWrapWidth(w float64)
- func (rt *RichText) Spans() []TextSpan
- func (rt *RichText) SpriteNode() *sg.Node
- type Scheduler
- type Screen
- func (s *Screen) Add(e UIElement)
- func (s *Screen) AddNode(n *sg.Node)
- func (s *Screen) Children() []*Component
- func (s *Screen) ClearTemplateTree()
- func (s *Screen) Destroy()
- func (s *Screen) FindByName(name string) *Component
- func (s *Screen) FocusManager() *FocusManager
- func (s *Screen) Hide()
- func (s *Screen) InputManager() *InputManager
- func (s *Screen) NumChildren() int
- func (s *Screen) Remove(e UIElement)
- func (s *Screen) RemoveNode(n *sg.Node)
- func (s *Screen) Scheduler() *Scheduler
- func (s *Screen) Show()
- func (s *Screen) TrackRef(r disposable)
- func (s *Screen) Update(dt float64)
- func (s *Screen) Visible() bool
- type ScreenOption
- type ScrollBar
- func (sb *ScrollBar) BindScrollPos(ref *Ref[float64])
- func (sb *ScrollBar) Dispose()
- func (sb *ScrollBar) ScrollPos() float64
- func (sb *ScrollBar) SetContentSize(total, view float64)
- func (sb *ScrollBar) SetOnChange(fn func(float64))
- func (sb *ScrollBar) SetOrientation(o Orientation)
- func (sb *ScrollBar) SetScrollPos(v float64)
- func (sb *ScrollBar) SetSize(w, h float64)
- func (sb *ScrollBar) ThumbHeight() float64
- func (sb *ScrollBar) ThumbNode() *sg.Node
- type ScrollMode
- type ScrollPanel
- func (sp *ScrollPanel) AddChild(child UIElement)
- func (sp *ScrollPanel) AddContent(child UIElement)
- func (sp *ScrollPanel) ContentH() float64
- func (sp *ScrollPanel) ContentNode() *sg.Node
- func (sp *ScrollPanel) Dispose()
- func (sp *ScrollPanel) EnsureVisible(child *Component)
- func (sp *ScrollPanel) HScrollBar() *ScrollBar
- func (sp *ScrollPanel) RemoveChild(child UIElement)
- func (sp *ScrollPanel) ScrollTo(x, y float64)
- func (sp *ScrollPanel) ScrollX() float64
- func (sp *ScrollPanel) ScrollY() float64
- func (sp *ScrollPanel) SetBackground(c sg.Color)
- func (sp *ScrollPanel) SetBorder(c sg.Color, width float64)
- func (sp *ScrollPanel) SetContentSize(w, h float64)
- func (sp *ScrollPanel) SetScrollX(v float64)
- func (sp *ScrollPanel) SetScrollY(v float64)
- func (sp *ScrollPanel) SetSize(w, h float64)
- func (sp *ScrollPanel) ShowHScroll(show bool)
- func (sp *ScrollPanel) ShowVScroll(show bool)
- func (sp *ScrollPanel) Update()
- func (sp *ScrollPanel) VScrollBar() *ScrollBar
- func (sp *ScrollPanel) Viewport() *sg.Node
- type SearchBox
- func (sb *SearchBox) BindValue(ref *Ref[string])
- func (sb *SearchBox) CancelPendingSearch()
- func (sb *SearchBox) Clear()
- func (sb *SearchBox) ClearVisible() bool
- func (sb *SearchBox) Debounce() time.Duration
- func (sb *SearchBox) DeleteBack()
- func (sb *SearchBox) DeleteForward()
- func (sb *SearchBox) Dispose()
- func (sb *SearchBox) GetCursorPos() int
- func (sb *SearchBox) GetPlaceholder() string
- func (sb *SearchBox) HasSelection() bool
- func (sb *SearchBox) Input() *TextInput
- func (sb *SearchBox) InsertText(s string)
- func (sb *SearchBox) IsSearching() bool
- func (sb *SearchBox) MinQueryLength() int
- func (sb *SearchBox) ResultsCount() int
- func (sb *SearchBox) SelectAll()
- func (sb *SearchBox) SetDebounce(d time.Duration)
- func (sb *SearchBox) SetEnabled(v bool)
- func (sb *SearchBox) SetMinQueryLength(n int)
- func (sb *SearchBox) SetOnBlur(fn func())
- func (sb *SearchBox) SetOnChange(fn func(query string))
- func (sb *SearchBox) SetOnClear(fn func())
- func (sb *SearchBox) SetOnSearchEmpty(fn func(query string))
- func (sb *SearchBox) SetOnSearchFinish(fn func(query string, count int))
- func (sb *SearchBox) SetOnSearchStart(fn func(query string))
- func (sb *SearchBox) SetOnSubmit(fn func(query string))
- func (sb *SearchBox) SetPlaceholder(v string)
- func (sb *SearchBox) SetSearchOnChange(v bool)
- func (sb *SearchBox) SetSearchOnSubmit(v bool)
- func (sb *SearchBox) SetShowClearButton(v bool)
- func (sb *SearchBox) SetShowSearchIcon(v bool)
- func (sb *SearchBox) SetSize(w, h float64)
- func (sb *SearchBox) SetValue(v string)
- func (sb *SearchBox) SetWidth(w float64)
- func (sb *SearchBox) Submit()
- func (sb *SearchBox) TextNode() *sg.Node
- func (sb *SearchBox) TriggerSearchNow()
- func (sb *SearchBox) UpdateVisuals()
- func (sb *SearchBox) Value() string
- type SearchBoxGroup
- type Select
- func (s *Select) BindOptions(arr *Array[SelectOption])
- func (s *Select) BindSelected(ref *Ref[int])
- func (s *Select) Dispose()
- func (s *Select) Selected() int
- func (s *Select) SelectedOption() SelectOption
- func (s *Select) SelectedRef() *Ref[int]
- func (s *Select) SetOnChange(fn func(index int, option SelectOption))
- func (s *Select) SetOptions(options []SelectOption)
- func (s *Select) SetSelected(idx int)
- func (s *Select) SetSize(w, h float64)
- func (s *Select) UpdateVisuals()
- type SelectOption
- type SelectionMode
- type Slider
- func (s *Slider) BindValue(ref *Ref[float64])
- func (s *Slider) Dispose()
- func (s *Slider) GetOrientation() Orientation
- func (s *Slider) SetEnabled(v bool)
- func (s *Slider) SetOnChange(fn func(float64))
- func (s *Slider) SetOrientation(o Orientation)
- func (s *Slider) SetRange(min, max float64)
- func (s *Slider) SetSize(w, h float64)
- func (s *Slider) SetStep(step float64)
- func (s *Slider) SetValue(v float64)
- func (s *Slider) ThumbNode() *sg.Node
- func (s *Slider) UpdateVisuals()
- func (s *Slider) Value() float64
- type SortDir
- type SortDirection
- type SortHandleSide
- type SortKey
- type SortType
- type SortableList
- func (sl *SortableList) BindSelected(ref *Ref[int])
- func (sl *SortableList) Dispose()
- func (sl *SortableList) ItemCount() int
- func (sl *SortableList) MoveItem(from, to int)
- func (sl *SortableList) MoveSelectedDown()
- func (sl *SortableList) MoveSelectedUp()
- func (sl *SortableList) ScrollToIndex(idx int)
- func (sl *SortableList) Selected() int
- func (sl *SortableList) SelectedItem() any
- func (sl *SortableList) SetDragEnabled(v bool)
- func (sl *SortableList) SetHandleSide(side SortHandleSide)
- func (sl *SortableList) SetKeyboardReorderEnabled(v bool)
- func (sl *SortableList) SetOnChange(fn func(int))
- func (sl *SortableList) SetOnMoveDenied(fn func(from, to int))
- func (sl *SortableList) SetOnReorder(fn func(from, to int))
- func (sl *SortableList) SetRenderItem(fn func(int, any) *Component)
- func (sl *SortableList) SetSelected(idx int)
- func (sl *SortableList) SetShowHandles(v bool)
- func (sl *SortableList) SetSize(w, h float64)
- func (sl *SortableList) SetUpdateItem(fn func(int, any, *Component))
- func (sl *SortableList) SortableListScrollBar() *ScrollBar
- func (sl *SortableList) Update()
- type SortableListGroup
- type SortableTreeItem
- type SortableTreeList
- func (st *SortableTreeList) BindSelected(ref *Ref[int])
- func (st *SortableTreeList) CollapseAll()
- func (st *SortableTreeList) Dispose()
- func (st *SortableTreeList) ExpandAll()
- func (st *SortableTreeList) IndentSelected()
- func (st *SortableTreeList) IsExpanded(id string) bool
- func (st *SortableTreeList) Items() []SortableTreeItem
- func (st *SortableTreeList) MoveSelectedDown()
- func (st *SortableTreeList) MoveSelectedUp()
- func (st *SortableTreeList) OutdentSelected()
- func (st *SortableTreeList) Selected() int
- func (st *SortableTreeList) SetAllowCrossLevel(v bool)
- func (st *SortableTreeList) SetAllowReparent(v bool)
- func (st *SortableTreeList) SetExpanded(id string, v bool)
- func (st *SortableTreeList) SetItems(items []SortableTreeItem)
- func (st *SortableTreeList) SetOnChange(fn func(int))
- func (st *SortableTreeList) SetOnReorder(fn func(itemID, newParentID string, newIndex int))
- func (st *SortableTreeList) SetSelected(idx int)
- func (st *SortableTreeList) SetSize(w, h float64)
- func (st *SortableTreeList) Update()
- type SortableTreeListGroup
- type Spacer
- type StageManager
- func (st *StageManager) Add(screen *Screen)
- func (st *StageManager) CloseAll()
- func (st *StageManager) Remove(screen *Screen)
- func (st *StageManager) Replace(screen *Screen)
- func (st *StageManager) SetScene(s *sg.Scene)
- func (st *StageManager) Size() int
- func (st *StageManager) Top() *Screen
- func (st *StageManager) Update(dt float64)
- type StatAxis
- type StatWeb
- func (s *StatWeb) Axes() []StatAxis
- func (s *StatWeb) IsEditable() bool
- func (s *StatWeb) SetAxes(axes []StatAxis)
- func (s *StatWeb) SetEditable(v bool)
- func (s *StatWeb) SetFillEnabled(v bool)
- func (s *StatWeb) SetOnValueChanged(fn func(index int, value float64))
- func (s *StatWeb) SetSize(w, h float64)
- func (s *StatWeb) SetValue(index int, value float64)
- func (s *StatWeb) SetValues(values []float64)
- func (s *StatWeb) UpdateVisuals()
- func (s *StatWeb) Value(index int) float64
- func (s *StatWeb) Values() []float64
- type TabBar
- func (tb *TabBar) AddTab(label string, content *Component) int
- func (tb *TabBar) AddTabPage(label string, layout LayoutMode, spacing float64, padding Insets) (*Component, int)
- func (tb *TabBar) BindSelected(ref *Ref[int])
- func (tb *TabBar) Dispose()
- func (tb *TabBar) LeftArrowVisible() bool
- func (tb *TabBar) OverflowMode() TabOverflowMode
- func (tb *TabBar) RemoveTab(index int)
- func (tb *TabBar) RightArrowVisible() bool
- func (tb *TabBar) ScrollOffset() float64
- func (tb *TabBar) ScrollToTab(idx int)
- func (tb *TabBar) Selected() int
- func (tb *TabBar) SetOnChange(fn func(int))
- func (tb *TabBar) SetOverflowMode(mode TabOverflowMode)
- func (tb *TabBar) SetSelected(idx int)
- func (tb *TabBar) SetSize(w, h float64)
- func (tb *TabBar) TabCount() int
- type TabOverflowMode
- type TableColumn
- type Tag
- func (t *Tag) Selected() bool
- func (t *Tag) SetOnRemove(fn func())
- func (t *Tag) SetOnToggle(fn func(selected bool))
- func (t *Tag) SetPadding(top, right, bottom, left float64)
- func (t *Tag) SetRemovable(v bool)
- func (t *Tag) SetSelectable(v bool)
- func (t *Tag) SetSelected(v bool)
- func (t *Tag) SetSize(w, h float64)
- func (t *Tag) SetText(text string)
- func (t *Tag) SizeToContent()
- func (t *Tag) Text() string
- func (t *Tag) UpdateVisuals()
- type TagBar
- func (tb *TagBar) AddTag(text string)
- func (tb *TagBar) Dispose()
- func (tb *TagBar) RemoveTagAt(idx int)
- func (tb *TagBar) SetOnAddTag(fn func(text string))
- func (tb *TagBar) SetOnChange(fn func(tags []string))
- func (tb *TagBar) SetOnRemoveTag(fn func(text string))
- func (tb *TagBar) SetPlaceholder(text string)
- func (tb *TagBar) SetSize(w, h float64)
- func (tb *TagBar) SetTags(tags []string)
- func (tb *TagBar) Tags() []string
- func (tb *TagBar) UpdateVisuals()
- type TextArea
- func (ta *TextArea) BindValue(ref *Ref[string])
- func (ta *TextArea) ClearSelectionForTest()
- func (ta *TextArea) CursorVisualLineColForTest(pos int) (line, col int)
- func (ta *TextArea) DeleteBack()
- func (ta *TextArea) DeleteForward()
- func (ta *TextArea) DeleteSelectionForTest()
- func (ta *TextArea) Dispose()
- func (ta *TextArea) GetCursorPos() int
- func (ta *TextArea) GetScrollY() float64
- func (ta *TextArea) GetSelEnd() int
- func (ta *TextArea) GetSelStart() int
- func (ta *TextArea) GetVisualLinesForTest() []VisualLine
- func (ta *TextArea) HasSelection() bool
- func (ta *TextArea) InsertText(s string)
- func (ta *TextArea) MoveCursorDown()
- func (ta *TextArea) MoveCursorEndShiftForTest(shift bool)
- func (ta *TextArea) MoveCursorHomeShiftForTest(shift bool)
- func (ta *TextArea) MoveCursorLeft()
- func (ta *TextArea) MoveCursorPageDownShiftForTest(shift bool)
- func (ta *TextArea) MoveCursorPageUpShiftForTest(shift bool)
- func (ta *TextArea) MoveCursorRight()
- func (ta *TextArea) MoveCursorRightShiftForTest(shift bool)
- func (ta *TextArea) MoveCursorUp()
- func (ta *TextArea) MoveCursorUpShiftForTest(shift bool)
- func (ta *TextArea) ScrollBar() *ScrollBar
- func (ta *TextArea) SelectAll()
- func (ta *TextArea) SelectWordAtCursorForTest()
- func (ta *TextArea) SelectedText() string
- func (ta *TextArea) SetAllowedChars(chars string)
- func (ta *TextArea) SetAlphanumericOnly()
- func (ta *TextArea) SetCharFilter(fn func(rune) bool)
- func (ta *TextArea) SetCursorPos(pos int)
- func (ta *TextArea) SetEnabled(v bool)
- func (ta *TextArea) SetMaxLength(n int)
- func (ta *TextArea) SetNumericOnly()
- func (ta *TextArea) SetOnChange(fn func(string))
- func (ta *TextArea) SetRows(n int)
- func (ta *TextArea) SetSelEnd(v int)
- func (ta *TextArea) SetSelStart(v int)
- func (ta *TextArea) SetSize(w, h float64)
- func (ta *TextArea) SetValue(v string)
- func (ta *TextArea) Update()
- func (ta *TextArea) UpdateVisuals()
- func (ta *TextArea) Value() string
- type TextInput
- func (ti *TextInput) BindPasswordMode(ref *Ref[bool])
- func (ti *TextInput) BindValue(ref *Ref[string])
- func (ti *TextInput) ClearSelectionForTest()
- func (ti *TextInput) CursorNode() *sg.Node
- func (ti *TextInput) DeleteBack()
- func (ti *TextInput) DeleteForward()
- func (ti *TextInput) DeleteSelectionForTest()
- func (ti *TextInput) Dispose()
- func (ti *TextInput) GetCursorPos() int
- func (ti *TextInput) GetPlaceholder() string
- func (ti *TextInput) GetScrollX() float64
- func (ti *TextInput) GetSelEnd() int
- func (ti *TextInput) GetSelStart() int
- func (ti *TextInput) HasSelection() bool
- func (ti *TextInput) InsertText(s string)
- func (ti *TextInput) IsPasswordMode() bool
- func (ti *TextInput) MoveCursorEndShiftForTest(shift bool)
- func (ti *TextInput) MoveCursorHomeShiftForTest(shift bool)
- func (ti *TextInput) MoveCursorLeft()
- func (ti *TextInput) MoveCursorLeftShiftForTest(shift bool)
- func (ti *TextInput) MoveCursorRight()
- func (ti *TextInput) MoveCursorRightShiftForTest(shift bool)
- func (ti *TextInput) PasswordDots() []*sg.Node
- func (ti *TextInput) SelRectNode() *sg.Node
- func (ti *TextInput) SelRectVisible() bool
- func (ti *TextInput) SelectAll()
- func (ti *TextInput) SelectWordAtCursorForTest()
- func (ti *TextInput) SelectedText() string
- func (ti *TextInput) SetAllowedChars(chars string)
- func (ti *TextInput) SetAlphanumericOnly()
- func (ti *TextInput) SetCharFilter(fn func(rune) bool)
- func (ti *TextInput) SetCursorPos(pos int)
- func (ti *TextInput) SetEnabled(v bool)
- func (ti *TextInput) SetKeyFilter(fn func(engine.Key) bool)
- func (ti *TextInput) SetMaxLength(n int)
- func (ti *TextInput) SetNumericOnly()
- func (ti *TextInput) SetOnBlur(fn func())
- func (ti *TextInput) SetOnChange(fn func(string))
- func (ti *TextInput) SetOnSubmit(fn func(string))
- func (ti *TextInput) SetPasswordMode(v bool)
- func (ti *TextInput) SetPlaceholder(p string)
- func (ti *TextInput) SetSelEnd(v int)
- func (ti *TextInput) SetSelStart(v int)
- func (ti *TextInput) SetSize(w, h float64)
- func (ti *TextInput) SetValue(v string)
- func (ti *TextInput) SetWidth(w float64)
- func (ti *TextInput) Submit()
- func (ti *TextInput) TextNode() *sg.Node
- func (ti *TextInput) Update()
- func (ti *TextInput) UpdateSelectionRectForTest()
- func (ti *TextInput) UpdateVisuals()
- func (ti *TextInput) Value() string
- func (ti *TextInput) ValueRef() *Ref[string]
- type TextInputGroup
- type TextSpan
- type Theme
- type TileList
- func (tl *TileList) BindItems(arr *Array[ListItem])
- func (tl *TileList) BindSelected(ref *Ref[int])
- func (tl *TileList) ClearSelection()
- func (tl *TileList) Dispose()
- func (tl *TileList) EffectiveColumns() int
- func (tl *TileList) Items() []ListItem
- func (tl *TileList) PoolSize() int
- func (tl *TileList) ScrollToIndex(idx int)
- func (tl *TileList) ScrollToSelection()
- func (tl *TileList) SelectFirst()
- func (tl *TileList) SelectLast()
- func (tl *TileList) SelectNext()
- func (tl *TileList) SelectPrevious()
- func (tl *TileList) Selectable() bool
- func (tl *TileList) Selected() int
- func (tl *TileList) SelectedItem() any
- func (tl *TileList) SelectedRef() *Ref[int]
- func (tl *TileList) SetColumns(n int)
- func (tl *TileList) SetItems(items []ListItem)
- func (tl *TileList) SetOnChange(fn func(int))
- func (tl *TileList) SetRenderItem(fn func(int, any) *Component)
- func (tl *TileList) SetSelectable(enabled bool)
- func (tl *TileList) SetSelected(idx int)
- func (tl *TileList) SetSize(w, h float64)
- func (tl *TileList) SetUpdateItem(fn func(int, any, *Component))
- func (tl *TileList) TileScrollBar() *ScrollBar
- func (tl *TileList) TileScrollPos() *Ref[float64]
- func (tl *TileList) Update()
- type TimeFormat
- type TimePicker
- func (tp *TimePicker) AmPmButton() *Button
- func (tp *TimePicker) BindTime(ref *Ref[TimeValue])
- func (tp *TimePicker) Dispose()
- func (tp *TimePicker) Hour() int
- func (tp *TimePicker) HourDownButton() *Button
- func (tp *TimePicker) HourUpButton() *Button
- func (tp *TimePicker) Minute() int
- func (tp *TimePicker) MinuteDownButton() *Button
- func (tp *TimePicker) MinuteUpButton() *Button
- func (tp *TimePicker) Second() int
- func (tp *TimePicker) SecondDownButton() *Button
- func (tp *TimePicker) SecondUpButton() *Button
- func (tp *TimePicker) SetEnabled(v bool)
- func (tp *TimePicker) SetFormat(format TimeFormat)
- func (tp *TimePicker) SetOnTimeChanged(fn func(h, m, s int))
- func (tp *TimePicker) SetShowSeconds(v bool)
- func (tp *TimePicker) SetSize(w, h float64)
- func (tp *TimePicker) SetTime(h, m, s int)
- func (tp *TimePicker) UpdateVisuals()
- type TimeValue
- type ToastAnchor
- type ToastManager
- func (m *ToastManager) DismissAll()
- func (m *ToastManager) SetAnchor(corner ToastAnchor)
- func (m *ToastManager) SetFont(source *sg.FontFamily, size float64)
- func (m *ToastManager) SetMargin(x, y float64)
- func (m *ToastManager) SetMaxStack(n int)
- func (m *ToastManager) Show(message string, variant Variant, opts ...ToastOption)
- type ToastOption
- type Toggle
- func (t *Toggle) BindValue(ref *Ref[bool])
- func (t *Toggle) Dispose()
- func (t *Toggle) SetEnabled(v bool)
- func (t *Toggle) SetOnChange(fn func(bool))
- func (t *Toggle) SetValue(v bool)
- func (t *Toggle) ThumbNode() *sg.Node
- func (t *Toggle) ThumbPoly() *sg.Node
- func (t *Toggle) TrackNode() *sg.Node
- func (t *Toggle) TrackPoly() *sg.Node
- func (t *Toggle) Update(dt float32)
- func (t *Toggle) UpdateVisuals()
- func (t *Toggle) Value() bool
- type ToggleButtonBar
- func (t *ToggleButtonBar) AddButton(label string)
- func (t *ToggleButtonBar) BindButtons(arr *Array[string])
- func (t *ToggleButtonBar) BindSelected(ref *Ref[int])
- func (t *ToggleButtonBar) ButtonCount() int
- func (t *ToggleButtonBar) Dispose()
- func (t *ToggleButtonBar) EntriesIsNil() bool
- func (t *ToggleButtonBar) RemoveButton(idx int)
- func (t *ToggleButtonBar) Selected() int
- func (t *ToggleButtonBar) SetOnChange(fn func(int))
- func (t *ToggleButtonBar) SetSelected(idx int)
- func (t *ToggleButtonBar) SetSize(w, h float64)
- type ToolBar
- func (tb *ToolBar) AddItem(comp interface{ ... })
- func (tb *ToolBar) AddSeparator()
- func (tb *ToolBar) AddSpacer()
- func (tb *ToolBar) Clear()
- func (tb *ToolBar) Dispose()
- func (tb *ToolBar) Orientation() Orientation
- func (tb *ToolBar) RemoveItem(name string)
- func (tb *ToolBar) SetOrientation(o Orientation)
- func (tb *ToolBar) SetOverflowMode(mode ToolBarOverflowMode)
- func (tb *ToolBar) SetSize(w, h float64)
- func (tb *ToolBar) SetWrap(v bool)
- type ToolBarOverflowMode
- type ToolGroup
- func (tg *ToolGroup) Add(btn *IconButton)
- func (tg *ToolGroup) BindSelected(ref *Ref[int])
- func (tg *ToolGroup) ButtonCount() int
- func (tg *ToolGroup) Dispose()
- func (tg *ToolGroup) Selected() int
- func (tg *ToolGroup) SetAllowNone(v bool)
- func (tg *ToolGroup) SetOnChange(fn func(int))
- func (tg *ToolGroup) SetSelected(idx int)
- type Tooltip
- func (tt *Tooltip) Dispose()
- func (tt *Tooltip) Hide()
- func (tt *Tooltip) IsShowing() bool
- func (tt *Tooltip) SetAnchor(a TooltipAnchor)
- func (tt *Tooltip) SetClampMargin(px float64)
- func (tt *Tooltip) SetClampToScreen(v bool)
- func (tt *Tooltip) SetFadeIn(seconds float32)
- func (tt *Tooltip) SetFadeOut(seconds float32)
- func (tt *Tooltip) SetHideDelay(frames int)
- func (tt *Tooltip) SetOffset(x, y float64)
- func (tt *Tooltip) SetShowDelay(frames int)
- func (tt *Tooltip) SetSize(w, h float64)
- func (tt *Tooltip) SetText(text string, source *sg.FontFamily, size float64)
- func (tt *Tooltip) Show(x, y float64)
- type TooltipAnchor
- type TooltipManager
- type TreeList
- func (tl *TreeList) BindRoots(arr *Array[*ReactiveTreeNode])
- func (tl *TreeList) BindSelected(ref *Ref[*TreeNode])
- func (tl *TreeList) ClearSelection()
- func (tl *TreeList) Collapse(node *TreeNode)
- func (tl *TreeList) CollapseAll()
- func (tl *TreeList) Dispose()
- func (tl *TreeList) Expand(node *TreeNode)
- func (tl *TreeList) ExpandAll()
- func (tl *TreeList) FlatCount() int
- func (tl *TreeList) IsExpanded(node *TreeNode) bool
- func (tl *TreeList) LeafOnlySelection() bool
- func (tl *TreeList) PoolSize() int
- func (tl *TreeList) Selectable() bool
- func (tl *TreeList) Selected() *TreeNode
- func (tl *TreeList) SelectedRef() *Ref[*TreeNode]
- func (tl *TreeList) SetDefaultTextRenderer(source *sg.FontFamily, displaySize float64, rowW, rowH float64)
- func (tl *TreeList) SetLeafOnlySelection(enabled bool)
- func (tl *TreeList) SetOnChange(fn func(*TreeNode))
- func (tl *TreeList) SetRenderItem(fn func(*TreeNode, int) *Component)
- func (tl *TreeList) SetRoots(roots []*TreeNode)
- func (tl *TreeList) SetSelectable(enabled bool)
- func (tl *TreeList) SetSelected(node *TreeNode)
- func (tl *TreeList) SetSize(w, h float64)
- func (tl *TreeList) SetToggleIcons(expand, collapse engine.Image)
- func (tl *TreeList) Toggle(node *TreeNode)
- func (tl *TreeList) Update()
- type TreeNode
- type TreeTable
- func (tt *TreeTable) CollapseAll()
- func (tt *TreeTable) Columns() []TableColumn
- func (tt *TreeTable) Dispose()
- func (tt *TreeTable) ExpandAll()
- func (tt *TreeTable) IsExpanded(id string) bool
- func (tt *TreeTable) Node() *sg.Node
- func (tt *TreeTable) RowIDAt(idx int) string
- func (tt *TreeTable) Rows() []TreeTableRow
- func (tt *TreeTable) Selected() int
- func (tt *TreeTable) SetColumns(cols []TableColumn)
- func (tt *TreeTable) SetExpanded(id string, v bool)
- func (tt *TreeTable) SetOnRowClick(fn func(id string))
- func (tt *TreeTable) SetOnRowExpand(fn func(id string, expanded bool))
- func (tt *TreeTable) SetRows(rows []TreeTableRow)
- func (tt *TreeTable) SetSelected(idx int)
- func (tt *TreeTable) SetSize(w, h float64)
- func (tt *TreeTable) SetSortColumn(key string, dir SortDir)
- func (tt *TreeTable) VisibleRowCount() int
- type TreeTableRow
- type TwoColumnLayout
- type UIElement
- type ValidationState
- type Variant
- type VisualLine
- type WatchHandle
- type Window
- func (w *Window) Body() *Panel
- func (w *Window) BringToFront()
- func (w *Window) Close()
- func (w *Window) CloseBtn() *IconButton
- func (w *Window) Dispose()
- func (w *Window) FireResult(key string, data any)
- func (w *Window) IsModal() bool
- func (w *Window) IsMovable() bool
- func (w *Window) MinSize() (float64, float64)
- func (w *Window) ResizeFlat() *sg.Node
- func (w *Window) ResizeHandle() *sg.Node
- func (w *Window) SetCloseIcon(img engine.Image)
- func (w *Window) SetCloseable(v bool)
- func (w *Window) SetEnterResult(key string)
- func (w *Window) SetEscResult(key string)
- func (w *Window) SetMinHeight(v float64)
- func (w *Window) SetMinSize(minW, minH float64)
- func (w *Window) SetMinWidth(v float64)
- func (w *Window) SetModal(v bool)
- func (w *Window) SetModalOverlayColor(c sg.Color)
- func (w *Window) SetMovable(v bool)
- func (w *Window) SetOnClose(fn func())
- func (w *Window) SetOnModalOverlayClick(fn func())
- func (w *Window) SetOnResult(fn func(key string, data any))
- func (w *Window) SetResizable(v bool)
- func (w *Window) SetSize(width, height float64)
- func (w *Window) SetTitle(t string)
- func (w *Window) SetTitleBarHeight(h float64)
- func (w *Window) SetVisible(v bool)
- func (w *Window) SizeToContent()
- func (w *Window) TitleLabel() *Label
- type WindowManager
Constants ¶
const ( DefaultCalendarWidth = 280.0 DefaultCalendarHeight = 300.0 )
Default CalendarSelector dimensions.
const ( GradientModeH = render.GradientModeH GradientModeV = render.GradientModeV GradientModeFourCorner = render.GradientModeFourCorner )
const ( // LayoutNone uses manual positioning; children keep their own X/Y. LayoutNone = core.LayoutNone // LayoutVBox stacks children vertically with spacing between them. LayoutVBox = core.LayoutVBox // LayoutHBox stacks children horizontally with spacing between them. LayoutHBox = core.LayoutHBox // LayoutGrid arranges children in a fixed-column grid. LayoutGrid = core.LayoutGrid // LayoutFlow arranges children left-to-right, wrapping to new rows when // the available width is exceeded. LayoutFlow = core.LayoutFlow // LayoutAnchor pins each child to a corner, edge, or center of the parent // using per-child anchor metadata. Use Component.AddAnchoredChild to add // children with explicit anchor positions. LayoutAnchor = core.LayoutAnchor )
const ( AlignStart = core.AlignStart // left for VBox, top for HBox (default) AlignCenter = core.AlignCenter // center on cross-axis AlignEnd = core.AlignEnd // right for VBox, bottom for HBox AlignSpaceBetween = core.AlignSpaceBetween // distribute children evenly across main axis )
const ( Horizontal = core.Horizontal Vertical = core.Vertical )
const ( AnchorTopLeft = core.AnchorTopLeft AnchorTopCenter = core.AnchorTopCenter AnchorTopRight = core.AnchorTopRight AnchorMiddleLeft = core.AnchorMiddleLeft AnchorCenter = core.AnchorCenter AnchorMiddleRight = core.AnchorMiddleRight AnchorBottomLeft = core.AnchorBottomLeft AnchorBottomCenter = core.AnchorBottomCenter AnchorBottomRight = core.AnchorBottomRight )
const ( )
Default NavDrawer dimensions and animation.
const ( DefaultNumberStepperWidth = 120.0 DefaultNumberStepperHeight = 28.0 )
Default NumberStepper dimensions.
const ( DefaultMeterWidth = 200 DefaultMeterHeight = 20 )
Default meter bar dimensions.
const ( DefaultScrollBarWidth = 16 DefaultScrollBarLength = 200 MinScrollThumbSize = 20 )
Default scrollbar dimensions.
const ( DefaultSliderWidth = 200 DefaultSliderHeight = 20 DefaultSliderThumbSize = 16 )
Default slider dimensions.
const ( Primary = theme.Primary Secondary = theme.Secondary Accent = theme.Accent Neutral = theme.Neutral Danger = theme.Danger Success = theme.Success Warning = theme.Warning Info = theme.Info Custom1 = theme.Custom1 Custom2 = theme.Custom2 Custom3 = theme.Custom3 Custom4 = theme.Custom4 Custom5 = theme.Custom5 Custom6 = theme.Custom6 Custom7 = theme.Custom7 Custom8 = theme.Custom8 Custom9 = theme.Custom9 Custom10 = theme.Custom10 Custom11 = theme.Custom11 Custom12 = theme.Custom12 Custom13 = theme.Custom13 Custom14 = theme.Custom14 Custom15 = theme.Custom15 Custom16 = theme.Custom16 Custom17 = theme.Custom17 Custom18 = theme.Custom18 Custom19 = theme.Custom19 Custom20 = theme.Custom20 Custom21 = theme.Custom21 Custom22 = theme.Custom22 Custom23 = theme.Custom23 Custom24 = theme.Custom24 Custom25 = theme.Custom25 Custom26 = theme.Custom26 Custom27 = theme.Custom27 Custom28 = theme.Custom28 Custom29 = theme.Custom29 Custom30 = theme.Custom30 Custom31 = theme.Custom31 Custom32 = theme.Custom32 Custom33 = theme.Custom33 Custom34 = theme.Custom34 Custom35 = theme.Custom35 Custom36 = theme.Custom36 Custom37 = theme.Custom37 Custom38 = theme.Custom38 Custom39 = theme.Custom39 Custom40 = theme.Custom40 Custom41 = theme.Custom41 Custom42 = theme.Custom42 Custom43 = theme.Custom43 Custom44 = theme.Custom44 Custom45 = theme.Custom45 Custom46 = theme.Custom46 Custom47 = theme.Custom47 Custom48 = theme.Custom48 Custom49 = theme.Custom49 Custom50 = theme.Custom50 Custom51 = theme.Custom51 Custom52 = theme.Custom52 Custom53 = theme.Custom53 Custom54 = theme.Custom54 Custom55 = theme.Custom55 Custom56 = theme.Custom56 )
const ( StateDefault = core.StateDefault StateHover = core.StateHover StateActive = core.StateActive StateDisabled = core.StateDisabled StateFocus = core.StateFocus StateFocusHover = core.StateFocusHover StateFocusActive = core.StateFocusActive StateFocusDisabled = core.StateFocusDisabled )
const ( BgNone = core.BgNone BgSolid = core.BgSolid BgNineSlice = core.BgNineSlice BgGradient = core.BgGradient )
const ( DefaultTimePickerWidth = 180.0 DefaultTimePickerHeight = 80.0 )
Default TimePicker dimensions.
const ( DefaultWindowWidth = 400 DefaultWindowHeight = 300 DefaultWindowMinW = 120 DefaultWindowMinH = 80 WindowTitleBarHeight = 32 WindowResizeGripSize = 16 DefaultWindowPadding = 8 )
Default window dimensions.
const DefaultCheckboxGap = 8
DefaultCheckboxGap is the spacing between the box and label.
const DefaultCheckboxInnerSize = 12
DefaultCheckboxInnerSize is the check mark inner size.
const DefaultCheckboxSize = 20
DefaultCheckboxSize is the default box dimension.
const DefaultRadioDotSize = 10
DefaultRadioDotSize is the inner dot dimension.
const DefaultRadioGap = 8
DefaultRadioGap is the spacing between the circle and label.
const DefaultRadioSize = 20
DefaultRadioSize is the outer circle dimension.
const DefaultToggleHeight = 24
DefaultToggleHeight is the default track height.
const DefaultToggleThumbSize = 20
DefaultToggleThumbSize is the default thumb diameter.
const DefaultToggleWidth = 48
DefaultToggleWidth is the default track width.
const GlyphSize = 48
GlyphSize is the pixel width and height of each glyph cell in the default spritesheet (default-glyphs.png).
const TreeToggleSize = 16
TreeToggleSize is the default size (width and height) for tree toggle icon buttons returned by NewTreeToggle. Exported so render callbacks can use it for leaf-node spacer sizing.
Variables ¶
var ( // ParseMarkup parses XML-like markup into TextSpan slices. ParseMarkup = markup.ParseMarkup // ParseColor parses a color string in any supported format. ParseColor = markup.ParseColor )
var AutoPadding = core.AutoPadding
AutoPadding is the sentinel Insets value meaning "use the component's built-in default padding". All four fields are -1.
var DefaultColorPickerManager = &ColorPickerManager{}
DefaultColorPickerManager is the singleton used by ColorPicker widgets.
var DefaultFocusManager = NewFocusManager()
DefaultFocusManager is the package-level focus manager used by form controls. Clicking a focusable component routes through this manager so that at most one component holds focus at a time.
var DefaultInputManager = NewInputManager()
DefaultInputManager is the package-level InputManager singleton. Game logic and widgets read key state through this instead of ebiten directly.
var DefaultMenuPopupManager = &MenuPopupManager{}
DefaultMenuPopupManager is the singleton used by Select and ContextMenu.
var DefaultPopoverManager = &PopoverManager{}
DefaultPopoverManager is the singleton used by all Popover instances.
var DefaultScheduler = &reactive.DefaultScheduler
DefaultScheduler is the package-level scheduler. It points into the internal reactive package so that Ref.Set() and Computed.markDirty() enqueue to the same scheduler that external callers flush.
var DefaultStage = &StageManager{}
DefaultStage is the package-level stage singleton.
var DefaultTheme = theme.DefaultTheme
DefaultTheme is the fallback theme used when no explicit theme is set. This variable is kept for backward compatibility, but EffectiveTheme() reads *theme.DefaultThemeRef so that the root package can redirect the canonical default by setting theme.DefaultThemeRef = &willowui.DefaultTheme.
var DefaultToastManager = &ToastManager{
maxStack: 4,
marginX: 16,
marginY: 16,
fontSize: 14,
}
DefaultToastManager is the package-level singleton used by ShowToast.
var DefaultTooltipManager = &TooltipManager{Enabled: true}
DefaultTooltipManager is the package-level singleton used by all components.
var DefaultWindowManager = NewWindowManager()
DefaultWindowManager is the package-level window manager. Register windows here so they automatically sort to the top on click.
var GradientBackground = core.GradientBackground
GradientBackground creates a gradient background.
var NewColorPropStates = theme.NewColorPropStates
NewColorPropStates creates a ColorProperty from per-state colors.
var SliceBackground = core.SliceBackground
SliceBackground creates a nine-slice background.
var SolidBackground = core.SolidBackground
SolidBackground creates a solid-color background.
Functions ¶
func BindSortableListItems ¶
func BindSortableListItems[T any](sl *SortableList, items *Array[T])
BindSortableListItems binds a reactive Array[T] to a SortableList. This is a package-level generic function because Go does not support generic methods.
func GlyphScale ¶
GlyphScale returns the uniform scale factor to display img at desiredPx width. For a 48×48 spritesheet glyph displayed at 9px: GlyphScale(img, 9) ≈ 0.1875.
func IconArrowDown ¶
func IconArrowUp ¶
func IconCheckmark ¶
func IconChevronDown ¶
func IconChevronLeft ¶
func IconChevronRight ¶
func IconChevronUp ¶
func IconCloseX ¶
func IconFilter ¶
func IconGripDotsH ¶
func IconGripDotsSquare ¶
func IconGripDotsV ¶
func IconGripLinesH ¶
func IconGripLinesV ¶
func IconHamburger ¶
func IconPasswordDot ¶
func IconRadioDot ¶
func IconSearch ¶
func LayoutNineSlice ¶
func LayoutNineSlice(nodes *NineSliceNodes, ns *NineSlice, w, h float64)
LayoutNineSlice is an exported wrapper for render.LayoutNineSlice. Used for testing.
func PasswordDotGlyph ¶
PasswordDotGlyph returns the procedural dot glyph used for password masking.
func RoundedRectBorderMesh ¶
RoundedRectBorderMesh is an exported wrapper for render.RoundedRectBorderMesh. Used for testing.
func RoundedRectGradientMesh ¶
func RoundedRectGradientMesh(w, h, cornerRadius float64, segments int, g *GradientColors) ([]engine.Vertex, []uint16)
RoundedRectGradientMesh is an exported wrapper for render.RoundedRectGradientMesh. Used for testing.
func RoundedRectPoints ¶
RoundedRectPoints is an exported wrapper for render.RoundedRectPoints. Used for testing.
func SetGlyphSheet ¶
func SetGlyphSheet(pngData []byte)
SetGlyphSheet stores the raw PNG bytes of the default glyph spritesheet. Called by the root willowui package at init time.
func SetRowClickSelects ¶
func SetRowClickSelects(col *DataTableColumn, enable bool)
SetRowClickSelects configures whether clicking anywhere on a row triggers the selection toggle for a SelectionColumn. Call this on the DataTableColumn returned by SelectionColumn.
By default row-click selection is off — only clicking the checkbox/radio toggles selection. Enable it for an email-inbox-style UX where clicking the entire row selects it.
func SetScene ¶
SetScene registers the active scene so UI components can read injected keyboard input from test runners. The most recently registered non-nil scene is retained as a fallback when active scene is nil.
func SetSearchBoxFunc ¶
SetSearchBoxFunc sets the automatic search callback that returns a result slice.
func SetSearchBoxIntoFunc ¶
func SetSearchBoxIntoFunc[T any](sb *SearchBox, results *Array[T], fn func(query string, results *Array[T]))
SetSearchBoxIntoFunc sets the advanced search callback that directly mutates the result array.
func ShowToast ¶
func ShowToast(message string, variant Variant, opts ...ToastOption)
ShowToast shows a toast via DefaultToastManager with the given variant. The variant selects the semantic color (Info, Success, Warning, Danger). Pass theme.Primary or omit for the default appearance.
func SubRegion ¶
func SubRegion(base sg.TextureRegion, x, y, w, h uint16) sg.TextureRegion
SubRegion is an exported wrapper for render.SubRegion. Used for testing.
func TreeCollapseGlyph ¶
TreeCollapseGlyph returns the collapse glyph image. Used for testing.
func TreeExpandGlyph ¶
TreeExpandGlyph returns the expand glyph image. Used for testing.
func UpdateEllipsisLabel ¶
UpdateEllipsisLabel updates the text of an EllipsisLabel component.
func WordBoundaries ¶
wordBoundaries returns the start (inclusive) and end (exclusive) rune indices of the word surrounding pos. A "word" is a contiguous run of letters/digits; everything else is a contiguous run of non-word chars. WordBoundaries is the exported equivalent of wordBoundaries, for use by the root package tests.
Types ¶
type Accordion ¶
type Accordion struct {
Component
// contains filtered or unexported fields
}
Accordion is a vertically stacked list of collapsible sections, each with a header row and an arbitrary content panel.
func NewAccordion ¶
NewAccordion creates an Accordion with default settings.
func (*Accordion) AddSection ¶
func (a *Accordion) AddSection(section AccordionSection) *Accordion
AddSection appends a section to the accordion and returns the accordion for chaining.
func (*Accordion) BindExpanded ¶
BindExpanded binds the expanded section ID to a reactive Ref. In exclusive mode this is the single open section's ID (or "" when all are collapsed). In non-exclusive mode this tracks the most recently toggled section.
func (*Accordion) ExpandedID ¶
ExpandedID returns the ID of the currently expanded section (first found), or "" if none are expanded.
func (*Accordion) IsExpanded ¶
IsExpanded returns whether a section is expanded.
func (*Accordion) RemoveSection ¶
RemoveSection removes a section by ID.
func (*Accordion) Section ¶
func (a *Accordion) Section(id string) *AccordionSection
Section returns a pointer to the AccordionSection data for the given ID, or nil.
func (*Accordion) SetAnimated ¶
SetAnimated enables or disables expand/collapse animation.
func (*Accordion) SetExclusive ¶
SetExclusive sets whether only one section can be open at a time.
func (*Accordion) SetExpanded ¶
SetExpanded sets the expanded state of a section.
func (*Accordion) SetFont ¶
func (a *Accordion) SetFont(source *sg.FontFamily, size float64)
SetFont sets the font source used for section header labels.
func (*Accordion) SetOnToggle ¶
SetOnToggle sets the callback invoked when a section is toggled.
type AccordionSection ¶
type AccordionSection struct {
ID string
Label string
Icon sg.TextureRegion // zero value = no icon
Content *Component
}
AccordionSection defines a section to add to an Accordion.
type Alignment ¶
Alignment controls child positioning. Used for both cross-axis (Align) and main-axis (Justify) in VBox/HBox layouts.
type AnchorLayout ¶
type AnchorLayout struct {
Panel
}
AnchorLayout is a Panel whose Layout is pre-set to LayoutAnchor. It is a convenience wrapper around Panel + LayoutAnchor; all anchor functionality lives on Component.
Prefer using a plain Panel (or Component) with Layout = LayoutAnchor and Component.AddAnchoredChild for new code. AnchorLayout is kept for compatibility with existing code and XML templates.
func NewAnchorLayout ¶
func NewAnchorLayout(name string) *AnchorLayout
NewAnchorLayout creates an AnchorLayout container.
type AnimPlayMode ¶
type AnimPlayMode int
AnimPlayMode controls how an AnimatedImage loops.
const ( AnimPlayOnce AnimPlayMode = iota // play once, stop at last frame AnimPlayLoop // restart from frame 0 AnimPlayPingPong // reverse at each end )
type AnimatedImage ¶
type AnimatedImage struct {
Component
// contains filtered or unexported fields
}
AnimatedImage extends Image to play back a frame-strip sprite animation, cycling through regions at a configurable FPS.
func NewAnimatedImage ¶
func NewAnimatedImage(name string) *AnimatedImage
NewAnimatedImage creates an AnimatedImage widget with no frames set.
func (*AnimatedImage) CurrentFrame ¶
func (a *AnimatedImage) CurrentFrame() int
CurrentFrame returns the current frame index.
func (*AnimatedImage) FrameCount ¶
func (a *AnimatedImage) FrameCount() int
FrameCount returns the number of frames in the animation.
func (*AnimatedImage) IsPlaying ¶
func (a *AnimatedImage) IsPlaying() bool
IsPlaying returns true if the animation is currently playing.
func (*AnimatedImage) LoadGIF ¶
func (a *AnimatedImage) LoadGIF(g *gif.GIF)
LoadGIF loads frames from a decoded GIF, using its built-in per-frame delays and compositing each frame onto a full canvas.
func (*AnimatedImage) Pause ¶
func (a *AnimatedImage) Pause()
Pause halts playback without resetting the frame index.
func (*AnimatedImage) SetAtlas ¶
func (a *AnimatedImage) SetAtlas(img engine.Image, frameWidth, frameHeight int)
SetAtlas auto-slices an atlas image into frames of the given size, scanning left-to-right, top-to-bottom. Each frame is extracted via SubImage so the sprite node renders one frame at a time.
func (*AnimatedImage) SetCornerRadius ¶
func (a *AnimatedImage) SetCornerRadius(r float64)
SetCornerRadius sets the corner rounding. -1 means full pill.
func (*AnimatedImage) SetFPS ¶
func (a *AnimatedImage) SetFPS(fps float64)
SetFPS sets the playback speed in frames per second.
func (*AnimatedImage) SetFrame ¶
func (a *AnimatedImage) SetFrame(n int)
SetFrame jumps to a specific frame index.
func (*AnimatedImage) SetFrames ¶
func (a *AnimatedImage) SetFrames(frames []sg.TextureRegion)
SetFrames sets an explicit list of texture regions as animation frames.
func (*AnimatedImage) SetOnComplete ¶
func (a *AnimatedImage) SetOnComplete(fn func())
SetOnComplete sets a callback fired when a non-looping animation finishes.
func (*AnimatedImage) SetOnFrameChanged ¶
func (a *AnimatedImage) SetOnFrameChanged(fn func(frame int))
SetOnFrameChanged sets a callback fired each time the frame index changes.
func (*AnimatedImage) SetPlayMode ¶
func (a *AnimatedImage) SetPlayMode(mode AnimPlayMode)
SetPlayMode sets the loop behavior.
func (*AnimatedImage) SetScaleMode ¶
func (a *AnimatedImage) SetScaleMode(mode ImageScaleMode)
SetScaleMode sets how the current frame is scaled within the widget bounds.
func (*AnimatedImage) SetSize ¶
func (a *AnimatedImage) SetSize(w, h float64)
SetSize sets the widget dimensions.
func (*AnimatedImage) SetTint ¶
func (a *AnimatedImage) SetTint(c sg.Color)
SetTint sets the color multiplied over the image.
func (*AnimatedImage) Stop ¶
func (a *AnimatedImage) Stop()
Stop halts playback and resets to frame 0.
func (*AnimatedImage) Update ¶
func (a *AnimatedImage) Update(dt float64)
Update advances the animation by dt seconds. Called automatically via OnUpdate.
func (*AnimatedImage) UpdateVisuals ¶
func (a *AnimatedImage) UpdateVisuals()
UpdateVisuals applies theme colors based on current state.
type Array ¶
func NewArrayFrom ¶
NewArrayFrom creates a reactive array from an existing slice.
type Background ¶
type Background = core.Background
Background describes how to render a component's background.
type BackgroundProperty ¶
type BackgroundProperty = theme.BackgroundProperty
BackgroundProperty holds a background value for each component state.
type BackgroundType ¶
type BackgroundType = core.BackgroundType
BackgroundType tags the kind of background rendering.
type Badge ¶
type Badge struct {
Component
// contains filtered or unexported fields
}
Badge is a small pill or dot overlay that displays a count, label, or status indicator. It supports two display modes: label mode (short text in a pill shape) and dot mode (small filled circle, no text).
func NewBadge ¶
func NewBadge(name string, source *sg.FontFamily, displaySize float64) *Badge
NewBadge creates a Badge with the given name, font source, and display size.
func (*Badge) SetCount ¶
SetCount sets the text to the string representation of n, clamped by MaxCount.
func (*Badge) SetDotMode ¶
SetDotMode enables or disables dot mode (small circle, no text).
func (*Badge) SetMaxCount ¶
SetMaxCount sets the maximum displayed count. Values above this show "N+". Default is 99. Set to 0 to disable truncation.
func (*Badge) SetPadding ¶
SetPadding overrides the theme padding with per-instance values.
func (*Badge) SizeToContent ¶
func (b *Badge) SizeToContent()
SizeToContent auto-sizes the badge to fit its content plus padding.
func (*Badge) UpdateVisuals ¶
func (b *Badge) UpdateVisuals()
UpdateVisuals applies theme colors and corner radius.
type BindHandle ¶
type BindHandle uint64
BindHandle identifies a registered keybind for later removal.
type Button ¶
type Button struct {
Component
// contains filtered or unexported fields
}
Button is an interactive component with a colored background and centered text label. Visual state (normal, hovered, pressed, disabled) is driven by theme colors and updated via UpdateVisuals.
func NewButton ¶
NewButton creates a Button with the given name, text label, font source, and display size. If displaySize is 0, the native atlas size is used.
func (*Button) BindText ¶
BindText binds the button's label to a reactive Ref[string]. The label updates automatically whenever the ref changes. Any previous binding is stopped first.
func (*Button) HasOnClickCallback ¶
HasOnClickCallback reports whether an onClick callback is registered.
func (*Button) LabelHeight ¶
LabelHeight returns the height of the button's text label.
func (*Button) LabelLabel ¶
LabelLabel returns the button's label widget, or nil if none.
func (*Button) LabelWidth ¶
LabelWidth returns the width of the button's text label.
func (*Button) SetAutoSize ¶
SetAutoSize enables or disables automatic sizing to fit text content. When enabled, the button resizes on every SetText call. When disabled (the default after any explicit SetSize call), the button keeps its current dimensions.
func (*Button) SetEnabled ¶
SetEnabled overrides Component.SetEnabled to also update visuals.
func (*Button) SetOnClick ¶
func (b *Button) SetOnClick(fn func())
SetOnClick sets the callback invoked when the button is clicked.
func (*Button) SetSize ¶
SetSize sets the button dimensions and updates the background, label position, and hit shape so the button is immediately clickable. Calling SetSize disables auto-size — the button will no longer resize when SetText is called.
func (*Button) SetText ¶
SetText updates the button's label text. If auto-size is enabled (the default), the button resizes to fit the new text content.
func (*Button) SimulateOnClick ¶
func (b *Button) SimulateOnClick()
SimulateOnClick invokes the onClick callback directly if one is set. Intended for unit tests.
func (*Button) TextOY ¶
TextOY returns the current text vertical offset from the theme. Used for testing.
func (*Button) UpdateVisuals ¶
func (b *Button) UpdateVisuals()
UpdateVisuals applies theme colors based on the current interaction state.
type CalendarSelector ¶
type CalendarSelector struct {
Component
// contains filtered or unexported fields
}
CalendarSelector is a month-grid date picker with prev/next month navigation. It supports inline mode (always visible) and popup mode (trigger button opens a floating calendar overlay via PopoverManager).
func NewCalendarSelector ¶
func NewCalendarSelector(name string, source *sg.FontFamily, displaySize float64) *CalendarSelector
NewCalendarSelector creates a CalendarSelector with today's date selected.
func (*CalendarSelector) BindDate ¶
func (cs *CalendarSelector) BindDate(ref *Ref[time.Time])
BindDate binds the selected date to a reactive Ref. Changes to the Ref update the calendar, and user selections update the Ref.
func (*CalendarSelector) ClearMaxDate ¶
func (cs *CalendarSelector) ClearMaxDate()
ClearMaxDate removes the maximum date constraint.
func (*CalendarSelector) ClearMinDate ¶
func (cs *CalendarSelector) ClearMinDate()
ClearMinDate removes the minimum date constraint.
func (*CalendarSelector) ClosePopup ¶
func (cs *CalendarSelector) ClosePopup()
ClosePopup closes the popup calendar (popup mode only).
func (*CalendarSelector) Date ¶
func (cs *CalendarSelector) Date() time.Time
Date returns the currently selected date.
func (*CalendarSelector) Dispose ¶
func (cs *CalendarSelector) Dispose()
Dispose cleans up the calendar.
func (*CalendarSelector) IsPopupMode ¶
func (cs *CalendarSelector) IsPopupMode() bool
IsPopupMode returns true if the calendar is in popup mode.
func (*CalendarSelector) NextButton ¶
func (cs *CalendarSelector) NextButton() *Button
NextButton returns the next-month navigation button.
func (*CalendarSelector) OpenPopup ¶
func (cs *CalendarSelector) OpenPopup()
OpenPopup opens the popup calendar (popup mode only).
func (*CalendarSelector) PrevButton ¶
func (cs *CalendarSelector) PrevButton() *Button
PrevButton returns the previous-month navigation button.
func (*CalendarSelector) SetDate ¶
func (cs *CalendarSelector) SetDate(t time.Time)
SetDate sets the selected date and navigates to its month.
func (*CalendarSelector) SetEnabled ¶
func (cs *CalendarSelector) SetEnabled(v bool)
SetEnabled enables or disables the calendar.
func (*CalendarSelector) SetMaxDate ¶
func (cs *CalendarSelector) SetMaxDate(t time.Time)
SetMaxDate sets the maximum selectable date.
func (*CalendarSelector) SetMinDate ¶
func (cs *CalendarSelector) SetMinDate(t time.Time)
SetMinDate sets the minimum selectable date.
func (*CalendarSelector) SetMonth ¶
func (cs *CalendarSelector) SetMonth(year, month int)
SetMonth navigates the calendar view to a specific year and month.
func (*CalendarSelector) SetOnDateSelected ¶
func (cs *CalendarSelector) SetOnDateSelected(fn func(time.Time))
SetOnDateSelected sets the callback fired when a day is clicked.
func (*CalendarSelector) SetPopupMode ¶
func (cs *CalendarSelector) SetPopupMode(v bool)
SetPopupMode switches between inline and popup display.
func (*CalendarSelector) SetSize ¶
func (cs *CalendarSelector) SetSize(w, h float64)
SetSize resizes the calendar and repositions sub-components.
func (*CalendarSelector) TriggerButton ¶
func (cs *CalendarSelector) TriggerButton() *Button
TriggerButton returns the popup mode trigger button.
func (*CalendarSelector) UpdateVisuals ¶
func (cs *CalendarSelector) UpdateVisuals()
UpdateVisuals applies theme colors to all sub-components.
type CellClipMode ¶
type CellClipMode int
CellClipMode controls how cell content is clipped when it overflows.
const ( ClipEllipsis CellClipMode = iota // truncate with "..." ClipMask // use a mask to clip content )
type CellCoord ¶
type CellCoord struct {
Row, Col int
}
CellCoord identifies a cell by row and column.
type CellStyle ¶
type CellStyle struct {
Align sg.TextAlign // text alignment within the cell
Color sg.Color // text color override (zero = theme default)
FontSize float64 // font size override (0 = table font size)
Sharpness float64 // SDF sharpness override (0 = default)
OnPostUpdate func(data any, comp *Component) // called after UpdateCell with the row data and cell component
}
CellStyle holds styling overrides for DataTable cells and headers. Zero values mean "use default" (theme color, table font/size, left-aligned).
type Checkbox ¶
type Checkbox struct {
Component
// contains filtered or unexported fields
}
Checkbox is a toggle control with a box and check mark, plus an optional label.
func NewCheckbox ¶
NewCheckbox creates a Checkbox with the given label text, font source, and display size.
func (*Checkbox) CheckboxLabel ¶
CheckboxLabel returns the optional label widget, or nil. Used for testing.
func (*Checkbox) Dispose ¶
func (c *Checkbox) Dispose()
Dispose stops reactive watches and disposes children.
func (*Checkbox) SetCheckIcon ¶
SetCheckIcon replaces the default filled-square check mark with a custom image (e.g. a pixel-art checkmark glyph). The image is rendered at 1:1 pixel scale, centered in the box.
func (*Checkbox) SetChecked ¶
SetChecked sets the checked state.
func (*Checkbox) SetEnabled ¶
SetEnabled overrides Component.SetEnabled to also update visuals.
func (*Checkbox) SetOnChange ¶
SetOnChange sets the callback invoked when checked state changes.
func (*Checkbox) UpdateVisuals ¶
func (c *Checkbox) UpdateVisuals()
UpdateVisuals applies theme colors based on current state.
type ColorPicker ¶
type ColorPicker struct {
Component
// contains filtered or unexported fields
}
ColorPicker is a swatch + label trigger that opens a floating picker popup.
func NewColorPicker ¶
func NewColorPicker(name string, source *sg.FontFamily, displaySize float64) *ColorPicker
NewColorPicker creates a new ColorPicker trigger.
func (*ColorPicker) BindValue ¶
func (cp *ColorPicker) BindValue(ref *Ref[sg.Color])
BindValue binds a *Ref[sg.Color] so the picker writes back to it.
func (*ColorPicker) Cancel ¶
func (cp *ColorPicker) Cancel()
Cancel programmatically cancels the picker, restoring the original color.
func (*ColorPicker) Close ¶
func (cp *ColorPicker) Close()
Close programmatically commits and closes the picker popup.
func (*ColorPicker) Open ¶
func (cp *ColorPicker) Open()
Open programmatically opens the picker popup.
func (*ColorPicker) SetDefaultMode ¶
func (cp *ColorPicker) SetDefaultMode(mode ColorMode)
SetDefaultMode sets the color mode shown first when the popup opens.
func (*ColorPicker) SetOnChange ¶
func (cp *ColorPicker) SetOnChange(fn func(sg.Color))
SetOnChange sets a callback invoked whenever the color changes (each drag step).
func (*ColorPicker) SetOnCommit ¶
func (cp *ColorPicker) SetOnCommit(fn func(sg.Color))
SetOnCommit sets a callback invoked when the popup closes with a committed value.
func (*ColorPicker) SetShowAlpha ¶
func (cp *ColorPicker) SetShowAlpha(show bool)
SetShowAlpha controls whether the alpha channel is editable in the popup.
func (*ColorPicker) SetSize ¶
func (cp *ColorPicker) SetSize(w, h float64)
SetSize sets the trigger dimensions.
func (*ColorPicker) SetValue ¶
func (cp *ColorPicker) SetValue(c sg.Color)
SetValue sets the current color without opening the popup.
func (*ColorPicker) UpdateVisuals ¶
func (cp *ColorPicker) UpdateVisuals()
UpdateVisuals updates the trigger's visual appearance based on state and theme.
func (*ColorPicker) Value ¶
func (cp *ColorPicker) Value() sg.Color
Value returns the current color.
type ColorPickerManager ¶
type ColorPickerManager struct {
// contains filtered or unexported fields
}
ColorPickerManager manages the single active floating color picker popup.
func (*ColorPickerManager) IsOpen ¶
func (m *ColorPickerManager) IsOpen() bool
IsOpen returns true if a picker popup is currently visible.
func (*ColorPickerManager) Show ¶
func (m *ColorPickerManager) Show(trigger *ColorPicker)
Show opens the color picker popup for the given trigger.
type ColorProperty ¶
type ColorProperty = theme.ColorProperty
ColorProperty holds a color value for each component state.
type Component ¶
type Component struct {
// Layout mode and configuration.
Layout LayoutMode
GridColumns int
Spacing float64
FlowRowGap float64 // vertical gap between rows in LayoutFlow; falls back to Spacing when zero
Align Alignment // cross-axis alignment
Justify Alignment // main-axis alignment
// Position and size.
X, Y float64
OffsetX, OffsetY float64 // user offset applied on top of layout-computed position
Width, Height float64
// Constraints.
MinWidth, MinHeight float64
MaxWidth, MaxHeight float64
// Fill stretches the child to match the parent's content dimension.
Fill FillMode
// Grow is a flex-like weight for proportional sizing in HBox/VBox.
// Children with Grow > 0 share remaining space after fixed children.
Grow int
// Insets.
Padding Insets
Margin Insets
// Focus navigation flags. Disabled by default; interactive widgets
// opt in by setting these in their constructors.
Focusable bool // can receive keyboard focus
AllowTab bool // participates in Tab/Shift+Tab cycling
AllowSpatial bool // participates in arrow-key spatial navigation
InterceptArrows bool // wants to handle arrow keys before spatial nav
ConsumeHandledKeys bool // when HandleKey returns true, also consume from InputManager (default true)
// contains filtered or unexported fields
}
Component is the base type for all WillowUI widgets. It wraps a sg.Node container and provides layout, state tracking, and dirty flag propagation.
func NewComponent ¶
NewComponent creates a new Component with sensible defaults. The underlying sg.Node is a container with pointer callbacks wired for hover and pressed state tracking.
func (*Component) AddAnchoredChild ¶
AddAnchoredChild adds a child pinned to the given anchor with pixel offsets. The parent's Layout must be LayoutAnchor for anchor positioning to take effect.
func (*Component) AddChild ¶
AddChild appends a child component. Both the Component tree and the underlying willow Node tree are updated. Accepts any UIElement (all widget types implement this interface).
func (*Component) AddRawChild ¶
AddRawChild adds a raw willow node as a child of this component's node. Use this when adding nodes that are not WillowUI components, such as nodes created with willow.NewSprite or willow.NewText.
func (*Component) AddToNode ¶
AddToNode adds this component's node as a child of parent. It also applies any pending layout so components with VBox/HBox children position correctly without requiring a Screen controller.
func (*Component) AddToScene ¶
AddToScene adds this component to the scene root node. It also applies any pending layout so components with VBox/HBox children position correctly without requiring a Screen controller.
func (*Component) AnchorOf ¶
AnchorOf returns the anchor metadata for a child. Returns false if the child is not a direct child or has no explicit anchor data (defaults apply).
func (*Component) ApplyBackgroundForTest ¶
func (c *Component) ApplyBackgroundForTest(bg Background)
ApplyBackgroundForTest calls the internal applyBackground method. Intended for unit tests that need to drive background-switching logic directly.
func (*Component) ApplyBorderForTest ¶
func (c *Component) ApplyBorderForTest(color sg.Color, width float64, bg Background)
ApplyBorderForTest calls the internal applyBorder method. Intended for unit tests that need to drive border-switching logic directly.
func (*Component) BgContainer ¶
BgContainer returns the component's nine-slice container node, or nil if none has been created yet. Used for testing nine-slice background state.
func (*Component) BgGradientMesh ¶
BgGradientMesh returns the component's gradient mesh node, or nil if none has been created. Used for testing gradient background state.
func (*Component) BgNode ¶
BgNode returns the component's background willow node, or nil if none has been initialized. Used for testing visual state.
func (*Component) BgPoly ¶
BgPoly returns the background polygon node (for rounded corners). Used for testing.
func (*Component) BindEnabled ¶
BindEnabled binds the component's enabled state to a reactive Ref[bool]. Any previous binding is stopped first.
func (*Component) BindVisible ¶
BindVisible binds the component's visibility to a reactive Ref[bool]. Any previous binding is stopped first.
func (*Component) BorderLeft ¶
BorderLeft returns the left border node, or nil if not initialized.
func (*Component) BorderPoly ¶
BorderPoly returns the border polygon node (for rounded corners). Used for testing.
func (*Component) BorderRight ¶
BorderRight returns the right border node, or nil if not initialized.
func (*Component) BorderWidth ¶
BorderWidth returns the current border width.
func (*Component) ClearContextMenu ¶
func (c *Component) ClearContextMenu()
ClearContextMenu removes any attached context menu from this component.
func (*Component) ClearTooltip ¶
func (c *Component) ClearTooltip()
ClearTooltip removes any attached tooltip from this component.
func (*Component) Dispose ¶
func (c *Component) Dispose()
Dispose removes this component from its parent, disposes the underlying willow node, and recursively disposes all children.
func (*Component) EffectiveTheme ¶
EffectiveTheme returns the theme in effect for this component: its own if set, otherwise the nearest ancestor's, falling back to DefaultTheme if no ancestor has an explicit theme.
func (*Component) FireEvent ¶
FireEvent triggers a named custom event handler previously registered via SetOnEvent or XML template on:* bindings.
func (*Component) GetTooltip ¶
GetTooltip returns the tooltip attached to this component, or nil if none.
func (*Component) HandleKey ¶
HandleKey delegates to the component's handleKeyFn. Returns false if no handler is set. This is a pure query — it must not perform the action itself; the widget's own Update() handles the actual behavior.
func (*Component) HasBgSliceNodes ¶
HasBgSliceNodes reports whether the nine-slice sprite nodes have been created. Used for testing nine-slice lazy initialization.
func (*Component) InitBackgroundForTest ¶
InitBackgroundForTest calls the internal initBackground method. Intended for unit tests that need to set up a Component background outside of a widget constructor (e.g. to test gradient or nine-slice behaviour in isolation).
func (*Component) InitBorderForTest ¶
InitBorderForTest calls the internal initBorder method. Intended for unit tests that need to set up border nodes outside of a widget constructor.
func (*Component) IsDisposed ¶
IsDisposed reports whether the underlying node has been disposed.
func (*Component) IsDrawDirty ¶
IsDrawDirty reports whether the component needs a visual update.
func (*Component) IsInteractable ¶
IsInteractable reports whether the underlying node receives pointer events.
func (*Component) IsLayoutDirty ¶
IsLayoutDirty reports whether the component needs layout recalculation.
func (*Component) MarkDrawDirty ¶
func (c *Component) MarkDrawDirty()
MarkDrawDirty marks this component as needing a visual update.
func (*Component) MarkLayoutDirty ¶
func (c *Component) MarkLayoutDirty()
MarkLayoutDirty marks this component as needing layout recalculation. Propagates up to the parent.
func (*Component) Node ¶
Node returns the underlying willow node. Use Component methods (SetPosition, SetVisible, SetZIndex, etc.) in preference to calling Node() directly. Node() is an escape hatch for low-level willow operations not covered by Component wrappers (e.g. HitShape, Interactable, AddChild, event callbacks).
func (*Component) NumChildren ¶
NumChildren returns the number of child components.
func (*Component) OnClick ¶
func (c *Component) OnClick(fn func(sg.ClickContext))
OnClick registers a click callback on the underlying node. If no hit shape has been established yet and the component has dimensions, one is created automatically so the component becomes a pointer target.
func (*Component) RemoveChild ¶
RemoveChild detaches a child component from this component.
func (*Component) RemoveRawChild ¶
RemoveRawChild removes a raw willow node from this component's node.
func (*Component) ResizeBackgroundForTest ¶
ResizeBackgroundForTest calls the internal resizeBackground method. Intended for unit tests that need to drive background resize logic directly.
func (*Component) ResizeBorderForTest ¶
ResizeBorderForTest calls the internal resizeBorder method. Intended for unit tests that need to drive border resize logic directly.
func (*Component) SetAnchor ¶
SetAnchor changes the anchor and offset for an existing child. Has no effect if child is not a direct child of this component.
func (*Component) SetContextMenu ¶
func (c *Component) SetContextMenu(cm *ContextMenu)
SetContextMenu attaches a ContextMenu to this component. Right-clicking the component will show the menu at the cursor position.
func (*Component) SetCursorShape ¶
func (c *Component) SetCursorShape(shape engine.CursorShapeType)
SetCursorShape sets the cursor shape shown when hovering over this component. Use engine.CursorShapeDefault to clear any override.
func (*Component) SetEnabled ¶
SetEnabled sets whether the component responds to input.
func (*Component) SetFocused ¶
SetFocused sets the focus state directly. Prefer using FocusManager.SetFocus for proper focus tracking across the UI.
func (*Component) SetHandleKey ¶
SetHandleKey sets the function called by HandleKey. Widgets with InterceptArrows set this in their constructor.
func (*Component) SetHitShape ¶
SetHitShape sets the hit-test shape for the underlying node.
func (*Component) SetInteractable ¶
SetInteractable sets whether the underlying node receives pointer events. Unlike SetEnabled, this does not affect visual state tracking.
func (*Component) SetOnActivate ¶
func (c *Component) SetOnActivate(fn func())
SetOnActivate sets the callback invoked when this component is activated (e.g. a Window being brought to front, or a generic click handler via templates).
func (*Component) SetOnEvent ¶
SetOnEvent registers a named event handler for use with XML template on:* bindings. Custom widgets call FireEvent(name) to trigger the handler.
func (*Component) SetOnThemeChangeForTest ¶
func (c *Component) SetOnThemeChangeForTest(fn func())
SetOnThemeChangeForTest sets the onThemeChange callback. Used for testing.
func (*Component) SetOnTooltipHide ¶
func (c *Component) SetOnTooltipHide(fn func())
SetOnTooltipHide registers a callback that fires just after the tooltip is hidden.
func (*Component) SetOnTooltipShow ¶
func (c *Component) SetOnTooltipShow(fn func())
SetOnTooltipShow registers a callback that fires just before the tooltip becomes visible. Use this to update tooltip content dynamically.
func (*Component) SetPosition ¶
SetPosition sets the component position in local parent space. This forwards to the underlying node while keeping layout fields in sync.
func (*Component) SetTheme ¶
SetTheme sets an explicit theme on this component. Pass nil to revert to parent inheritance. Propagates to descendants.
func (*Component) SetTooltip ¶
SetTooltip attaches a tooltip to this component, replacing any existing one. Pass nil to clear.
func (*Component) SetTooltipText ¶
func (c *Component) SetTooltipText(text string, source *sg.FontFamily, size float64)
SetTooltipText is a convenience method that creates a single-label tooltip and attaches it to this component.
func (*Component) SetUserData ¶
SetUserData sets the UserData field of the underlying node.
func (*Component) SetVariant ¶
SetVariant sets the visual variant for this component.
func (*Component) SetVisible ¶
SetVisible sets the component's visibility.
func (*Component) SimulateDirtyDraw ¶
SimulateDirtyDraw sets the dirtyDraw flag directly. Intended for unit tests that need to reset dirty state before testing MarkDrawDirty.
func (*Component) SimulateHover ¶
SimulateHover sets the hovered state directly. Intended for unit tests that need to drive visual-state logic without a running input pipeline.
func (*Component) SimulatePress ¶
SimulatePress sets the pressed state directly. Intended for unit tests that need to drive visual-state logic without a running input pipeline.
func (*Component) SizeToContent ¶
func (c *Component) SizeToContent()
SizeToContent resizes the component to tightly fit its children based on the current layout mode (VBox or HBox). Children should already have their sizes set. After resizing, UpdateLayout is called to reposition children.
func (*Component) State ¶
func (c *Component) State() ComponentState
State returns the current ComponentState.
func (*Component) UpdateLayout ¶
func (c *Component) UpdateLayout()
UpdateLayout recalculates position and size of this component and its children, then syncs the results to the underlying willow nodes.
func (*Component) WorldBounds ¶
WorldBounds returns the component's bounding rectangle in world-space coordinates using the underlying node's transform.
func (*Component) WorldCenter ¶
WorldCenter returns the component's center point in world-space coordinates.
type ComponentState ¶
type ComponentState = core.ComponentState
ComponentState represents the visual state of a component.
type Computed ¶
type Computed[T comparable] = reactive.Computed[T]
func NewComputed ¶
func NewComputed[T comparable](fn func() T) *Computed[T]
NewComputed creates a new computed reactive value.
type ContextMenu ¶
type ContextMenu struct {
// contains filtered or unexported fields
}
ContextMenu is a list of items that can be shown at an arbitrary position, typically on right-click. Attach it to a Component via SetContextMenu.
func NewContextMenu ¶
func NewContextMenu(source *sg.FontFamily, displaySize float64) *ContextMenu
NewContextMenu creates a ContextMenu with the given font source and display size.
func (*ContextMenu) Hide ¶
func (c *ContextMenu) Hide()
Hide closes the context menu if it is currently open.
func (*ContextMenu) SetItems ¶
func (c *ContextMenu) SetItems(items []MenuItem)
SetItems replaces the item list.
func (*ContextMenu) SetVariant ¶
func (c *ContextMenu) SetVariant(v Variant)
SetVariant sets the theme variant for the popup.
func (*ContextMenu) ShowAt ¶
func (c *ContextMenu) ShowAt(x, y float64)
ShowAt opens the menu with its top-left at (x, y) in world/screen coordinates.
type Controller ¶
type Controller interface {
// OnCreate is called once when the screen is shown. Build UI here.
OnCreate(screen *Screen)
// OnUpdate is called once per frame during the UI update pass.
OnUpdate(dt float64)
// OnDestroy is called when the screen is destroyed. Clean up here.
OnDestroy()
}
Controller is implemented by per-screen state owners that build UI, run per-frame logic, and clean up resources.
type DataTable ¶
type DataTable struct {
Component
// contains filtered or unexported fields
}
DataTable is a virtualized, sortable, filterable data grid widget.
func NewDataTable ¶
NewDataTable creates a DataTable with the given name and row height.
func (*DataTable) AddColumn ¶
func (dt *DataTable) AddColumn(col DataTableColumn)
AddColumn appends a column definition.
func (*DataTable) BindItems ¶
BindItems binds the DataTable to a reactive Array[any]. Mutations to the array are reflected incrementally without full re-renders where possible.
func (*DataTable) BindScrollPos ¶
BindScrollPos binds an external Ref[float64] to the scroll position.
func (*DataTable) BindSearchFilter ¶
BindSearchFilter binds a reactive string ref to the search filter. Columns with Searchable=true and SearchValue set are filtered when the ref changes.
func (*DataTable) BindSearchInput ¶
BindSearchInput binds a TextInput's reactive value to the search filter.
func (*DataTable) BindSelectedIndexes ¶
BindSelectedIndexes binds selection state to external getter/setter functions. When the DataTable selection changes, setFn is called with the new indexes. When external code changes the selection, call SetSelectedIndexes to push it in.
func (*DataTable) ClearColumnFilter ¶
ClearColumnFilter removes the per-column filter for the given column.
func (*DataTable) ClearSelection ¶
func (dt *DataTable) ClearSelection()
ClearSelection deselects all rows.
func (*DataTable) DataTableDisplayCount ¶
DataTableDisplayCount returns the number of rows currently displayed (after filter/sort).
func (*DataTable) DataTableDisplayIndexes ¶
DataTableDisplayIndexes returns a copy of the current display index order.
func (*DataTable) DataTableScrollBar ¶
DataTableScrollBar returns the internal scrollbar for testing.
func (*DataTable) DataTableScrollPos ¶
DataTableScrollPos returns the reactive scroll position ref for testing.
func (*DataTable) DataTableSelectedIndexes ¶
DataTableSelectedIndexes returns the current selection (data indexes).
func (*DataTable) DeselectRow ¶
DeselectRow removes the given data index from the selection.
func (*DataTable) Dispose ¶
func (dt *DataTable) Dispose()
Dispose cleans up watches and child components.
func (*DataTable) IsSelected ¶
IsSelected returns whether the given data index is selected.
func (*DataTable) OnColumn ¶
func (dt *DataTable) OnColumn(key string, col DataTableColumn)
OnColumn merges render/update funcs into an existing column identified by key. Used to attach RenderCell/UpdateCell factories after loading columns from XML.
func (*DataTable) Rebuild ¶
func (dt *DataTable) Rebuild()
Rebuild marks the layout as dirty, triggering a full re-layout on the next frame. This recreates all row slots from scratch, so it picks up structural changes like column additions, row height changes, or Label style updates. Not needed for normal operations (scrolling, sorting, filtering, selection, binding new data) — those reuse existing slots automatically.
func (*DataTable) Refresh ¶
func (dt *DataTable) Refresh()
Refresh marks data as dirty, triggering a slot rebuild on the next frame.
func (*DataTable) ResetFiltersAndSort ¶
func (dt *DataTable) ResetFiltersAndSort()
ResetFiltersAndSort clears all sort keys, filters, search, and column filters, scrolls to top, and rebuilds.
func (*DataTable) ScrollToBottom ¶
func (dt *DataTable) ScrollToBottom()
ScrollToBottom scrolls to the bottom of the table.
func (*DataTable) ScrollToRow ¶
ScrollToRow scrolls so the given original-array index is visible.
func (*DataTable) ScrollToTop ¶
func (dt *DataTable) ScrollToTop()
ScrollToTop scrolls to the top of the table.
func (*DataTable) SelectAll ¶
func (dt *DataTable) SelectAll()
SelectAll selects all rows (multi-selection mode only; no-op otherwise).
func (*DataTable) SelectedIndexes ¶
SelectedIndexes returns the current selected data indexes (into items slice).
func (*DataTable) SetColumnFilter ¶
SetColumnFilter sets the allowed values for a per-column filter. Only rows whose column SearchValue is in values will be shown.
func (*DataTable) SetColumns ¶
func (dt *DataTable) SetColumns(cols []DataTableColumn)
SetColumns replaces all columns.
func (*DataTable) SetDefaultSort ¶
func (dt *DataTable) SetDefaultSort(key string, dir SortDirection)
SetDefaultSort sets the default sort applied when sortKeys is empty (e.g. on BindItems).
func (*DataTable) SetEmptyComponent ¶
SetEmptyComponent sets a component to display when the table has no visible rows.
func (*DataTable) SetFilterFunc ¶
SetFilterFunc sets a function to filter visible rows. Pass nil to clear the filter; scroll position is reset to top.
func (*DataTable) SetFont ¶
func (dt *DataTable) SetFont(source *sg.FontFamily, size float64)
SetFont sets the font source and display size used for header text and default cell labels. Must be called before SetItems/BindItems so cells pick up the font.
func (*DataTable) SetHeaderHeight ¶
SetHeaderHeight sets the height of the header row.
func (*DataTable) SetOnCellClick ¶
SetOnCellClick sets the callback for cell click events.
func (*DataTable) SetOnCellDoubleClick ¶
SetOnCellDoubleClick sets the callback for cell double-click events.
func (*DataTable) SetOnMultiSort ¶
SetOnMultiSort sets the callback invoked on multi-sort changes.
func (*DataTable) SetOnSelectionChanged ¶
SetOnSelectionChanged sets the callback for selection changes.
func (*DataTable) SetOnSort ¶
func (dt *DataTable) SetOnSort(fn func(key string, dir SortDirection))
SetOnSort sets the callback invoked when the sort column/direction changes. When registered, the DataTable does NOT apply sorting internally — the caller owns sort logic.
func (*DataTable) SetOnSortScroll ¶
func (dt *DataTable) SetOnSortScroll(v OnSortScroll)
SetOnSortScroll sets the scroll behavior after sorting.
func (*DataTable) SetRowClickSelects ¶
SetRowClickSelects enables/disables selection on row click.
func (*DataTable) SetRowHeight ¶
SetRowHeight sets the height of each data row.
func (*DataTable) SetScrollMode ¶
func (dt *DataTable) SetScrollMode(m ScrollMode)
SetScrollMode switches between virtual and static scroll modes.
func (*DataTable) SetSelectedIndexes ¶
SetSelectedIndexes replaces the selection from external code and refreshes visuals.
func (*DataTable) SetSelectionMode ¶
func (dt *DataTable) SetSelectionMode(m SelectionMode)
SetSelectionMode sets the selection behavior.
func (*DataTable) SetShowColumnDividers ¶
SetShowColumnDividers shows/hides vertical dividers between columns.
func (*DataTable) SetShowHeader ¶
SetShowHeader controls whether the header row is visible.
func (*DataTable) SetShowRowDividers ¶
SetShowRowDividers shows/hides horizontal dividers between rows.
func (*DataTable) SetShowScrollBar ¶
SetShowScrollBar controls whether the scrollbar is shown.
func (*DataTable) SetSortKeys ¶
SetSortKeys replaces the entire sort key stack.
func (*DataTable) SetSortedColumn ¶
func (dt *DataTable) SetSortedColumn(key string, dir SortDirection)
SetSortedColumn programmatically sets a single sort column and direction. Clears any multi-column sort.
func (*DataTable) SetZebraStriping ¶
SetZebraStriping enables or disables alternating row backgrounds.
func (*DataTable) SortedColumn ¶
func (dt *DataTable) SortedColumn() (string, SortDirection)
SortedColumn returns the first sort column key and direction. For multi-sort use SortKeys().
func (*DataTable) ToggleRowSelection ¶
ToggleRowSelection toggles selection of the given data index.
type DataTableColumn ¶
type DataTableColumn struct {
Key string
Header string
Tooltip string
Weight float64 // flex weight (0 means use FixedWidth)
FixedWidth float64 // fixed pixel width (0 means use Weight)
MinWidth float64 // minimum pixel width for flex columns
MaxWidth float64 // maximum pixel width for flex columns
Sortable bool
Filterable bool // enables per-column filter UI
SortType SortType
SortValue func(data any) any // override sort key; returns string or number
Comparator func(a, b any) int // used when SortType == SortCustom
Searchable bool
SearchValue func(data any) string // used by BindSearchFilter; Searchable must also be true
RenderCell func(rowIndex int, data any) *Component
UpdateCell func(rowIndex int, data any, comp *Component)
Cell CellStyle // styling and post-update hook for data cells
HeaderStyle CellStyle // styling overrides for the header text
ClipMode CellClipMode
// Hidden returns true when this column should collapse to zero width and
// not render any content. The function is called during layout resolution,
// so the result can change dynamically (e.g. bound to a reactive Ref).
// A nil Hidden func means the column is always visible.
Hidden func() bool
// contains filtered or unexported fields
}
DataTableColumn defines a column in a DataTable.
func LabelColumn ¶
func LabelColumn(key, header string, accessor func(data any) string) DataTableColumn
LabelColumn creates a simple text-label column with the given key, header and accessor.
func MeterColumn ¶
func MeterColumn(key, header string, accessor func(data any) float64) DataTableColumn
MeterColumn creates a column that renders an inline MeterBar for each row. The accessor returns a float64 in [0, 1]. Use Cell.OnPostUpdate to customize the fill color dynamically.
func SelectionColumn ¶
func SelectionColumn(key string, visible, multi *Ref[bool]) DataTableColumn
SelectionColumn creates a column that renders a selection indicator (checkbox or radio button) for each row. The column is designed for "batch mode" UX patterns — hide it in normal viewing mode and show it when the user activates batch operations.
Parameters:
key: unique column key (used internally and for identification).
visible: reactive bool that controls column visibility. When false the column collapses to zero width and its header/cells are hidden. Bind this to a button or toggle to let users enter/exit batch mode.
multi: reactive bool that controls the selection widget type. true renders checkboxes (multi-select), false renders radio dots (single-select). Switching at runtime swaps the widget in every visible cell.
The column is non-sortable, non-searchable, and uses a fixed width of 36px. Selection state is owned by the DataTable — this column is purely the visual companion to the table's SelectionMode / SelectedIndexes API.
The DataTable's SelectionMode must match the multi flag for consistent behavior: SelectionModeMulti when multi is true, SelectionModeSingle when false. The column does NOT change SelectionMode automatically.
Example:
selVisible := ui.NewRef(false)
selMulti := ui.NewRef(true)
cols := []ui.DataTableColumn{
ui.SelectionColumn("sel", selVisible, selMulti),
ui.LabelColumn("name", "Name", func(d any) string { ... }),
}
table := ui.NewDataTable("tbl", 30)
table.SetColumns(cols)
table.SetSelectionMode(ui.SelectionModeMulti)
// Toggle batch mode from a button:
selVisible.Set(true)
type DragGripStyle ¶
type DragGripStyle int
DragGripStyle specifies the visual indicator rendered on a DragHandle.
const ( DragGripDots DragGripStyle = iota // dot grid DragGripLines // parallel short lines DragGripNone // invisible hit target, no visual )
type DragHandle ¶
type DragHandle struct {
Component
// contains filtered or unexported fields
}
DragHandle is a visible grip primitive that emits drag delta events and can optionally resize a target component directly.
func NewDragHandle ¶
func NewDragHandle(name string) *DragHandle
NewDragHandle creates a DragHandle with default dot grip style.
func (*DragHandle) ClearTarget ¶
func (dh *DragHandle) ClearTarget()
ClearTarget removes the resize target, switching to delegate mode.
func (*DragHandle) GripNodes ¶
func (dh *DragHandle) GripNodes() []*sg.Node
GripNodes returns the grip child nodes. Used for testing.
func (*DragHandle) GripStyle ¶
func (dh *DragHandle) GripStyle() DragGripStyle
GripStyle returns the current grip style.
func (*DragHandle) SetAxis ¶
func (dh *DragHandle) SetAxis(axis DragAxis)
SetAxis sets the drag axis.
func (*DragHandle) SetEnabled ¶
func (dh *DragHandle) SetEnabled(v bool)
SetEnabled overrides Component.SetEnabled to also update visuals.
func (*DragHandle) SetGripStyle ¶
func (dh *DragHandle) SetGripStyle(style DragGripStyle)
SetGripStyle sets the visual grip indicator style.
func (*DragHandle) SetMax ¶
func (dh *DragHandle) SetMax(v float64)
SetMax sets the maximum constraint for resize mode.
func (*DragHandle) SetMin ¶
func (dh *DragHandle) SetMin(v float64)
SetMin sets the minimum constraint for resize mode.
func (*DragHandle) SetOnDrag ¶
func (dh *DragHandle) SetOnDrag(fn func(delta float64))
SetOnDrag sets the callback fired on each drag move with the total delta.
func (*DragHandle) SetOnDragEnd ¶
func (dh *DragHandle) SetOnDragEnd(fn func(value float64))
SetOnDragEnd sets the callback fired on drag release with the final value.
func (*DragHandle) SetOnDragStart ¶
func (dh *DragHandle) SetOnDragStart(fn func())
SetOnDragStart sets the callback fired when a drag begins.
func (*DragHandle) SetSize ¶
func (dh *DragHandle) SetSize(w, h float64)
SetSize sets the handle dimensions (the entire area is the hit target).
func (*DragHandle) SetTarget ¶
func (dh *DragHandle) SetTarget(comp *Component)
SetTarget sets the component to resize during drag.
func (*DragHandle) Target ¶
func (dh *DragHandle) Target() *Component
Target returns the current resize target, or nil. Used for testing.
func (*DragHandle) UpdateVisuals ¶
func (dh *DragHandle) UpdateVisuals()
UpdateVisuals applies theme colors based on current state.
type FillMode ¶
type FillMode int
FillMode controls how a component stretches to fill its parent's content area.
type FloatProperty ¶
type FloatProperty = theme.FloatProperty
FloatProperty holds a float64 value for each component state.
type FocusManager ¶
type FocusManager struct {
// contains filtered or unexported fields
}
FocusManager tracks which component has keyboard focus. Owns UI keyboard dispatch: widget interception, scoped and global hotkeys/keybinds, Tab cycling, and spatial navigation.
func NewFocusManager ¶
func NewFocusManager() *FocusManager
NewFocusManager creates an empty focus manager wired to the DefaultInputManager.
func (*FocusManager) Bind ¶
func (fm *FocusManager) Bind(combo KeyCombo, fn func() bool) BindHandle
Bind registers a global keybind that fires regardless of focus. The callback returns true to consume the key from InputManager, false to let it pass through. Returns a handle for later removal via Unbind.
func (*FocusManager) BindScoped ¶
func (fm *FocusManager) BindScoped(comp *Component, combo KeyCombo, fn func() bool)
BindScoped registers a keybind that fires only when comp (or a descendant) is focused. Automatically removed when the component is unregistered or disposed.
func (*FocusManager) ClearFocus ¶
func (fm *FocusManager) ClearFocus()
ClearFocus removes focus from the currently focused component.
func (*FocusManager) Focused ¶
func (fm *FocusManager) Focused() *Component
Focused returns the currently focused component, or nil.
func (*FocusManager) Register ¶
func (fm *FocusManager) Register(c *Component)
Register adds a component to the tab order. Duplicates are ignored.
func (*FocusManager) SetFocus ¶
func (fm *FocusManager) SetFocus(c *Component)
SetFocus gives focus to c, removing it from the previously focused component. Passing nil clears focus.
func (*FocusManager) TabNext ¶
func (fm *FocusManager) TabNext()
TabNext moves focus to the next component in tab order that has AllowTab, wrapping around. If nothing is focused, focuses the first eligible.
func (*FocusManager) TabPrev ¶
func (fm *FocusManager) TabPrev()
TabPrev moves focus to the previous component in tab order that has AllowTab, wrapping around. If nothing is focused, focuses the last eligible.
func (*FocusManager) Unbind ¶
func (fm *FocusManager) Unbind(handle BindHandle)
Unbind removes a global keybind by handle.
func (*FocusManager) Unregister ¶
func (fm *FocusManager) Unregister(c *Component)
Unregister removes a component from the tab order and cleans up any scoped keybinds. If it was focused, focus is cleared.
func (*FocusManager) Update ¶
func (fm *FocusManager) Update()
Update processes one frame of keyboard dispatch. Called once per frame by Screen.Update(). Must not be called by widgets directly.
Dispatch order:
- Click-outside detection (clear focus on click outside any focusable)
- Focused widget interception (InterceptArrows → HandleKey for arrow keys)
- Scoped hotkeys (focused component match)
- Global hotkeys
- Focus navigation (Tab/Shift+Tab, unhandled arrow keys → spatial nav)
type GradientColors ¶
type GradientColors = render.GradientColors
GradientColors defines per-corner colors for gradient backgrounds.
type GradientEditor ¶
type GradientEditor struct {
Component
// contains filtered or unexported fields
}
GradientEditor edits horizontal, vertical, or 4-corner gradients.
func NewGradientEditor ¶
func NewGradientEditor(name string, source *sg.FontFamily, displaySize float64) *GradientEditor
NewGradientEditor creates a GradientEditor with the given name, font source, and display size.
func (*GradientEditor) BindValue ¶
func (ge *GradientEditor) BindValue(ref *Ref[render.Gradient])
BindValue binds a *Ref[Gradient] so the editor writes back on every change.
func (*GradientEditor) SetAllowedModes ¶
func (ge *GradientEditor) SetAllowedModes(modes ...render.GradientMode)
SetAllowedModes restricts which modes appear in the mode selector. If the current mode is not in the list, the widget switches to the first allowed mode.
func (*GradientEditor) SetOnChange ¶
func (ge *GradientEditor) SetOnChange(fn func(render.Gradient))
SetOnChange sets a callback invoked on every edit (color change or mode switch).
func (*GradientEditor) SetShowModeSelector ¶
func (ge *GradientEditor) SetShowModeSelector(show bool)
SetShowModeSelector shows or hides the H | V | 4-corner tab row.
func (*GradientEditor) SetSize ¶
func (ge *GradientEditor) SetSize(w, h float64)
SetSize sets the widget dimensions and re-layouts children.
func (*GradientEditor) SetValue ¶
func (ge *GradientEditor) SetValue(g render.Gradient)
SetValue sets the current gradient without firing OnChange.
func (*GradientEditor) UpdateVisuals ¶
func (ge *GradientEditor) UpdateVisuals()
UpdateVisuals updates the visual appearance from the theme.
func (*GradientEditor) Value ¶
func (ge *GradientEditor) Value() render.Gradient
Value returns the current gradient.
type GradientMode ¶
type GradientMode = render.GradientMode
GradientMode and Gradient are re-exported from render for widget-layer use.
type IconButton ¶
type IconButton struct {
Component
// contains filtered or unexported fields
}
IconButton is an icon-first button that renders a sprite as its primary content, with an optional text label beneath or beside it. It participates in the same focus, hover, pressed, and disabled state system as Button.
func NewIconButton ¶
func NewIconButton(name string) *IconButton
NewIconButton creates an icon-only button. The icon is initially blank; call SetIconImage or SetIconKey to provide an icon source.
func NewTreeToggle ¶
func NewTreeToggle(name string, tl *TreeList, node *TreeNode) *IconButton
NewTreeToggle creates a ready-to-use IconButton for expanding/collapsing the given TreeNode within a TreeList. Returns nil for leaf nodes (no children). The button uses the Custom1 variant and tints the glyph icon with hover/active colors from the theme, following the same pattern as the window close button.
func (*IconButton) BindActive ¶
func (ib *IconButton) BindActive(ref *Ref[bool])
BindActive binds the button's active state to an external Ref[bool]. The button's active highlight reflects the ref value; clicking the button does NOT automatically toggle the ref — that is the caller's responsibility.
func (*IconButton) Dispose ¶
func (ib *IconButton) Dispose()
Dispose cleans up the button and its resources.
func (*IconButton) IconNode ¶
func (ib *IconButton) IconNode() *sg.Node
IconNode returns the button's icon willow node.
func (*IconButton) IsActive ¶
func (ib *IconButton) IsActive() bool
IsActive reports whether the button is in the active/toggled-on state.
func (*IconButton) SetActive ¶
func (ib *IconButton) SetActive(v bool)
SetActive sets the toggle-style active highlight on this button.
func (*IconButton) SetEnabled ¶
func (ib *IconButton) SetEnabled(v bool)
SetEnabled overrides Component.SetEnabled to also update visuals.
func (*IconButton) SetIconImage ¶
func (ib *IconButton) SetIconImage(img engine.Image)
SetIconImage sets the icon from a direct engine.Image override.
func (*IconButton) SetIconKey ¶
func (ib *IconButton) SetIconKey(key string)
SetIconKey sets the icon using a sprite key from the theme's sprites map. If the key is found in the effective theme, the resolved sprite image is applied; otherwise the icon is cleared to the white pixel fallback.
func (*IconButton) SetIconSize ¶
func (ib *IconButton) SetIconSize(w, h float64)
SetIconSize overrides the icon display dimensions. Pass 0,0 to restore the size from the theme (IconSize field, square by default).
func (*IconButton) SetLabel ¶
func (ib *IconButton) SetLabel(text string, source *sg.FontFamily, size float64)
SetLabel attaches an optional text label to the button.
func (*IconButton) SetLabelPosition ¶
func (ib *IconButton) SetLabelPosition(pos IconLabelPosition)
SetLabelPosition sets whether the label appears below or to the right of the icon. Defaults to IconLabelBelow.
func (*IconButton) SetOnClick ¶
func (ib *IconButton) SetOnClick(fn func())
SetOnClick sets the callback invoked when the button is clicked.
func (*IconButton) SetSize ¶
func (ib *IconButton) SetSize(w, h float64)
SetSize sets the button dimensions.
func (*IconButton) SimulateOnClick ¶
func (ib *IconButton) SimulateOnClick()
SimulateOnClick invokes the onClick callback directly if one is set. Intended for unit tests.
func (*IconButton) UpdateVisuals ¶
func (ib *IconButton) UpdateVisuals()
UpdateVisuals applies theme colors based on the current interaction state.
type IconLabelPosition ¶
type IconLabelPosition int
IconLabelPosition controls where the text label appears relative to the icon.
const ( // IconLabelBelow places the label beneath the icon (default). IconLabelBelow IconLabelPosition = iota // IconLabelRight places the label to the right of the icon. IconLabelRight )
type Image ¶
type Image struct {
Component
// contains filtered or unexported fields
}
Image is a display-only component that renders a sprite, texture region, or engine.Image with configurable fit/fill modes, tinting, and optional corner radius.
For Fill and Center modes the image is positioned so overflow extends outside the widget bounds. Clipping at the widget edge is achieved automatically when the Image is placed inside a container that uses cache or mask — bare usage renders without pixel-level clip.
func (*Image) ClearImage ¶
func (im *Image) ClearImage()
ClearImage removes the current image source, leaving the widget empty.
func (*Image) ImgPosition ¶
ImgPosition returns the pixel-space x/y position applied to the image sprite. Used for testing layout calculations.
func (*Image) ImgSize ¶
ImgSize returns the pixel-space width and height applied to the image sprite. Used for testing layout calculations.
func (*Image) ScaleMode ¶
func (im *Image) ScaleMode() ImageScaleMode
ScaleMode returns the current scale mode.
func (*Image) SetCornerRadius ¶
SetCornerRadius sets the corner rounding. -1 means full pill (half the shorter dimension). 0 means sharp corners.
func (*Image) SetImage ¶
SetImage sets the image source to a raw engine.Image. Clears any previously set TextureRegion.
func (*Image) SetRegion ¶
func (im *Image) SetRegion(region sg.TextureRegion)
SetRegion sets the image source to a TextureRegion (atlas sprite). Clears any previously set engine.Image.
func (*Image) SetScaleMode ¶
func (im *Image) SetScaleMode(mode ImageScaleMode)
SetScaleMode sets how the image is scaled within the widget bounds.
func (*Image) SizeToContent ¶
func (im *Image) SizeToContent()
SizeToContent resizes the widget to the image's native pixel dimensions. Has no effect if no image is set.
func (*Image) UpdateVisuals ¶
func (im *Image) UpdateVisuals()
UpdateVisuals applies theme colors based on current state.
type ImageCropper ¶
type ImageCropper struct {
Component
// contains filtered or unexported fields
}
ImageCropper displays an image with a draggable crop rectangle. Users can drag corner and edge handles to resize the crop region, or drag inside the crop rect to move it. The widget returns crop coordinates in image-pixel space via CropRect().
func NewImageCropper ¶
func NewImageCropper(name string) *ImageCropper
NewImageCropper creates an ImageCropper widget.
func (*ImageCropper) CropRect ¶
func (c *ImageCropper) CropRect() image.Rectangle
CropRect returns the current crop rectangle in image-pixel coordinates.
func (*ImageCropper) SetAspectRatio ¶
func (c *ImageCropper) SetAspectRatio(w, h float64)
SetAspectRatio constrains the crop to a fixed aspect ratio. Pass 0, 0 for free.
func (*ImageCropper) SetCropRect ¶
func (c *ImageCropper) SetCropRect(x, y, w, h float64)
SetCropRect sets the crop rectangle in image-pixel coordinates.
func (*ImageCropper) SetImage ¶
func (c *ImageCropper) SetImage(img engine.Image)
SetImage sets the source image.
func (*ImageCropper) SetMaxSize ¶
func (c *ImageCropper) SetMaxSize(w, h float64)
SetMaxSize sets the maximum crop size in image pixels.
func (*ImageCropper) SetMinSize ¶
func (c *ImageCropper) SetMinSize(w, h float64)
SetMinSize sets the minimum crop size in image pixels.
func (*ImageCropper) SetOnCropChanged ¶
func (c *ImageCropper) SetOnCropChanged(fn func(rect image.Rectangle))
SetOnCropChanged sets the callback fired during handle drags.
func (*ImageCropper) SetShowGrid ¶
func (c *ImageCropper) SetShowGrid(v bool)
SetShowGrid enables/disables the rule-of-thirds grid overlay.
func (*ImageCropper) SetSize ¶
func (c *ImageCropper) SetSize(w, h float64)
SetSize sets the widget dimensions.
func (*ImageCropper) UpdateVisuals ¶
func (c *ImageCropper) UpdateVisuals()
UpdateVisuals applies theme colors.
type ImageScaleMode ¶
type ImageScaleMode int
ImageScaleMode controls how the image is laid out within the widget bounds.
const ( ImageScaleStretch ImageScaleMode = iota // fill bounds exactly, ignoring aspect ratio ImageScaleFit // scale uniformly to fit inside bounds (letterbox) ImageScaleFill // scale uniformly to fill bounds (crop overflow) ImageScaleCenter // native pixel size, centered, no scaling ImageScaleTile // tile at native size to fill bounds )
type InputField ¶
type InputField struct {
Component
// contains filtered or unexported fields
}
InputField is a labeled text input widget that combines a Label, a TextInput, and an optional validation message into a single composable unit.
func NewInputField ¶
func NewInputField(name string, source *sg.FontFamily, displaySize float64) *InputField
NewInputField creates a new InputField with a label, text input, and validation message.
func (*InputField) BindValue ¶
func (f *InputField) BindValue(ref *Ref[string])
BindValue binds the input to a reactive Ref[string].
func (*InputField) ClearValidation ¶
func (f *InputField) ClearValidation()
ClearValidation resets validation state and hides the message.
func (*InputField) Dispose ¶
func (f *InputField) Dispose()
Dispose cleans up the input field and its children.
func (*InputField) Input ¶
func (f *InputField) Input() *TextInput
Input returns the inner TextInput for advanced configuration.
func (*InputField) SetEnabled ¶
func (f *InputField) SetEnabled(v bool)
SetEnabled enables or disables the entire field.
func (*InputField) SetLabel ¶
func (f *InputField) SetLabel(text string)
SetLabel sets the field label text.
func (*InputField) SetLabelPosition ¶
func (f *InputField) SetLabelPosition(pos LabelPosition)
SetLabelPosition sets whether the label is above or to the left of the input.
func (*InputField) SetMaxLength ¶
func (f *InputField) SetMaxLength(n int)
SetMaxLength limits the number of characters.
func (*InputField) SetOnBlur ¶
func (f *InputField) SetOnBlur(fn func())
SetOnBlur sets the callback fired when the input loses focus.
func (*InputField) SetOnChange ¶
func (f *InputField) SetOnChange(fn func(string))
SetOnChange sets the callback fired when text changes.
func (*InputField) SetOnSubmit ¶
func (f *InputField) SetOnSubmit(fn func(string))
SetOnSubmit sets the callback fired on Enter.
func (*InputField) SetPlaceholder ¶
func (f *InputField) SetPlaceholder(v string)
SetPlaceholder sets the placeholder text.
func (*InputField) SetReadOnly ¶
func (f *InputField) SetReadOnly(v bool)
SetReadOnly sets the input to read-only mode.
func (*InputField) SetRequired ¶
func (f *InputField) SetRequired(v bool)
SetRequired marks the field as required and appends the required marker.
func (*InputField) SetRequiredMarker ¶
func (f *InputField) SetRequiredMarker(s string)
SetRequiredMarker sets the character(s) appended to the label when required. Default "*".
func (*InputField) SetSize ¶
func (f *InputField) SetSize(w, h float64)
SetSize sets the input width and height. The label and message auto-size.
func (*InputField) SetValidationMessage ¶
func (f *InputField) SetValidationMessage(msg string)
SetValidationMessage sets the validation message text.
func (*InputField) SetValidationState ¶
func (f *InputField) SetValidationState(state ValidationState)
SetValidationState sets the validation state and updates the input border color.
func (*InputField) SetValue ¶
func (f *InputField) SetValue(v string)
SetValue sets the text content.
func (*InputField) SetWidth ¶
func (f *InputField) SetWidth(w float64)
SetWidth sets only the width; height is computed from font size.
type InputFieldGroup ¶
type InputFieldGroup = theme.InputFieldGroup
type InputManager ¶
type InputManager struct {
// contains filtered or unexported fields
}
InputManager reads all keyboard state from ebiten once per frame, tracks which keys have been consumed by UI, and exposes availability queries and event-style listeners for game logic.
func NewInputManager ¶
func NewInputManager() *InputManager
NewInputManager creates a new InputManager with empty state.
func (*InputManager) Consume ¶
func (im *InputManager) Consume(key engine.Key)
Consume marks a key as claimed by UI for this frame. Subsequent calls to IsKeyAvailable / IsKeyJustAvailable for this key will return false.
func (*InputManager) FireListeners ¶
func (im *InputManager) FireListeners()
FireListeners fires registered passthrough listeners for keys that were not consumed this frame. Must be called after FocusManager.Update() completes.
func (*InputManager) IsKeyAvailable ¶
func (im *InputManager) IsKeyAvailable(key engine.Key) bool
IsKeyAvailable returns true if the key is currently held AND was not consumed by UI this frame.
func (*InputManager) IsKeyJustAvailable ¶
func (im *InputManager) IsKeyJustAvailable(key engine.Key) bool
IsKeyJustAvailable returns true if the key was just pressed this frame AND was not consumed by UI. Uses the injection-aware wrapper so synthetically injected keys are included.
func (*InputManager) IsKeyJustReleased ¶
func (im *InputManager) IsKeyJustReleased(key engine.Key) bool
IsKeyJustReleased returns true if the key was just released this frame. Release detection is not affected by consumption — it reflects raw state.
func (*InputManager) OnKeyDown ¶
func (im *InputManager) OnKeyDown(key engine.Key, fn func()) ListenerHandle
OnKeyDown registers a callback that fires once on the frame a key is first pressed and not consumed by UI. Returns a handle for later removal.
func (*InputManager) OnKeyHeld ¶
func (im *InputManager) OnKeyHeld(key engine.Key, fn func()) ListenerHandle
OnKeyHeld registers a callback that fires every frame a key is held and not consumed by UI. Returns a handle for later removal.
func (*InputManager) OnKeyUp ¶
func (im *InputManager) OnKeyUp(key engine.Key, fn func()) ListenerHandle
OnKeyUp registers a callback that fires once on the frame a key is released, but only if the key was available (not consumed) when it was first pressed. This prevents phantom release events for keys entirely consumed by UI. Returns a handle for later removal.
func (*InputManager) RemoveListener ¶
func (im *InputManager) RemoveListener(handle ListenerHandle)
RemoveListener removes a previously registered listener by handle.
func (*InputManager) Update ¶
func (im *InputManager) Update()
Update reads all ebiten keyboard state for the current frame. Must be called once per frame before FocusManager.Update().
type Insets ¶
Insets represents spacing on four sides (top, right, bottom, left). It is an alias for render.Insets.
type KeyBinding ¶
type KeyBinding struct {
Key engine.Key
GamepadButton engine.GamepadButton
IsGamepad bool
IsUnset bool // true when no binding is assigned
// Modifier keys for combo bindings.
Ctrl bool
Shift bool
Alt bool
}
KeyBinding represents a keyboard or gamepad binding.
func (KeyBinding) DisplayName ¶
func (b KeyBinding) DisplayName() string
DisplayName returns a human-readable string for the binding (e.g. "SPACE", "Ctrl+A", "GP:0").
type KeyCombo ¶
type KeyCombo struct {
Key engine.Key
Mods ModifierMask
}
KeyCombo pairs an ebiten key with a modifier mask.
type KeybindInput ¶
type KeybindInput struct {
Component
// contains filtered or unexported fields
}
KeybindInput is a settings control that captures a keyboard or gamepad binding. It displays the current binding as a styled key cap label and enters listening mode on click to capture a new binding.
func NewKeybindInput ¶
func NewKeybindInput(name string, source *sg.FontFamily, displaySize float64) *KeybindInput
NewKeybindInput creates a KeybindInput with the given name, font source, and display size.
func (*KeybindInput) BindValue ¶
func (k *KeybindInput) BindValue(ref *Ref[KeyBinding])
BindValue binds the current key binding to a reactive Ref. Changes to the Ref update the widget, and user captures update the Ref.
func (*KeybindInput) Binding ¶
func (k *KeybindInput) Binding() KeyBinding
Binding returns the current key binding.
func (*KeybindInput) ClearBinding ¶
func (k *KeybindInput) ClearBinding()
ClearBinding unsets the current binding.
func (*KeybindInput) CombosEnabled ¶
func (k *KeybindInput) CombosEnabled() bool
CombosEnabled returns whether modifier+key combos are supported.
func (*KeybindInput) IsListening ¶
func (k *KeybindInput) IsListening() bool
IsListening returns true if the widget is in listening mode.
func (*KeybindInput) SetBinding ¶
func (k *KeybindInput) SetBinding(binding KeyBinding)
SetBinding sets the binding programmatically without entering listening mode.
func (*KeybindInput) SetCombosEnabled ¶
func (k *KeybindInput) SetCombosEnabled(v bool)
SetCombosEnabled sets whether modifier+key combos are supported. Enabled by default. Disable for games that only need single-key bindings.
func (*KeybindInput) SetEnabled ¶
func (k *KeybindInput) SetEnabled(v bool)
SetEnabled overrides Component.SetEnabled to update visuals.
func (*KeybindInput) SetListening ¶
func (k *KeybindInput) SetListening(v bool)
SetListening enters or exits listening mode.
func (*KeybindInput) SetOnBindingChanged ¶
func (k *KeybindInput) SetOnBindingChanged(fn func(binding KeyBinding))
SetOnBindingChanged sets the callback invoked after a new binding is captured.
func (*KeybindInput) SetOnConflict ¶
func (k *KeybindInput) SetOnConflict(fn func(existing KeyBinding) bool)
SetOnConflict sets the conflict check callback. Return false to reject a binding.
func (*KeybindInput) SetSize ¶
func (k *KeybindInput) SetSize(w, h float64)
SetSize sets the widget dimensions and repositions children.
func (*KeybindInput) UpdateVisuals ¶
func (k *KeybindInput) UpdateVisuals()
UpdateVisuals applies theme colors and repositions child nodes.
type Label ¶
type Label struct {
Component
// contains filtered or unexported fields
}
Label is a text display component. It wraps a willow text node and supports reactive text binding via BindText.
func EllipsisLabel ¶
EllipsisLabel creates a Label for use in cell rendering. The label uses nil font which falls back to the default font. Returns both the label and its component.
func NewLabel ¶
NewLabel creates a Label with the given name, initial text, font source, and display size. If displaySize is 0, the native atlas size is used.
func (*Label) BindText ¶
BindText binds the label to a reactive Ref[string]. The label text updates automatically whenever the ref changes. Any previous binding is stopped first. The label is immediately set to the ref's current value.
func (*Label) Dispose ¶
func (l *Label) Dispose()
Dispose stops any reactive watch and disposes the underlying component.
func (*Label) SetFont ¶
func (l *Label) SetFont(source *sg.FontFamily)
SetFont replaces the font source used for rendering and measurement.
func (*Label) SetFontSize ¶
SetFontSize sets the display size and re-measures.
func (*Label) SetSharpness ¶
SetSharpness tightens the SDF edge rendering. 0.0 = default, 1.0 = sharpest. Values around 0.5–0.7 give crisp edges without aliasing on most displays.
func (*Label) SetWrapWidth ¶
SetWrapWidth sets the maximum line width for word wrapping. Zero means no wrapping.
type LabelPosition ¶
type LabelPosition int
LabelPosition controls where the field label is placed relative to the input.
const ( LabelAbove LabelPosition = iota // default: label above the input LabelLeft // label to the left of the input )
type LayoutLineForTest ¶
type LayoutLineForTest struct {
Fragments []LineFragmentForTest
Height float64
}
LayoutLineForTest is a public view of a layoutLine for testing.
type LayoutMode ¶
type LayoutMode = core.LayoutMode
LayoutMode controls how a Component arranges its children.
type LineFragmentForTest ¶
LineFragmentForTest is a public view of a lineFragment for testing.
type List ¶
type List struct {
Component
// ItemAlign controls horizontal alignment of each rendered item within
// its cell. Default is AlignStart (left-aligned).
ItemAlign Alignment
// ItemVAlign controls vertical alignment of each rendered item within
// its cell. Default is AlignCenter.
ItemVAlign Alignment
// contains filtered or unexported fields
}
List is a virtualized vertical scrollable list. Only items visible in the viewport are rendered, and components are recycled as the user scrolls.
func (*List) BindItems ¶
BindItems binds the list to a reactive Array[ListItem]. Any mutation to the array (Push, Remove, Sort, etc.) is automatically reflected in the list without resetting the scroll position.
Pass nil to detach the current binding.
func (*List) BindSelected ¶
BindSelected binds the selection to a reactive Ref[int].
func (*List) ClearSelection ¶
func (l *List) ClearSelection()
ClearSelection deselects the current item.
func (*List) ListScrollBar ¶
ListScrollBar returns the internal scrollbar. Used for testing.
func (*List) ListScrollPos ¶
ListScrollPos returns the reactive scroll position ref. Used for testing.
func (*List) ListSelHighlight ¶
ListSelHighlight returns the selection highlight node, or nil if not created. Used for testing.
func (*List) PoolSize ¶
PoolSize returns the number of active (non-nil) components in the pool. This is useful for verifying virtualization in tests.
func (*List) ScrollToIndex ¶
ScrollToIndex scrolls so that the given item index is visible.
func (*List) ScrollToSelection ¶
func (l *List) ScrollToSelection()
ScrollToSelection scrolls so that the currently selected item is visible.
func (*List) SelectFirst ¶
func (l *List) SelectFirst()
SelectFirst selects the first item and scrolls to it.
func (*List) SelectLast ¶
func (l *List) SelectLast()
SelectLast selects the last item and scrolls to it.
func (*List) SelectNext ¶
func (l *List) SelectNext()
SelectNext moves the selection to the next item. If nothing is selected, selects the first item. Scrolls to keep the selection visible.
func (*List) SelectPrevious ¶
func (l *List) SelectPrevious()
SelectPrevious moves the selection to the previous item. If nothing is selected, selects the last item. Scrolls to keep the selection visible.
func (*List) Selectable ¶
Selectable returns whether built-in selection highlighting is enabled.
func (*List) SelectedItem ¶
SelectedItem returns the data of the currently selected item, or nil if no item is selected.
func (*List) SelectedRef ¶
SelectedRef returns the reactive Ref backing the selection index. Use this to subscribe to selection changes via WatchValue or bind to other reactive state.
func (*List) SetOnChange ¶
SetOnChange sets the callback for selection changes.
func (*List) SetRenderItem ¶
SetRenderItem sets the factory function that creates a Component for a given item index and data value.
func (*List) SetSelectable ¶
SetSelectable enables or disables built-in selection highlighting. When enabled, the list renders a background highlight behind the selected item.
func (*List) SetSelected ¶
SetSelected sets the selected item index.
type ListenerHandle ¶
type ListenerHandle uint64
ListenerHandle identifies a registered key listener for later removal.
type MaskedInput ¶
type MaskedInput struct {
Component
// AutoHeight, when true, causes SetSize to ignore the height argument
// and instead compute it automatically from the font size and theme padding.
AutoHeight bool
// contains filtered or unexported fields
}
MaskedInput is a single-line text entry field constrained by a mask pattern. The mask describes editable slot positions and literal separator characters. Supported slot characters: '9' (digit), 'a' (letter), 'A' (upper letter), 'X' (upper alphanumeric), '*' (any visible ASCII). All other characters are treated as literals.
Each mask position is rendered as its own glyph node. Clicking a filled slot positions the cursor there; clicking an empty slot or any non-slot area snaps the cursor to the first empty slot. Typing a valid character fills the current slot and automatically advances to the next slot.
func NewMaskedInput ¶
func NewMaskedInput(name string, source *sg.FontFamily, displaySize float64) *MaskedInput
NewMaskedInput creates a single-line masked input with the given font source and display size.
func (*MaskedInput) BindRawValue ¶
func (mi *MaskedInput) BindRawValue(ref *Ref[string])
BindRawValue binds the raw value (no literals) to an external Ref[string].
func (*MaskedInput) BindValue ¶
func (mi *MaskedInput) BindValue(ref *Ref[string])
BindValue binds the formatted value to an external Ref[string]. The ref is updated whenever the field value changes, and the field is updated whenever the ref changes externally.
func (*MaskedInput) CellCount ¶
func (mi *MaskedInput) CellCount() int
CellCount returns the number of rendered cells (one per mask token). Used for testing.
func (*MaskedInput) CellNodeForSlot ¶
func (mi *MaskedInput) CellNodeForSlot(slotIdx int) *sg.Node
CellNodeForSlot returns the glyph node for the given slot index. Used for testing.
func (*MaskedInput) Clear ¶
func (mi *MaskedInput) Clear()
Clear clears all slot values and resets the cursor to the start.
func (*MaskedInput) DeleteBack ¶
func (mi *MaskedInput) DeleteBack()
DeleteBack handles backspace: clears the previous slot and moves cursor back.
func (*MaskedInput) DeleteForward ¶
func (mi *MaskedInput) DeleteForward()
DeleteForward handles delete: clears the current slot without moving cursor.
func (*MaskedInput) Dispose ¶
func (mi *MaskedInput) Dispose()
Dispose stops reactive watches and disposes the component tree.
func (*MaskedInput) GetCursorPos ¶
func (mi *MaskedInput) GetCursorPos() int
GetCursorPos returns the current raw-slot cursor position. Used for testing.
func (*MaskedInput) GetSelEnd ¶
func (mi *MaskedInput) GetSelEnd() int
GetSelEnd returns the selection end raw-slot index. Used for testing.
func (*MaskedInput) GetSelStart ¶
func (mi *MaskedInput) GetSelStart() int
GetSelStart returns the selection start raw-slot index. Used for testing.
func (*MaskedInput) HasSelection ¶
func (mi *MaskedInput) HasSelection() bool
HasSelection reports whether any slots are selected.
func (*MaskedInput) InsertText ¶
func (mi *MaskedInput) InsertText(s string)
InsertText distributes pasted characters into slots starting at cursorPos. Invalid characters are skipped; literal separators in the pasted string that match the mask are also skipped.
func (*MaskedInput) IsComplete ¶
func (mi *MaskedInput) IsComplete() bool
IsComplete reports whether all editable slots are filled.
func (*MaskedInput) IsEmpty ¶
func (mi *MaskedInput) IsEmpty() bool
IsEmpty reports whether no editable slot has a value.
func (*MaskedInput) Mask ¶
func (mi *MaskedInput) Mask() string
Mask returns the current mask pattern string.
func (*MaskedInput) MaskPlaceholder ¶
func (mi *MaskedInput) MaskPlaceholder() rune
MaskPlaceholder returns the current mask placeholder character.
func (*MaskedInput) MoveCursorLeft ¶
func (mi *MaskedInput) MoveCursorLeft()
MoveCursorLeft moves the cursor one slot to the left.
func (*MaskedInput) MoveCursorRight ¶
func (mi *MaskedInput) MoveCursorRight()
MoveCursorRight moves the cursor one slot to the right.
func (*MaskedInput) Placeholder ¶
func (mi *MaskedInput) Placeholder() string
Placeholder returns the current field-level placeholder string.
func (*MaskedInput) RawToDisplayIndex ¶
func (mi *MaskedInput) RawToDisplayIndex(rawIdx int) int
RawToDisplayIndex converts a raw slot index (0..capacity) to a display character offset. rawIdx=0 is before any char (offset 0); rawIdx=n is after the n-th slot character in the display string. This is exported for testing.
func (*MaskedInput) RawValue ¶
func (mi *MaskedInput) RawValue() string
RawValue returns the filled slot characters without any literal separators.
func (*MaskedInput) SelectAll ¶
func (mi *MaskedInput) SelectAll()
SelectAll selects all editable slots.
func (*MaskedInput) SelectedText ¶
func (mi *MaskedInput) SelectedText() string
SelectedText returns the display text of the currently selected range, including any literal separator characters within the range.
func (*MaskedInput) SetCursorPos ¶
func (mi *MaskedInput) SetCursorPos(pos int)
SetCursorPos sets the raw-slot cursor position directly. Used for testing.
func (*MaskedInput) SetDebugSlots ¶
func (mi *MaskedInput) SetDebugSlots(v bool)
SetDebugSlots toggles a debug overlay that outlines each slot cell with a colored highlight, making the cell boundaries and padding visible.
func (*MaskedInput) SetEnabled ¶
func (mi *MaskedInput) SetEnabled(v bool)
SetEnabled overrides Component.SetEnabled to also update visuals.
func (*MaskedInput) SetMask ¶
func (mi *MaskedInput) SetMask(mask string)
SetMask parses and applies a new mask string, resetting all slot values. Mask characters: '9'=digit, 'a'=letter, 'A'=upper letter, 'X'=upper alphanumeric, '*'=any visible ASCII. All other characters become literals.
func (*MaskedInput) SetMaskPlaceholder ¶
func (mi *MaskedInput) SetMaskPlaceholder(ch rune)
SetMaskPlaceholder sets the character shown for unfilled editable slots. Use 0 (default) to show blank space for unfilled slots. Note: changing this after SetMask is called rebuilds the cell layout since cell widths are derived from the placeholder character.
func (*MaskedInput) SetMaxLength ¶
func (mi *MaskedInput) SetMaxLength(n int)
SetMaxLength sets an optional character cap (0 = no limit beyond mask capacity).
func (*MaskedInput) SetOnBlur ¶
func (mi *MaskedInput) SetOnBlur(fn func())
SetOnBlur sets the callback invoked when the field loses focus.
func (*MaskedInput) SetOnChange ¶
func (mi *MaskedInput) SetOnChange(fn func(string))
SetOnChange sets the callback invoked with the formatted value on any change.
func (*MaskedInput) SetOnComplete ¶
func (mi *MaskedInput) SetOnComplete(fn func(raw, formatted string))
SetOnComplete sets the callback invoked when all slots become filled.
func (*MaskedInput) SetOnIncomplete ¶
func (mi *MaskedInput) SetOnIncomplete(fn func(raw, formatted string))
SetOnIncomplete sets the callback invoked when the field transitions from complete to incomplete.
func (*MaskedInput) SetOnRawChange ¶
func (mi *MaskedInput) SetOnRawChange(fn func(string))
SetOnRawChange sets the callback invoked with the raw value on any change.
func (*MaskedInput) SetOnSubmit ¶
func (mi *MaskedInput) SetOnSubmit(fn func(string))
SetOnSubmit sets the callback invoked when Enter is pressed.
func (*MaskedInput) SetPlaceholder ¶
func (mi *MaskedInput) SetPlaceholder(p string)
SetPlaceholder sets the field-level placeholder text shown when the mask is not set or the field is completely empty and mask placeholders are disabled.
func (*MaskedInput) SetRawValue ¶
func (mi *MaskedInput) SetRawValue(v string)
SetRawValue fills slots sequentially from a raw string (no literals expected).
func (*MaskedInput) SetSize ¶
func (mi *MaskedInput) SetSize(w, h float64)
SetSize sets the widget dimensions.
func (*MaskedInput) SetValue ¶
func (mi *MaskedInput) SetValue(v string)
SetValue fills slots from a formatted string. Characters that match slot types are accepted; literal separator characters in the input are ignored.
func (*MaskedInput) SetWidth ¶
func (mi *MaskedInput) SetWidth(w float64)
SetWidth sets only the width, computing height automatically from font and padding.
func (*MaskedInput) SnapCursorToFirstEmptyForTest ¶
func (mi *MaskedInput) SnapCursorToFirstEmptyForTest()
SnapCursorToFirstEmptyForTest calls snapCursorToFirstEmpty. Used for testing.
func (*MaskedInput) Submit ¶
func (mi *MaskedInput) Submit()
Submit fires the OnSubmit callback with the current formatted value.
func (*MaskedInput) Update ¶
func (mi *MaskedInput) Update()
Update handles keyboard input, cursor blink, and visual state.
func (*MaskedInput) UpdateVisuals ¶
func (mi *MaskedInput) UpdateVisuals()
UpdateVisuals applies theme colors based on current state.
func (*MaskedInput) Value ¶
func (mi *MaskedInput) Value() string
Value returns the formatted display string (filled slots + literals).
func (*MaskedInput) VisualDisplayIdxForTest ¶
func (mi *MaskedInput) VisualDisplayIdxForTest(rawIdx int) int
VisualDisplayIdxForTest calls visualDisplayIdx. Used for testing.
type MenuBar ¶
type MenuBar struct {
Component
// contains filtered or unexported fields
}
MenuBar is a horizontal bar of labeled menu buttons that open dropdown MenuPopup panels. Provides the standard desktop-style application menu.
func NewMenuBar ¶
func NewMenuBar(name string, source *sg.FontFamily, displaySize float64) *MenuBar
NewMenuBar creates a new MenuBar with the given font source and display size.
func (*MenuBar) SetEntries ¶
func (mb *MenuBar) SetEntries(entries []MenuBarEntry)
SetEntries sets the menu entries and rebuilds the bar.
func (*MenuBar) SetEntry ¶
func (mb *MenuBar) SetEntry(index int, entry MenuBarEntry)
SetEntry replaces a single entry at the given index.
func (*MenuBar) SetOnMenuClose ¶
func (mb *MenuBar) SetOnMenuClose(fn func())
SetOnMenuClose sets a callback fired when the active menu is closed.
func (*MenuBar) SetOnMenuOpen ¶
SetOnMenuOpen sets a callback fired when a menu entry is opened.
type MenuBarEntry ¶
type MenuBarEntry struct {
Label string // displayed in the bar (e.g. "File")
Items []MenuItem // items shown when this entry is opened
}
MenuBarEntry defines one top-level menu in the bar.
type MenuBarGroup ¶
type MenuBarGroup = theme.MenuBarGroup
type MenuItem ¶
type MenuItem struct {
Label string
OnSelect func()
Disabled bool
Separator bool // if true renders as a thin divider; Label/OnSelect ignored
Shortcut string // display-only shortcut hint (e.g. "Ctrl+S"), right-aligned
}
MenuItem is a single entry in a MenuPopup.
type MenuPopup ¶
type MenuPopup struct {
// contains filtered or unexported fields
}
MenuPopup is a floating list of items displayed by MenuPopupManager. It is never added to the scene directly — Show/ShowAt go through the manager.
func NewMenuPopup ¶
func NewMenuPopup(source *sg.FontFamily, displaySize float64) *MenuPopup
NewMenuPopup creates a MenuPopup that will display items using source at displaySize.
func (*MenuPopup) SetOnDismiss ¶
func (p *MenuPopup) SetOnDismiss(fn func())
SetOnDismiss sets a callback invoked when the popup closes without a selection.
func (*MenuPopup) SetVariant ¶
SetVariant sets the theme variant used for styling.
type MenuPopupGroup ¶
type MenuPopupGroup = theme.MenuPopupGroup
type MenuPopupManager ¶
type MenuPopupManager struct {
// contains filtered or unexported fields
}
MenuPopupManager manages the single active floating menu popup. Use DefaultMenuPopupManager; do not construct your own.
func (*MenuPopupManager) Hide ¶
func (m *MenuPopupManager) Hide()
Hide closes the active popup without selection.
func (*MenuPopupManager) IsOpen ¶
func (m *MenuPopupManager) IsOpen() bool
IsOpen returns true if a popup is currently visible.
func (*MenuPopupManager) Show ¶
func (m *MenuPopupManager) Show(popup *MenuPopup, trigger *Component)
Show displays popup anchored below (or above) trigger component.
func (*MenuPopupManager) ShowAt ¶
func (m *MenuPopupManager) ShowAt(popup *MenuPopup, x, y float64)
ShowAt displays popup with top-left at (x, y).
type MeterBar ¶
type MeterBar struct {
Component
// contains filtered or unexported fields
}
MeterBar displays a horizontal bar that fills according to a value range. The default range is [0, 1]; call SetRange to use a custom range. It is non-interactive (no pointer callbacks needed).
func NewMeterBar ¶
NewMeterBar creates a meter bar with range [0, 1] and value 0.
func NewProgressBar ¶
NewProgressBar creates a MeterBar with range [0, 1]. Alias for NewMeterBar.
func (*MeterBar) BindValue ¶
BindValue binds the meter bar to a reactive Ref[float64] (0-1 normalized).
func (*MeterBar) ClearFillColor ¶
func (mb *MeterBar) ClearFillColor()
ClearFillColor removes the fill color override, reverting to the theme color.
func (*MeterBar) Dispose ¶
func (mb *MeterBar) Dispose()
Dispose stops reactive watches and disposes children.
func (*MeterBar) LabelComp ¶
LabelComp returns the progress label, or nil if not set. Used for testing.
func (*MeterBar) SetFillColor ¶
SetFillColor overrides the theme fill color with a custom color.
func (*MeterBar) SetProgress ¶
SetProgress sets the normalized 0-1 fill directly, bypassing range mapping. Used internally by BindValue.
func (*MeterBar) SetShowLabel ¶
func (mb *MeterBar) SetShowLabel(show bool, source *sg.FontFamily, displaySize float64)
SetShowLabel enables or disables a percentage label overlay.
type ModifierMask ¶
type ModifierMask uint8
ModifierMask is a bitmask of modifier keys.
const ( ModNone ModifierMask = 0 ModCtrl ModifierMask = 1 << iota // Ctrl or Cmd ModShift // Shift ModAlt // Alt / Option )
type NavDrawer ¶
type NavDrawer struct {
// contains filtered or unexported fields
}
NavDrawer is a slide-out navigation panel anchored to the left or right edge. It supports overlay mode (dims backdrop) and pinned mode (always visible, no backdrop).
func NewNavDrawer ¶
NewNavDrawer creates a NavDrawer anchored to the left edge by default.
func (*NavDrawer) BindOpen ¶
BindOpen binds the open/closed state to a reactive Ref. Changes to the Ref open or close the drawer, and user interactions update the Ref.
func (*NavDrawer) Dispose ¶
func (d *NavDrawer) Dispose()
Dispose cleans up the drawer and its children.
func (*NavDrawer) DrawerPanel ¶
DrawerPanel returns the inner drawer panel for direct access.
func (*NavDrawer) SetAnchor ¶
func (d *NavDrawer) SetAnchor(anchor NavDrawerAnchor)
SetAnchor sets which edge the drawer slides from.
func (*NavDrawer) SetAnimationDuration ¶
SetAnimationDuration sets the slide animation duration in seconds.
func (*NavDrawer) SetCloseOnBackdropClick ¶
SetCloseOnBackdropClick sets whether clicking the backdrop closes the drawer.
func (*NavDrawer) SetContent ¶
SetContent sets the drawer's content component.
func (*NavDrawer) SetOnClose ¶
func (d *NavDrawer) SetOnClose(fn func())
SetOnClose sets the callback invoked when the drawer closes.
func (*NavDrawer) SetOnOpen ¶
func (d *NavDrawer) SetOnOpen(fn func())
SetOnOpen sets the callback invoked when the drawer opens.
func (*NavDrawer) SetPinned ¶
SetPinned sets whether the drawer is pinned open (always visible, no backdrop).
func (*NavDrawer) SetSize ¶
SetSize sets the overall NavDrawer container size (typically the full screen).
type NavDrawerAnchor ¶
type NavDrawerAnchor int
NavDrawerAnchor specifies which edge the drawer slides from.
const ( )
type NineSliceNodes ¶
type NineSliceNodes = render.NineSliceNodes
NineSliceNodes is the public type for nine-slice node collections.
func CreateNineSliceNodes ¶
func CreateNineSliceNodes(name string, container *sg.Node, ns *NineSlice) *NineSliceNodes
CreateNineSliceNodes is an exported wrapper for render.CreateNineSliceNodes. Used for testing.
type NumberStepper ¶
type NumberStepper struct {
Component
// contains filtered or unexported fields
}
NumberStepper is a numeric input that pairs a text field with decrement and increment buttons. Clicking the buttons adjusts the value by the configured step; the text field accepts direct entry. Min, max, and decimal-place display are all configurable.
func NewNumberStepper ¶
func NewNumberStepper(name string, source *sg.FontFamily, displaySize float64) *NumberStepper
NewNumberStepper creates a NumberStepper with range (-∞, +∞), step 1, and zero decimal places.
func (*NumberStepper) BindValue ¶
func (ns *NumberStepper) BindValue(ref *Ref[float64])
BindValue binds the stepper to a reactive Ref[float64] for two-way sync. External changes to the ref update the stepper; stepper changes update the ref.
func (*NumberStepper) DecrementButton ¶
func (ns *NumberStepper) DecrementButton() *Button
DecrementButton returns the "-" button. Useful for styling.
func (*NumberStepper) Dispose ¶
func (ns *NumberStepper) Dispose()
Dispose stops reactive watches and disposes the component tree.
func (*NumberStepper) IncrementButton ¶
func (ns *NumberStepper) IncrementButton() *Button
IncrementButton returns the "+" button. Useful for styling.
func (*NumberStepper) InputField ¶
func (ns *NumberStepper) InputField() *TextInput
InputField returns the text input. Useful for styling.
func (*NumberStepper) SetDecimals ¶
func (ns *NumberStepper) SetDecimals(n int)
SetDecimals sets how many decimal places to display and accept (default 0). Changing this also reformats the current value.
func (*NumberStepper) SetEnabled ¶
func (ns *NumberStepper) SetEnabled(v bool)
SetEnabled enables or disables the stepper and all sub-components.
func (*NumberStepper) SetMax ¶
func (ns *NumberStepper) SetMax(v float64)
SetMax sets the maximum allowed value. The current value is re-clamped.
func (*NumberStepper) SetMin ¶
func (ns *NumberStepper) SetMin(v float64)
SetMin sets the minimum allowed value. The current value is re-clamped.
func (*NumberStepper) SetOnChange ¶
func (ns *NumberStepper) SetOnChange(fn func(float64))
SetOnChange sets the callback invoked whenever the value changes.
func (*NumberStepper) SetPageStep ¶
func (ns *NumberStepper) SetPageStep(v float64)
SetPageStep sets the step size used for Page Up / Page Down (default 0, which auto-computes as step × 10).
func (*NumberStepper) SetSize ¶
func (ns *NumberStepper) SetSize(w, h float64)
SetSize resizes the stepper and repositions its sub-components. The step buttons are square (height × height); the text field fills the rest.
func (*NumberStepper) SetStep ¶
func (ns *NumberStepper) SetStep(v float64)
SetStep sets the increment/decrement step size (default 1).
func (*NumberStepper) SetValue ¶
func (ns *NumberStepper) SetValue(v float64)
SetValue sets the value, clamping it to [min, max], updates the displayed text, and fires onChange and any bound Ref.
func (*NumberStepper) Value ¶
func (ns *NumberStepper) Value() float64
Value returns the current numeric value.
type OnSortScroll ¶
type OnSortScroll int
OnSortScroll controls scroll behavior after a sort operation.
const ( OnSortScrollNone OnSortScroll = iota // do not scroll OnSortScrollToSelection // scroll to current selection OnSortScrollToTop // scroll to top )
type OptionRotator ¶
type OptionRotator struct {
Component
// contains filtered or unexported fields
}
OptionRotator is a compact selection widget consisting of a left chevron, a centered value label, and a right chevron. Clicking either chevron — or pressing Left/Right arrow keys when focused — cycles through a fixed list of string options. Wraps by default.
func NewOptionRotator ¶
func NewOptionRotator(name string, options []string, source *sg.FontFamily, displaySize float64) *OptionRotator
NewOptionRotator creates an OptionRotator with the given name and initial options list. The selected index starts at 0 and wrapping is enabled. Panics if options is empty.
func (*OptionRotator) BindOptions ¶
func (or *OptionRotator) BindOptions(arr *Array[string])
BindOptions binds the options list to a reactive Array[string]. When the array changes the widget re-syncs its options and clamps the selection. Pass nil to detach.
func (*OptionRotator) BindSelected ¶
func (or *OptionRotator) BindSelected(ref *Ref[int])
BindSelected binds the widget to a *Ref[int] representing the selected index. External changes to the ref update the widget; user interaction updates the ref. Replaces any previous binding.
func (*OptionRotator) BindValue ¶
func (or *OptionRotator) BindValue(ref *Ref[string])
BindValue binds the widget to a *Ref[string] representing the current value string. On bind, the index is resolved by scanning options for an exact match. A value not present in the options list is silently ignored (index stays at 0). Replaces any previous binding.
func (*OptionRotator) Dispose ¶
func (or *OptionRotator) Dispose()
Dispose stops reactive watches and disposes the component tree.
func (*OptionRotator) Next ¶
func (or *OptionRotator) Next()
Next advances the selection by one step. Wraps to index 0 if wrap is enabled; no-op on the last option when wrap is disabled.
func (*OptionRotator) Options ¶
func (or *OptionRotator) Options() []string
Options returns a copy of the current options list.
func (*OptionRotator) Prev ¶
func (or *OptionRotator) Prev()
Prev steps the selection back by one. Wraps to the last option if wrap is enabled; no-op at index 0 when wrap is disabled.
func (*OptionRotator) Selected ¶
func (or *OptionRotator) Selected() int
Selected returns the current selected index.
func (*OptionRotator) SelectedRef ¶
func (or *OptionRotator) SelectedRef() *Ref[int]
SelectedRef returns the internal index Ref.
func (*OptionRotator) SetChevronIcons ¶
func (or *OptionRotator) SetChevronIcons(left, right engine.Image)
SetChevronIcons overrides the procedural chevron glyphs. Either argument may be nil to keep the procedural default for that side.
func (*OptionRotator) SetEnabled ¶
func (or *OptionRotator) SetEnabled(v bool)
SetEnabled enables or disables the widget and its chevron sub-components. Component.SetEnabled already fires onVisualStateChange → UpdateVisuals.
func (*OptionRotator) SetOnChange ¶
func (or *OptionRotator) SetOnChange(fn func(int, string))
SetOnChange registers a callback invoked after each selection change.
func (*OptionRotator) SetOptions ¶
func (or *OptionRotator) SetOptions(opts []string)
SetOptions replaces the options list entirely. The selected index is clamped to the new length. If the index changes as a result, OnChange fires.
func (*OptionRotator) SetSelected ¶
func (or *OptionRotator) SetSelected(i int)
SetSelected selects the option at index i. The index is clamped to the valid range. Fires OnChange only if the selection changes.
func (*OptionRotator) SetSize ¶
func (or *OptionRotator) SetSize(w, h float64)
SetSize resizes the widget and re-positions its sub-components.
func (*OptionRotator) SetWrap ¶
func (or *OptionRotator) SetWrap(v bool)
SetWrap controls whether cycling wraps around at the ends (default: true). When false, the corresponding chevron shows the Disabled visual state at the boundaries.
func (*OptionRotator) UpdateVisuals ¶
func (or *OptionRotator) UpdateVisuals()
UpdateVisuals applies theme colors and layout for the current state.
func (*OptionRotator) Value ¶
func (or *OptionRotator) Value() string
Value returns the current selected option string.
type Orientation ¶
type Orientation = core.Orientation
Orientation represents horizontal or vertical direction.
type Panel ¶
type Panel struct {
Component
// contains filtered or unexported fields
}
Panel is a static container with optional background color, border, and automatic child layout (VBox, HBox, Grid, or manual).
func (*Panel) AddChild ¶
AddChild adds a child component. The child's willow node is added as a child of the panel's root node, and layout is scheduled.
func (*Panel) SetAlignment ¶
SetAlignment sets the cross-axis alignment for VBox/HBox layouts.
func (*Panel) SetBackground ¶
SetBackground sets the panel's background color as a manual override. This prevents the theme from overwriting the background.
func (*Panel) SetBorder ¶
SetBorder sets the border color and width as a manual override. This prevents the theme from overwriting the border.
func (*Panel) SetCornerRadii ¶
SetCornerRadii sets independent radii for each corner (TL, TR, BR, BL).
func (*Panel) SetJustify ¶
SetJustify sets the main-axis alignment for VBox/HBox layouts.
func (*Panel) SetLayout ¶
func (p *Panel) SetLayout(mode LayoutMode)
SetLayout sets the child layout mode (LayoutNone, LayoutVBox, LayoutHBox, LayoutGrid).
func (*Panel) SetPadding ¶
SetPadding sets the panel's content padding, overriding the theme default.
func (*Panel) SetSize ¶
SetSize sets the panel dimensions and updates background, border, and hit shape. If a layout mode is active, layout is applied immediately so callers see the final child positions without waiting for the next controller update cycle.
func (*Panel) SetSpacing ¶
SetSpacing sets the spacing between children for VBox/HBox/Grid layouts.
type PanelGroup ¶
type PanelGroup = theme.PanelGroup
type Popover ¶
type Popover struct {
Component
// contains filtered or unexported fields
}
Popover is a floating rich-content panel anchored to a trigger component. It is similar to Tooltip but dismissable, interactive, and designed for heavier content: mini-inspectors, inline documentation, quick-pick panels.
Popovers are managed by DefaultPopoverManager — only one is open at a time.
func NewPopover ¶
NewPopover creates a new Popover with sensible defaults.
func (*Popover) Open ¶
Open opens the popover anchored to the given trigger component. If another popover is open it will be closed first.
func (*Popover) SetContent ¶
SetContent sets the component displayed in the popover body.
func (*Popover) SetContentSize ¶
SetContentSize sets the size of the content area (excluding title bar).
func (*Popover) SetOnClose ¶
func (p *Popover) SetOnClose(fn func())
SetOnClose sets a callback fired when the popover closes.
func (*Popover) SetOnOpen ¶
func (p *Popover) SetOnOpen(fn func())
SetOnOpen sets a callback fired when the popover opens.
func (*Popover) SetPreferredSide ¶
func (p *Popover) SetPreferredSide(side PopoverSide)
SetPreferredSide sets which side of the trigger the popover prefers to appear on.
func (*Popover) SetShowCloseButton ¶
SetShowCloseButton controls whether an X button appears in the title bar.
type PopoverManager ¶
type PopoverManager struct {
// contains filtered or unexported fields
}
PopoverManager manages the single active floating popover. Use DefaultPopoverManager; do not construct your own.
func (*PopoverManager) Close ¶
func (m *PopoverManager) Close(p *Popover)
Close closes popover p if it is currently open on this manager.
func (*PopoverManager) Open ¶
func (m *PopoverManager) Open(p *Popover, trigger *Component)
Open displays popover p anchored to trigger. If another popover is open it is closed first. Callers may use this on a custom PopoverManager; otherwise prefer p.Open(trigger) which routes through DefaultPopoverManager.
type PopoverSide ¶
type PopoverSide int
PopoverSide controls which side of the trigger the popover prefers to appear on.
const ( PopoverBelow PopoverSide = iota // default PopoverAbove PopoverRight PopoverLeft )
type Radio ¶
type Radio struct {
Component
// contains filtered or unexported fields
}
Radio manages a group of mutually exclusive radio buttons.
func (*Radio) AddOption ¶
func (rg *Radio) AddOption(text string, source *sg.FontFamily, displaySize float64) *RadioButton
AddOption adds a radio button with the given label to the group.
func (*Radio) BindSelected ¶
BindSelected binds the selection to a reactive Ref[int].
func (*Radio) Buttons ¶
func (rg *Radio) Buttons() []*RadioButton
Buttons returns the slice of RadioButton widgets in this group. Used for testing radio group internals.
func (*Radio) SetColumns ¶
SetColumns sets the number of columns (default 1 = single vertical stack). Call before or after adding options; triggers a layout update.
func (*Radio) SetOnChange ¶
SetOnChange sets the callback invoked when selection changes.
func (*Radio) SetSelected ¶
SetSelected programmatically selects a button by index.
func (*Radio) SetVerticalFirst ¶
SetVerticalFirst controls fill order when columns > 1. false (default) = fill left-to-right then wrap (horizontal-first). true = fill top-to-bottom per column (vertical-first).
type RadioButton ¶
type RadioButton struct {
Component
// contains filtered or unexported fields
}
RadioButton is a single option within a Radio widget.
func (*RadioButton) Dispose ¶
func (rb *RadioButton) Dispose()
Dispose disposes the radio button and its label.
type ReactiveTreeNode ¶
type ReactiveTreeNode struct {
Data any
Children *Array[*ReactiveTreeNode]
}
ReactiveTreeNode is a tree node whose children are a reactive Array. Mutations to any Children array anywhere in the subtree are automatically reflected in a TreeList bound via BindRoots.
func NewReactiveTreeNode ¶
func NewReactiveTreeNode(data any) *ReactiveTreeNode
NewReactiveTreeNode creates a ReactiveTreeNode with an empty Children array.
type Ref ¶
type Ref[T comparable] = reactive.Ref[T]
Type aliases — re-export internal types as willowui types.
type RichText ¶
type RichText struct {
Component
// contains filtered or unexported fields
}
RichText renders multi-span styled text into a single offscreen image. Each span can have its own font, color, and outline; unset fields inherit from the RichText defaults. Word wrapping is supported across span boundaries.
func NewRichText ¶
func NewRichText(name string, source *sg.FontFamily, displaySize float64) *RichText
NewRichText creates a new RichText component with the given default font source and display size.
func (*RichText) AddBoldItalicSpan ¶
AddBoldItalicSpan appends a bold+italic text span with the given color. Returns rt for chaining.
func (*RichText) AddBoldSpan ¶
AddBoldSpan appends a bold text span with the given color. Returns rt for chaining.
func (*RichText) AddItalicSpan ¶
AddItalicSpan appends an italic text span with the given color. Returns rt for chaining.
func (*RichText) AddSpan ¶
AddSpan appends a plain text span that inherits all styling from the RichText defaults. Returns rt for chaining.
func (*RichText) AddStyledSpan ¶
func (rt *RichText) AddStyledSpan(text string, source *sg.FontFamily, color sg.Color, outline *Outline) *RichText
AddStyledSpan appends a span with explicit styling overrides. Pass nil for source or outline to inherit from the RichText defaults. Color is always set explicitly (ColorSet = true) so the caller's color is used even if it happens to be the zero value. Returns rt for chaining.
func (*RichText) AddTextSpan ¶
AddTextSpan appends a fully configured TextSpan. Returns rt for chaining.
func (*RichText) ClearSpans ¶
ClearSpans removes all spans. Returns rt for chaining.
func (*RichText) Dispose ¶
func (rt *RichText) Dispose()
Dispose releases the offscreen image and disposes the component tree.
func (*RichText) HeadingScale ¶
HeadingScale returns the heading scale array. Used for testing.
func (*RichText) ImageForTest ¶
ImageForTest returns the internal offscreen image. Used for testing.
func (*RichText) LayoutLinesForTest ¶
func (rt *RichText) LayoutLinesForTest() []LayoutLineForTest
LayoutLinesForTest calls layoutLines and returns public views. Used for testing.
func (*RichText) OnLinkClickForTest ¶
OnLinkClickForTest returns the onLinkClick callback. Used for testing.
func (*RichText) Render ¶
func (rt *RichText) Render()
Render composites all spans into the offscreen image and updates the sprite node. This should be called once per frame before drawing, typically in the scene's update function. It is a no-op if nothing has changed.
func (*RichText) ResolveColorForTest ¶
ResolveColorForTest calls resolveColor on the given span. Used for testing.
func (*RichText) ResolveFontForTest ¶
func (rt *RichText) ResolveFontForTest(span TextSpan) *sg.FontFamily
ResolveFontForTest calls resolveFont on the given span. Used for testing.
func (*RichText) ResolveOutlineForTest ¶
ResolveOutlineForTest calls resolveOutline on the given span. Used for testing.
func (*RichText) SetDirtyForTest ¶
SetDirtyForTest sets the dirty flag. Used for testing.
func (*RichText) SetHeadingScale ¶
SetHeadingScale sets the size multipliers for h1, h2, and h3 headings.
func (*RichText) SetOnLinkClick ¶
SetOnLinkClick sets a callback invoked when a <link> region is clicked.
func (*RichText) SetOutline ¶
SetOutline sets the default text outline for spans that do not override it.
func (*RichText) SetWrapWidth ¶
SetWrapWidth sets the maximum pixel width before text wraps to the next line. A value of 0 disables wrapping.
func (*RichText) SpriteNode ¶
SpriteNode returns the internal sprite node. Used for testing.
type Screen ¶
type Screen struct {
// contains filtered or unexported fields
}
Screen bridges a Controller and the underlying willow scene. It owns the root component tree, focus manager, and scheduler, and manages the controller lifecycle.
func NewScreen ¶
func NewScreen(opts ...ScreenOption) *Screen
NewScreen creates a new Screen. Use WithController to attach a controller. The scene is set automatically by Stage.Add; use WithScene in tests.
func (*Screen) ClearTemplateTree ¶
func (s *Screen) ClearTemplateTree()
ClearTemplateTree stops all tracked refs and removes all children from the screen root. Used by hot reload to tear down the previous component tree before re-instantiation.
func (*Screen) Destroy ¶
func (s *Screen) Destroy()
Destroy detaches the root node, calls OnDestroy, and disposes all tracked refs.
func (*Screen) FindByName ¶
FindByName searches the component tree for a component whose node name matches the given name. Returns nil if not found.
func (*Screen) FocusManager ¶
func (s *Screen) FocusManager() *FocusManager
FocusManager returns the focus manager used by this screen.
func (*Screen) Hide ¶
func (s *Screen) Hide()
Hide detaches the root node from the scene but preserves all state.
func (*Screen) InputManager ¶
func (s *Screen) InputManager() *InputManager
InputManager returns the input manager used by this screen.
func (*Screen) NumChildren ¶
NumChildren returns the number of direct children attached to the screen root.
func (*Screen) RemoveNode ¶
RemoveNode detaches a raw sg.Node from the screen's root.
func (*Screen) Show ¶
func (s *Screen) Show()
Show attaches the root node to the scene and calls OnCreate on first show.
func (*Screen) TrackRef ¶
func (s *Screen) TrackRef(r disposable)
TrackRef registers a disposable resource that will be automatically stopped when the screen is destroyed.
type ScreenOption ¶
type ScreenOption func(*Screen)
ScreenOption configures a Screen during construction.
func WithController ¶
func WithController(c Controller) ScreenOption
WithController attaches a Controller to the screen.
func WithScene ¶
func WithScene(s *sg.Scene) ScreenOption
WithScene sets the scene on a Screen explicitly. Intended for use in tests; in production the scene is set automatically by Stage.Add.
type ScrollBar ¶
type ScrollBar struct {
Component
// contains filtered or unexported fields
}
ScrollBar is a scrollbar with a draggable thumb whose size reflects the visible portion relative to total content.
func NewScrollBar ¶
NewScrollBar creates a vertical scrollbar.
func (*ScrollBar) BindScrollPos ¶
BindScrollPos binds the scrollbar to a reactive Ref[float64].
func (*ScrollBar) Dispose ¶
func (sb *ScrollBar) Dispose()
Dispose stops reactive watches and disposes the component tree.
func (*ScrollBar) SetContentSize ¶
SetContentSize sets the total content size and visible viewport size.
func (*ScrollBar) SetOnChange ¶
SetOnChange sets the callback for scroll position changes.
func (*ScrollBar) SetOrientation ¶
func (sb *ScrollBar) SetOrientation(o Orientation)
SetOrientation sets horizontal or vertical orientation.
func (*ScrollBar) SetScrollPos ¶
SetScrollPos sets the scroll position, clamping to valid range.
func (*ScrollBar) ThumbHeight ¶
ThumbHeight returns the thumb component's Height. Used for testing.
type ScrollMode ¶
type ScrollMode int
ScrollMode controls how the DataTable scrolls.
const ( ScrollModeVirtual ScrollMode = iota // virtualized: only visible rows are rendered ScrollModeStatic // static pool: all slots always present )
type ScrollPanel ¶
type ScrollPanel struct {
Panel
// contains filtered or unexported fields
}
ScrollPanel is a Panel with built-in scrolling. Content that exceeds the viewport is clipped via a willow mask, and optional horizontal/vertical scrollbars allow the user to navigate.
func NewScrollPanel ¶
func NewScrollPanel(name string) *ScrollPanel
NewScrollPanel creates a scroll panel with a vertical scrollbar shown by default and a horizontal scrollbar hidden.
func (*ScrollPanel) AddChild ¶
func (sp *ScrollPanel) AddChild(child UIElement)
AddChild adds a child component to the scroll panel. The child's node is placed inside the scrollable content container.
func (*ScrollPanel) AddContent ¶
func (sp *ScrollPanel) AddContent(child UIElement)
AddContent adds a UIElement component to the scroll panel's content node.
func (*ScrollPanel) ContentH ¶
func (sp *ScrollPanel) ContentH() float64
ContentH returns the total content height set via SetContentSize. Used for testing scroll panel internals.
func (*ScrollPanel) ContentNode ¶
func (sp *ScrollPanel) ContentNode() *sg.Node
ContentNode returns the content container node. Add child willow nodes directly to this node for scrolled content that is not managed by the Component child system.
func (*ScrollPanel) Dispose ¶
func (sp *ScrollPanel) Dispose()
Dispose cleans up scrollbars and watches.
func (*ScrollPanel) EnsureVisible ¶
func (sp *ScrollPanel) EnsureVisible(child *Component)
EnsureVisible scrolls so that the given child component is fully visible within the scroll panel's viewport. If the component is already fully visible, no scrolling occurs.
func (*ScrollPanel) HScrollBar ¶
func (sp *ScrollPanel) HScrollBar() *ScrollBar
HScrollBar returns the horizontal scrollbar widget. Used for testing scroll panel internals.
func (*ScrollPanel) RemoveChild ¶
func (sp *ScrollPanel) RemoveChild(child UIElement)
RemoveChild detaches a child component from the scroll panel's content.
func (*ScrollPanel) ScrollTo ¶
func (sp *ScrollPanel) ScrollTo(x, y float64)
ScrollTo sets both scroll positions at once.
func (*ScrollPanel) ScrollX ¶
func (sp *ScrollPanel) ScrollX() float64
ScrollX returns the current horizontal scroll position.
func (*ScrollPanel) ScrollY ¶
func (sp *ScrollPanel) ScrollY() float64
ScrollY returns the current vertical scroll position.
func (*ScrollPanel) SetBackground ¶
func (sp *ScrollPanel) SetBackground(c sg.Color)
SetBackground sets the panel's background color as a manual override.
func (*ScrollPanel) SetBorder ¶
func (sp *ScrollPanel) SetBorder(c sg.Color, width float64)
SetBorder sets the border color and width as a manual override.
func (*ScrollPanel) SetContentSize ¶
func (sp *ScrollPanel) SetContentSize(w, h float64)
SetContentSize sets the total size of the scrollable content area.
func (*ScrollPanel) SetScrollX ¶
func (sp *ScrollPanel) SetScrollX(v float64)
SetScrollX sets the horizontal scroll position.
func (*ScrollPanel) SetScrollY ¶
func (sp *ScrollPanel) SetScrollY(v float64)
SetScrollY sets the vertical scroll position.
func (*ScrollPanel) SetSize ¶
func (sp *ScrollPanel) SetSize(w, h float64)
SetSize sets the scroll panel dimensions.
func (*ScrollPanel) ShowHScroll ¶
func (sp *ScrollPanel) ShowHScroll(show bool)
ShowHScroll shows or hides the horizontal scrollbar.
func (*ScrollPanel) ShowVScroll ¶
func (sp *ScrollPanel) ShowVScroll(show bool)
ShowVScroll shows or hides the vertical scrollbar.
func (*ScrollPanel) Update ¶
func (sp *ScrollPanel) Update()
Update processes mouse wheel input for scrolling. Call from your scene's UpdateFunc.
func (*ScrollPanel) VScrollBar ¶
func (sp *ScrollPanel) VScrollBar() *ScrollBar
VScrollBar returns the vertical scrollbar widget. Used for testing scroll panel internals.
func (*ScrollPanel) Viewport ¶
func (sp *ScrollPanel) Viewport() *sg.Node
Viewport returns the masked container node that clips content. Used for testing scroll panel internals.
type SearchBox ¶
type SearchBox struct {
Component
// AutoHeight, when true, causes SetSize to ignore the height argument and
// compute it automatically from font size and padding.
AutoHeight bool
// contains filtered or unexported fields
}
SearchBox is a search-oriented single-line input with a magnifier icon, optional clear button, debounce, and automatic reactive result population. It wraps a TextInput internally and adds search-specific behavior.
func NewSearchBox ¶
func NewSearchBox(name string, source *sg.FontFamily, displaySize float64) *SearchBox
NewSearchBox creates a SearchBox with the given name, font source, and display size. By default the search icon is shown and the clear button is enabled.
func (*SearchBox) CancelPendingSearch ¶
func (sb *SearchBox) CancelPendingSearch()
CancelPendingSearch cancels any pending debounced search without running it. Useful after programmatically setting the value (e.g. accepting an autocomplete suggestion) to prevent the dropdown from reopening.
func (*SearchBox) Clear ¶
func (sb *SearchBox) Clear()
Clear empties the query, hides the clear button, clears results, and fires OnClear.
func (*SearchBox) ClearVisible ¶
ClearVisible returns whether the clear button is visible. Used for testing.
func (*SearchBox) DeleteBack ¶
func (sb *SearchBox) DeleteBack()
DeleteBack deletes the character before the cursor.
func (*SearchBox) DeleteForward ¶
func (sb *SearchBox) DeleteForward()
DeleteForward deletes the character after the cursor.
func (*SearchBox) Dispose ¶
func (sb *SearchBox) Dispose()
Dispose stops reactive watches and disposes the component tree.
func (*SearchBox) GetCursorPos ¶
GetCursorPos returns the current cursor rune position. Used for testing.
func (*SearchBox) GetPlaceholder ¶
GetPlaceholder returns the placeholder string. Used for testing.
func (*SearchBox) HasSelection ¶
HasSelection returns true when text is selected.
func (*SearchBox) InsertText ¶
InsertText inserts text at the cursor.
func (*SearchBox) IsSearching ¶
IsSearching returns true if a search is currently running.
func (*SearchBox) MinQueryLength ¶
MinQueryLength returns the minimum query length.
func (*SearchBox) ResultsCount ¶
ResultsCount returns the number of results from the last search.
func (*SearchBox) SetDebounce ¶
SetDebounce sets the debounce duration. Default is 150ms.
func (*SearchBox) SetEnabled ¶
SetEnabled overrides Component.SetEnabled to also update visuals.
func (*SearchBox) SetMinQueryLength ¶
SetMinQueryLength sets the minimum character count before automatic search.
func (*SearchBox) SetOnBlur ¶
func (sb *SearchBox) SetOnBlur(fn func())
SetOnBlur sets the callback fired when the field loses focus.
func (*SearchBox) SetOnChange ¶
SetOnChange sets the callback fired when the query text changes.
func (*SearchBox) SetOnClear ¶
func (sb *SearchBox) SetOnClear(fn func())
SetOnClear sets the callback fired when the clear button is pressed.
func (*SearchBox) SetOnSearchEmpty ¶
SetOnSearchEmpty sets the callback fired when search returns zero results.
func (*SearchBox) SetOnSearchFinish ¶
SetOnSearchFinish sets the callback fired after each search with result count.
func (*SearchBox) SetOnSearchStart ¶
SetOnSearchStart sets the callback fired before each search execution.
func (*SearchBox) SetOnSubmit ¶
SetOnSubmit sets the callback fired on Enter.
func (*SearchBox) SetPlaceholder ¶
SetPlaceholder sets the placeholder text.
func (*SearchBox) SetSearchOnChange ¶
SetSearchOnChange controls whether typing triggers automatic search.
func (*SearchBox) SetSearchOnSubmit ¶
SetSearchOnSubmit controls whether Enter triggers automatic search.
func (*SearchBox) SetShowClearButton ¶
SetShowClearButton toggles the clear button.
func (*SearchBox) SetShowSearchIcon ¶
SetShowSearchIcon toggles the magnifier icon.
func (*SearchBox) Submit ¶
func (sb *SearchBox) Submit()
Submit fires OnSubmit and optionally triggers search.
func (*SearchBox) TriggerSearchNow ¶
func (sb *SearchBox) TriggerSearchNow()
TriggerSearchNow bypasses the debounce and runs the search immediately.
func (*SearchBox) UpdateVisuals ¶
func (sb *SearchBox) UpdateVisuals()
UpdateVisuals applies theme colors based on state.
type SearchBoxGroup ¶
type SearchBoxGroup = theme.SearchBoxGroup
type Select ¶
type Select struct {
Component
// contains filtered or unexported fields
}
Select is a dropdown widget: shows the currently selected option and opens a MenuPopup when clicked.
func NewSelect ¶
func NewSelect(name string, options []SelectOption, source *sg.FontFamily, displaySize float64) *Select
NewSelect creates a Select with the given name, options list, font source, and display size.
func (*Select) BindOptions ¶
func (s *Select) BindOptions(arr *Array[SelectOption])
BindOptions binds the options list to a reactive Array[SelectOption]. When the array changes the dropdown re-syncs and clamps the selection. Pass nil to detach.
func (*Select) BindSelected ¶
BindSelected binds the selection index to a reactive Ref[int]. External changes to the ref update the widget; user interaction updates the ref. Replaces any previous binding.
func (*Select) Dispose ¶
func (s *Select) Dispose()
Dispose stops reactive watches and disposes the component.
func (*Select) SelectedOption ¶
func (s *Select) SelectedOption() SelectOption
SelectedOption returns the currently selected SelectOption.
func (*Select) SelectedRef ¶
SelectedRef returns the reactive Ref backing the selection, or nil if BindSelected has not been called.
func (*Select) SetOnChange ¶
func (s *Select) SetOnChange(fn func(index int, option SelectOption))
SetOnChange registers a callback fired when the user selects an option.
func (*Select) SetOptions ¶
func (s *Select) SetOptions(options []SelectOption)
SetOptions replaces the option list. The selection resets to index 0.
func (*Select) SetSelected ¶
SetSelected selects the option at the given index.
func (*Select) UpdateVisuals ¶
func (s *Select) UpdateVisuals()
UpdateVisuals applies theme colors and repositions children.
type SelectOption ¶
SelectOption is a single choice in a Select widget.
type SelectionMode ¶
type SelectionMode int
SelectionMode controls row selection behavior.
const ( SelectionModeNone SelectionMode = iota // no selection SelectionModeSingle // single row selection SelectionModeMulti // multi-row selection )
type Slider ¶
type Slider struct {
Component
// contains filtered or unexported fields
}
Slider is a draggable range control for selecting a numeric value.
func (*Slider) Dispose ¶
func (s *Slider) Dispose()
Dispose stops reactive watches and disposes the component tree.
func (*Slider) GetOrientation ¶
func (s *Slider) GetOrientation() Orientation
GetOrientation returns the current orientation. Used for testing.
func (*Slider) SetEnabled ¶
SetEnabled overrides Component.SetEnabled to also update visuals.
func (*Slider) SetOnChange ¶
SetOnChange sets the callback for value changes.
func (*Slider) SetOrientation ¶
func (s *Slider) SetOrientation(o Orientation)
SetOrientation sets horizontal or vertical orientation.
func (*Slider) UpdateVisuals ¶
func (s *Slider) UpdateVisuals()
UpdateVisuals applies theme colors based on current state.
type SortDirection ¶
type SortDirection int
SortDirection indicates the sort order for a column.
const ( SortNone SortDirection = iota // no sort SortAsc // ascending SortDesc // descending )
type SortHandleSide ¶
type SortHandleSide int
SortHandleSide specifies which side of each row the drag handle appears on.
const ( SortHandleLeft SortHandleSide = iota SortHandleRight )
type SortKey ¶
type SortKey struct {
ColKey string
Dir SortDirection
}
SortKey identifies a column and its sort direction in a multi-sort stack.
type SortableList ¶
type SortableList struct {
Component
// contains filtered or unexported fields
}
SortableList is a vertical list widget specialized for ordered collections. It supports drag-handle-based reordering, keyboard reorder commands, and reactive array binding.
func NewSortableList ¶
func NewSortableList(name string, itemHeight float64) *SortableList
NewSortableList creates a new sortable list with fixed item height.
func (*SortableList) BindSelected ¶
func (sl *SortableList) BindSelected(ref *Ref[int])
BindSelected binds the selection to a reactive Ref[int].
func (*SortableList) Dispose ¶
func (sl *SortableList) Dispose()
Dispose cleans up watches and child components.
func (*SortableList) ItemCount ¶
func (sl *SortableList) ItemCount() int
ItemCount returns the number of items.
func (*SortableList) MoveItem ¶
func (sl *SortableList) MoveItem(from, to int)
MoveItem moves an item from one index to another.
func (*SortableList) MoveSelectedDown ¶
func (sl *SortableList) MoveSelectedDown()
MoveSelectedDown moves the selected item down by one position.
func (*SortableList) MoveSelectedUp ¶
func (sl *SortableList) MoveSelectedUp()
MoveSelectedUp moves the selected item up by one position.
func (*SortableList) ScrollToIndex ¶
func (sl *SortableList) ScrollToIndex(idx int)
ScrollToIndex scrolls so that the given item index is visible.
func (*SortableList) Selected ¶
func (sl *SortableList) Selected() int
Selected returns the currently selected item index, or -1 if none.
func (*SortableList) SelectedItem ¶
func (sl *SortableList) SelectedItem() any
SelectedItem returns the data of the currently selected item, or nil.
func (*SortableList) SetDragEnabled ¶
func (sl *SortableList) SetDragEnabled(v bool)
SetDragEnabled enables or disables pointer-based drag reordering.
func (*SortableList) SetHandleSide ¶
func (sl *SortableList) SetHandleSide(side SortHandleSide)
SetHandleSide sets which side of each row the drag handle appears on.
func (*SortableList) SetKeyboardReorderEnabled ¶
func (sl *SortableList) SetKeyboardReorderEnabled(v bool)
SetKeyboardReorderEnabled enables or disables Alt+Up/Down reordering.
func (*SortableList) SetOnChange ¶
func (sl *SortableList) SetOnChange(fn func(int))
SetOnChange sets the callback for selection changes.
func (*SortableList) SetOnMoveDenied ¶
func (sl *SortableList) SetOnMoveDenied(fn func(from, to int))
SetOnMoveDenied sets the callback fired when a reorder is denied.
func (*SortableList) SetOnReorder ¶
func (sl *SortableList) SetOnReorder(fn func(from, to int))
SetOnReorder sets the callback fired after a successful reorder.
func (*SortableList) SetRenderItem ¶
func (sl *SortableList) SetRenderItem(fn func(int, any) *Component)
SetRenderItem sets the factory function that creates a Component for a given item index and data value.
func (*SortableList) SetSelected ¶
func (sl *SortableList) SetSelected(idx int)
SetSelected sets the selected item index.
func (*SortableList) SetShowHandles ¶
func (sl *SortableList) SetShowHandles(v bool)
SetShowHandles shows or hides drag handles.
func (*SortableList) SetSize ¶
func (sl *SortableList) SetSize(w, h float64)
SetSize sets the list dimensions and updates internal layout.
func (*SortableList) SetUpdateItem ¶
func (sl *SortableList) SetUpdateItem(fn func(int, any, *Component))
SetUpdateItem sets a function that updates an existing Component for a given item index and data value without recreating it.
func (*SortableList) SortableListScrollBar ¶
func (sl *SortableList) SortableListScrollBar() *ScrollBar
SortableListScrollBar returns the internal scrollbar. Used for testing.
func (*SortableList) Update ¶
func (sl *SortableList) Update()
Update processes mouse wheel input and keyboard navigation/reorder.
type SortableListGroup ¶
type SortableListGroup = theme.SortableListGroup
type SortableTreeItem ¶
type SortableTreeItem struct {
ID string
ParentID string // empty = root
Label string
Icon sg.TextureRegion
Depth int // computed from ParentID if 0
}
SortableTreeItem represents a node in a sortable tree hierarchy.
type SortableTreeList ¶
type SortableTreeList struct {
Component
// contains filtered or unexported fields
}
SortableTreeList is a hierarchical list where nodes can be reordered by drag within their level and optionally reparented by dragging onto another node.
func NewSortableTreeList ¶
func NewSortableTreeList(name string, source *sg.FontFamily, displaySize float64) *SortableTreeList
NewSortableTreeList creates a new sortable tree list.
func (*SortableTreeList) BindSelected ¶
func (st *SortableTreeList) BindSelected(ref *Ref[int])
BindSelected two-way binds the selected index to an external Ref.
func (*SortableTreeList) CollapseAll ¶
func (st *SortableTreeList) CollapseAll()
CollapseAll collapses all items.
func (*SortableTreeList) Dispose ¶
func (st *SortableTreeList) Dispose()
Dispose cleans up resources.
func (*SortableTreeList) ExpandAll ¶
func (st *SortableTreeList) ExpandAll()
ExpandAll expands all items that have children.
func (*SortableTreeList) IndentSelected ¶
func (st *SortableTreeList) IndentSelected()
IndentSelected moves the selected item under its preceding sibling.
func (*SortableTreeList) IsExpanded ¶
func (st *SortableTreeList) IsExpanded(id string) bool
IsExpanded reports whether the given item ID is expanded.
func (*SortableTreeList) Items ¶
func (st *SortableTreeList) Items() []SortableTreeItem
Items returns the current items.
func (*SortableTreeList) MoveSelectedDown ¶
func (st *SortableTreeList) MoveSelectedDown()
MoveSelectedDown moves the selected item one position down within its parent.
func (*SortableTreeList) MoveSelectedUp ¶
func (st *SortableTreeList) MoveSelectedUp()
MoveSelectedUp moves the selected item one position up within its parent.
func (*SortableTreeList) OutdentSelected ¶
func (st *SortableTreeList) OutdentSelected()
OutdentSelected moves the selected item to its grandparent level.
func (*SortableTreeList) Selected ¶
func (st *SortableTreeList) Selected() int
Selected returns the currently selected flat list index, or -1.
func (*SortableTreeList) SetAllowCrossLevel ¶
func (st *SortableTreeList) SetAllowCrossLevel(v bool)
SetAllowCrossLevel enables or disables moving items to different depth levels.
func (*SortableTreeList) SetAllowReparent ¶
func (st *SortableTreeList) SetAllowReparent(v bool)
SetAllowReparent enables or disables reparenting by dragging onto a node.
func (*SortableTreeList) SetExpanded ¶
func (st *SortableTreeList) SetExpanded(id string, v bool)
SetExpanded sets the expansion state for a given item ID.
func (*SortableTreeList) SetItems ¶
func (st *SortableTreeList) SetItems(items []SortableTreeItem)
SetItems sets the tree items and refreshes the view.
func (*SortableTreeList) SetOnChange ¶
func (st *SortableTreeList) SetOnChange(fn func(int))
SetOnChange sets the callback for selection changes.
func (*SortableTreeList) SetOnReorder ¶
func (st *SortableTreeList) SetOnReorder(fn func(itemID, newParentID string, newIndex int))
SetOnReorder sets the callback for reorder/reparent completion.
func (*SortableTreeList) SetSelected ¶
func (st *SortableTreeList) SetSelected(idx int)
SetSelected sets the selected flat list index.
func (*SortableTreeList) SetSize ¶
func (st *SortableTreeList) SetSize(w, h float64)
SetSize sets the list dimensions.
func (*SortableTreeList) Update ¶
func (st *SortableTreeList) Update()
Update processes mouse wheel and keyboard input.
type SortableTreeListGroup ¶
type SortableTreeListGroup = theme.SortableTreeListGroup
type Spacer ¶
type Spacer struct {
Component
}
Spacer is an invisible fixed-size gap for use in VBox/HBox layouts. It occupies space without rendering anything.
type StageManager ¶
type StageManager struct {
// contains filtered or unexported fields
}
StageManager manages a stack of screens. The package-level DefaultStage is wired automatically by ui.Setup. Use ui.Stage to access it in applications.
func NewStageManager ¶
func NewStageManager() *StageManager
NewStageManager creates a new StageManager. Primarily used for test isolation; in production use ui.Stage.
func (*StageManager) Add ¶
func (st *StageManager) Add(screen *Screen)
Add pushes screen onto the stack and shows it.
func (*StageManager) CloseAll ¶
func (st *StageManager) CloseAll()
CloseAll destroys all screens on the stack.
func (*StageManager) Remove ¶
func (st *StageManager) Remove(screen *Screen)
Remove destroys and removes a specific screen from the stack.
func (*StageManager) Replace ¶
func (st *StageManager) Replace(screen *Screen)
Replace destroys the top screen and shows the new screen in its place.
func (*StageManager) SetScene ¶
func (st *StageManager) SetScene(s *sg.Scene)
SetScene sets the scene used for attaching screen nodes. Called by ui.Setup; can also be called in tests.
func (*StageManager) Size ¶
func (st *StageManager) Size() int
Size returns the number of screens on the stack.
func (*StageManager) Top ¶
func (st *StageManager) Top() *Screen
Top returns the topmost screen, or nil if the stack is empty.
func (*StageManager) Update ¶
func (st *StageManager) Update(dt float64)
Update calls Update on all visible screens.
type StatWeb ¶
type StatWeb struct {
Component
// contains filtered or unexported fields
}
StatWeb is an editable polygon stat display (spider/radar chart) with named axes and optional draggable handles for attribute editing.
func NewStatWeb ¶
func NewStatWeb(name string, source *sg.FontFamily, fontSize float64) *StatWeb
NewStatWeb creates a StatWeb with the given name, font source, and font size.
func (*StatWeb) IsEditable ¶
IsEditable returns whether the stat web is in editable mode.
func (*StatWeb) SetEditable ¶
SetEditable enables or disables draggable axis handles.
func (*StatWeb) SetFillEnabled ¶
SetFillEnabled shows or hides the semi-transparent polygon fill.
func (*StatWeb) SetOnValueChanged ¶
SetOnValueChanged sets the callback for when a handle is dragged.
func (*StatWeb) UpdateVisuals ¶
func (s *StatWeb) UpdateVisuals()
UpdateVisuals applies theme colors based on current state.
type TabBar ¶
type TabBar struct {
Component
// contains filtered or unexported fields
}
TabBar is a horizontal row of tab buttons. Selecting a tab shows its associated panel and hides all others.
func NewTabBar ¶
func NewTabBar(name string, source *sg.FontFamily, displaySize float64) *TabBar
NewTabBar creates a new tab bar with the given font source and display size.
func (*TabBar) AddTab ¶
AddTab adds a new tab with the given label and content panel, returning the tab index.
func (*TabBar) AddTabPage ¶
func (tb *TabBar) AddTabPage(label string, layout LayoutMode, spacing float64, padding Insets) (*Component, int)
AddTabPage creates a new page component with the given layout, spacing, and padding, adds it as a tab with the given label, and returns the page and its tab index. The page is sized to match the tab body.
func (*TabBar) BindSelected ¶
BindSelected binds the tab selection to a reactive Ref[int].
func (*TabBar) LeftArrowVisible ¶
LeftArrowVisible reports whether the left scroll arrow is visible.
func (*TabBar) OverflowMode ¶
func (tb *TabBar) OverflowMode() TabOverflowMode
OverflowMode returns the current overflow mode.
func (*TabBar) RightArrowVisible ¶
RightArrowVisible reports whether the right scroll arrow is visible.
func (*TabBar) ScrollOffset ¶
ScrollOffset returns the current scroll offset in pixels. Always 0 when OverflowMode is TabOverflowClip.
func (*TabBar) ScrollToTab ¶
ScrollToTab scrolls the bar so that the tab at idx is fully visible. No-op when OverflowMode is TabOverflowClip or when the tab is already visible.
func (*TabBar) SetOnChange ¶
SetOnChange sets the callback for tab selection changes.
func (*TabBar) SetOverflowMode ¶
func (tb *TabBar) SetOverflowMode(mode TabOverflowMode)
SetOverflowMode sets the overflow mode for the tab bar.
func (*TabBar) SetSelected ¶
SetSelected sets the selected tab index.
type TabOverflowMode ¶
type TabOverflowMode int
TabOverflowMode controls what happens when tabs overflow the bar width.
const ( TabOverflowClip TabOverflowMode = iota // default — tabs are clipped at the edge TabOverflowScroll // scroll arrows appear on overflow )
type TableColumn ¶
TableColumn defines a column in a TreeTable.
type Tag ¶
type Tag struct {
Component
// contains filtered or unexported fields
}
Tag is a compact pill widget used as a category marker, filter chip, or item classifier. It supports optional remove (×) and selectable (toggle) modes that may be combined.
func NewTag ¶
func NewTag(name string, source *sg.FontFamily, displaySize float64) *Tag
NewTag creates a Tag with the given name, font source, and display size.
func (*Tag) SetOnRemove ¶
func (t *Tag) SetOnRemove(fn func())
SetOnRemove sets the callback invoked when the × button is clicked.
func (*Tag) SetOnToggle ¶
SetOnToggle sets the callback invoked when the tag is toggled.
func (*Tag) SetPadding ¶
SetPadding overrides the theme padding with per-instance values.
func (*Tag) SetRemovable ¶
SetRemovable shows or hides the × affordance.
func (*Tag) SetSelectable ¶
SetSelectable enables or disables toggle behaviour on click.
func (*Tag) SetSelected ¶
SetSelected sets the toggle state (only meaningful when selectable).
func (*Tag) SizeToContent ¶
func (t *Tag) SizeToContent()
SizeToContent auto-sizes the tag to fit its text plus padding.
func (*Tag) UpdateVisuals ¶
func (t *Tag) UpdateVisuals()
UpdateVisuals applies theme colors and corner radius.
type TagBar ¶
type TagBar struct {
Component
// contains filtered or unexported fields
}
TagBar is a tag-input widget where the user types text and presses Space (or Enter) to create a Tag chip. Each tag shows a × to delete it. The TagBar owns the list of tag values and renders them using Tag internally.
func NewTagBar ¶
func NewTagBar(name string, source *sg.FontFamily, displaySize float64) *TagBar
NewTagBar creates a TagBar with the given name, font source, and display size.
func (*TagBar) Dispose ¶
func (tb *TagBar) Dispose()
Dispose cleans up all tags and the inner TextInput.
func (*TagBar) RemoveTagAt ¶
RemoveTagAt removes the tag at the given index.
func (*TagBar) SetOnAddTag ¶
SetOnAddTag sets a callback fired when a new tag is added.
func (*TagBar) SetOnChange ¶
SetOnChange sets a callback fired whenever the tag list changes.
func (*TagBar) SetOnRemoveTag ¶
SetOnRemoveTag sets a callback fired when a tag is removed.
func (*TagBar) SetPlaceholder ¶
SetPlaceholder sets the placeholder text shown when the input is empty.
func (*TagBar) UpdateVisuals ¶
func (tb *TagBar) UpdateVisuals()
UpdateVisuals applies theme styling to the TagBar and its children.
type TextArea ¶
type TextArea struct {
Component
// contains filtered or unexported fields
}
TextArea is a multi-line text entry field with word wrapping and scrolling.
func NewTextArea ¶
func NewTextArea(name string, source *sg.FontFamily, displaySize float64) *TextArea
NewTextArea creates a multi-line text area with the given font source and display size.
func (*TextArea) ClearSelectionForTest ¶
func (ta *TextArea) ClearSelectionForTest()
ClearSelectionForTest calls the internal clearSelection method. Used for testing.
func (*TextArea) CursorVisualLineColForTest ¶
CursorVisualLineColForTest calls cursorVisualLineCol. Used for testing.
func (*TextArea) DeleteBack ¶
func (ta *TextArea) DeleteBack()
DeleteBack deletes the character before the cursor (backspace). If there is a selection, it deletes the selected text instead.
func (*TextArea) DeleteForward ¶
func (ta *TextArea) DeleteForward()
DeleteForward deletes the character after the cursor (delete key). If there is a selection, it deletes the selected text instead.
func (*TextArea) DeleteSelectionForTest ¶
func (ta *TextArea) DeleteSelectionForTest()
DeleteSelectionForTest calls the internal deleteSelection method. Used for testing.
func (*TextArea) Dispose ¶
func (ta *TextArea) Dispose()
Dispose stops reactive watches and disposes the component tree.
func (*TextArea) GetCursorPos ¶
GetCursorPos returns the current cursor rune position. Used for testing.
func (*TextArea) GetScrollY ¶
GetScrollY returns the current vertical scroll offset. Used for testing.
func (*TextArea) GetSelStart ¶
GetSelStart returns the selection start rune index. Used for testing.
func (*TextArea) GetVisualLinesForTest ¶
func (ta *TextArea) GetVisualLinesForTest() []VisualLine
GetVisualLinesForTest returns the current visual lines as public VisualLine structs. Used for testing.
func (*TextArea) HasSelection ¶
HasSelection returns true when text is selected.
func (*TextArea) InsertText ¶
InsertText inserts text at the current cursor position. If there is a selection, it replaces the selected text.
func (*TextArea) MoveCursorDown ¶
func (ta *TextArea) MoveCursorDown()
MoveCursorDown moves the cursor to the same horizontal position on the next visual line (or to the end of the text if already on the last line).
func (*TextArea) MoveCursorEndShiftForTest ¶
MoveCursorEndShiftForTest calls moveCursorEndShift. Used for testing.
func (*TextArea) MoveCursorHomeShiftForTest ¶
MoveCursorHomeShiftForTest calls moveCursorHomeShift. Used for testing.
func (*TextArea) MoveCursorLeft ¶
func (ta *TextArea) MoveCursorLeft()
MoveCursorLeft moves the cursor one position to the left.
func (*TextArea) MoveCursorPageDownShiftForTest ¶
MoveCursorPageDownShiftForTest calls moveCursorPageDownShift. Used for testing.
func (*TextArea) MoveCursorPageUpShiftForTest ¶
MoveCursorPageUpShiftForTest calls moveCursorPageUpShift. Used for testing.
func (*TextArea) MoveCursorRight ¶
func (ta *TextArea) MoveCursorRight()
MoveCursorRight moves the cursor one position to the right.
func (*TextArea) MoveCursorRightShiftForTest ¶
MoveCursorRightShiftForTest calls moveCursorRightShift. Used for testing.
func (*TextArea) MoveCursorUp ¶
func (ta *TextArea) MoveCursorUp()
MoveCursorUp moves the cursor to the same horizontal position on the previous visual line (or to the start of the text if already on the first line).
func (*TextArea) MoveCursorUpShiftForTest ¶
MoveCursorUpShiftForTest calls moveCursorUpShift. Used for testing.
func (*TextArea) SelectAll ¶
func (ta *TextArea) SelectAll()
SelectAll selects the entire text content.
func (*TextArea) SelectWordAtCursorForTest ¶
func (ta *TextArea) SelectWordAtCursorForTest()
SelectWordAtCursorForTest calls selectWordAtCursor. Used for testing.
func (*TextArea) SelectedText ¶
SelectedText returns the currently selected text.
func (*TextArea) SetAllowedChars ¶
SetAllowedChars restricts input to characters present in the given string.
func (*TextArea) SetAlphanumericOnly ¶
func (ta *TextArea) SetAlphanumericOnly()
SetAlphanumericOnly restricts input to ASCII letters and digits.
func (*TextArea) SetCharFilter ¶
SetCharFilter sets a function called for each typed or pasted character. Return true to accept the character, false to reject it. Newlines are always allowed regardless of the filter. Passing nil clears any existing filter.
func (*TextArea) SetCursorPos ¶
SetCursorPos sets the cursor rune position directly. Used for testing.
func (*TextArea) SetEnabled ¶
SetEnabled overrides Component.SetEnabled to also update visuals.
func (*TextArea) SetMaxLength ¶
SetMaxLength limits the number of characters (0 = no limit).
func (*TextArea) SetNumericOnly ¶
func (ta *TextArea) SetNumericOnly()
SetNumericOnly restricts input to digit characters (0–9).
func (*TextArea) SetOnChange ¶
SetOnChange sets the callback for text changes.
func (*TextArea) SetSelStart ¶
SetSelStart sets the selection start directly. Used for testing.
func (*TextArea) Update ¶
func (ta *TextArea) Update()
Update handles keyboard input, cursor blink, and visual state.
func (*TextArea) UpdateVisuals ¶
func (ta *TextArea) UpdateVisuals()
UpdateVisuals applies theme colors based on current state.
type TextInput ¶
type TextInput struct {
Component
// AutoHeight, when true, causes SetSize to ignore the height argument and
// instead compute it automatically from the font size and theme padding.
// This is equivalent to calling SetWidth instead of SetSize.
AutoHeight bool
// contains filtered or unexported fields
}
TextInput is a single-line text entry field.
func NewTextInput ¶
func NewTextInput(name string, source *sg.FontFamily, displaySize float64) *TextInput
NewTextInput creates a single-line text input with the given font source and display size.
func (*TextInput) BindPasswordMode ¶
BindPasswordMode binds password mode to a reactive Ref[bool].
func (*TextInput) ClearSelectionForTest ¶
func (ti *TextInput) ClearSelectionForTest()
ClearSelectionForTest calls the internal clearSelection method. Used for testing.
func (*TextInput) CursorNode ¶
CursorNode returns the cursor sprite node. Used for testing.
func (*TextInput) DeleteBack ¶
func (ti *TextInput) DeleteBack()
DeleteBack deletes the character before the cursor (backspace). If there is a selection, it deletes the selected text instead.
func (*TextInput) DeleteForward ¶
func (ti *TextInput) DeleteForward()
DeleteForward deletes the character after the cursor (delete key). If there is a selection, it deletes the selected text instead.
func (*TextInput) DeleteSelectionForTest ¶
func (ti *TextInput) DeleteSelectionForTest()
DeleteSelectionForTest calls the internal deleteSelection method. Used for testing.
func (*TextInput) Dispose ¶
func (ti *TextInput) Dispose()
Dispose stops reactive watches and disposes the component tree.
func (*TextInput) GetCursorPos ¶
GetCursorPos returns the current cursor rune position. Used for testing.
func (*TextInput) GetPlaceholder ¶
Placeholder returns the current placeholder string. Used for testing.
func (*TextInput) GetScrollX ¶
GetScrollX returns the current horizontal scroll offset. Used for testing.
func (*TextInput) GetSelStart ¶
GetSelStart returns the selection start rune index. Used for testing.
func (*TextInput) HasSelection ¶
HasSelection returns true when text is selected.
func (*TextInput) InsertText ¶
InsertText inserts text at the current cursor position. If there is a selection, it replaces the selected text. Newlines and carriage returns are stripped since TextInput is single-line.
func (*TextInput) IsPasswordMode ¶
IsPasswordMode returns true when password masking is active.
func (*TextInput) MoveCursorEndShiftForTest ¶
MoveCursorEndShiftForTest calls moveCursorEndShift. Used for testing.
func (*TextInput) MoveCursorHomeShiftForTest ¶
MoveCursorHomeShiftForTest calls moveCursorHomeShift. Used for testing.
func (*TextInput) MoveCursorLeft ¶
func (ti *TextInput) MoveCursorLeft()
MoveCursorLeft moves the cursor one position to the left. If shift is true, the selection is extended; otherwise it collapses.
func (*TextInput) MoveCursorLeftShiftForTest ¶
MoveCursorLeftShiftForTest calls moveCursorLeftShift. Used for testing.
func (*TextInput) MoveCursorRight ¶
func (ti *TextInput) MoveCursorRight()
MoveCursorRight moves the cursor one position to the right. If shift is true, the selection is extended; otherwise it collapses.
func (*TextInput) MoveCursorRightShiftForTest ¶
MoveCursorRightShiftForTest calls moveCursorRightShift. Used for testing.
func (*TextInput) PasswordDots ¶
PasswordDots returns the password dot sprite pool. Used for testing.
func (*TextInput) SelRectNode ¶
SelRectNode returns the selection rectangle node, or nil if not created. Used for testing.
func (*TextInput) SelRectVisible ¶
SelRectVisible reports whether the selection rectangle is visible. Used for testing.
func (*TextInput) SelectAll ¶
func (ti *TextInput) SelectAll()
SelectAll selects the entire text content.
func (*TextInput) SelectWordAtCursorForTest ¶
func (ti *TextInput) SelectWordAtCursorForTest()
SelectWordAtCursorForTest calls selectWordAtCursor. Used for testing.
func (*TextInput) SelectedText ¶
SelectedText returns the currently selected text.
func (*TextInput) SetAllowedChars ¶
SetAllowedChars restricts input to characters present in the given string.
func (*TextInput) SetAlphanumericOnly ¶
func (ti *TextInput) SetAlphanumericOnly()
SetAlphanumericOnly restricts input to ASCII letters and digits.
func (*TextInput) SetCharFilter ¶
SetCharFilter sets a function called for each typed or pasted character. Return true to accept the character, false to reject it. Passing nil clears any existing filter.
func (*TextInput) SetCursorPos ¶
SetCursorPos sets the cursor rune position directly. Used for testing.
func (*TextInput) SetEnabled ¶
SetEnabled overrides Component.SetEnabled to also update visuals.
func (*TextInput) SetKeyFilter ¶
SetKeyFilter sets an optional function called before special-key processing. If it returns true for a key, TextInput skips its default handling of that key. This lets composite widgets (e.g. NumberStepper) intercept keys like Home/End.
func (*TextInput) SetMaxLength ¶
SetMaxLength limits the number of characters (0 = no limit).
func (*TextInput) SetNumericOnly ¶
func (ti *TextInput) SetNumericOnly()
SetNumericOnly restricts input to digit characters (0–9).
func (*TextInput) SetOnBlur ¶
func (ti *TextInput) SetOnBlur(fn func())
SetOnBlur sets the callback invoked when the text input loses focus.
func (*TextInput) SetOnChange ¶
SetOnChange sets the callback for text changes.
func (*TextInput) SetOnSubmit ¶
SetOnSubmit sets the callback for enter/submit.
func (*TextInput) SetPasswordMode ¶
SetPasswordMode enables or disables password masking.
func (*TextInput) SetPlaceholder ¶
SetPlaceholder sets the placeholder text shown when empty.
func (*TextInput) SetSelStart ¶
SetSelStart sets the selection start directly. Used for testing.
func (*TextInput) SetSize ¶
SetSize sets the input dimensions. If AutoHeight is true, the height argument is ignored and computed automatically from the font size and padding.
func (*TextInput) SetWidth ¶
SetWidth sets only the width, computing the height automatically from the font size and theme padding. This is the preferred way to size a TextInput when you don't need a custom height.
func (*TextInput) TextNode ¶
TextNode returns the willow text node used for displaying input content. Used for testing text input internals.
func (*TextInput) Update ¶
func (ti *TextInput) Update()
Update handles keyboard input, cursor blink, and visual state.
func (*TextInput) UpdateSelectionRectForTest ¶
func (ti *TextInput) UpdateSelectionRectForTest()
UpdateSelectionRectForTest calls the internal updateSelectionRect method. Used for testing.
func (*TextInput) UpdateVisuals ¶
func (ti *TextInput) UpdateVisuals()
UpdateVisuals applies theme colors based on current state.
type TextInputGroup ¶
type TextInputGroup = theme.TextInputGroup
type TextSpan ¶
TextSpan represents a styled segment of text within a RichText component. Fields left at their zero values inherit from the parent RichText.
type TileList ¶
type TileList struct {
Component
// ItemAlign controls horizontal alignment of each rendered item within
// its tile cell. Default is AlignCenter.
ItemAlign Alignment
// ItemVAlign controls vertical alignment of each rendered item within
// its tile cell. Default is AlignCenter.
ItemVAlign Alignment
// contains filtered or unexported fields
}
TileList is a grid-layout variant of List. Items are arranged in rows and columns, and only visible rows are rendered (virtualized).
func NewTileList ¶
NewTileList creates a new tile list with the given tile dimensions.
func (*TileList) BindItems ¶
BindItems binds the tile list to a reactive Array[ListItem]. Any mutation to the array is automatically reflected in the tile list without resetting the scroll position.
Pass nil to detach the current binding.
func (*TileList) BindSelected ¶
BindSelected binds the selection to a reactive Ref[int].
func (*TileList) ClearSelection ¶
func (tl *TileList) ClearSelection()
ClearSelection deselects the current tile.
func (*TileList) EffectiveColumns ¶
EffectiveColumns returns the computed number of columns.
func (*TileList) ScrollToIndex ¶
ScrollToIndex scrolls so that the given tile index is visible.
func (*TileList) ScrollToSelection ¶
func (tl *TileList) ScrollToSelection()
ScrollToSelection scrolls so that the currently selected tile is visible.
func (*TileList) SelectFirst ¶
func (tl *TileList) SelectFirst()
SelectFirst selects the first tile and scrolls to it.
func (*TileList) SelectLast ¶
func (tl *TileList) SelectLast()
SelectLast selects the last tile and scrolls to it.
func (*TileList) SelectNext ¶
func (tl *TileList) SelectNext()
SelectNext moves the selection to the next tile. If nothing is selected, selects the first tile. Scrolls to keep the selection visible.
func (*TileList) SelectPrevious ¶
func (tl *TileList) SelectPrevious()
SelectPrevious moves the selection to the previous tile. If nothing is selected, selects the last tile. Scrolls to keep the selection visible.
func (*TileList) Selectable ¶
Selectable returns whether built-in selection highlighting is enabled.
func (*TileList) SelectedItem ¶
SelectedItem returns the data of the currently selected tile, or nil if no tile is selected.
func (*TileList) SelectedRef ¶
SelectedRef returns the reactive Ref backing the selection index.
func (*TileList) SetColumns ¶
SetColumns sets the number of columns. 0 means auto-fit to width.
func (*TileList) SetItems ¶
SetItems replaces the tile list data and refreshes visible tiles. If SetUpdateItem has been configured, existing pool components are updated in place rather than destroyed and recreated, saving node allocation cost.
func (*TileList) SetOnChange ¶
SetOnChange sets the callback for selection changes.
func (*TileList) SetRenderItem ¶
SetRenderItem sets the factory function for tile components.
func (*TileList) SetSelectable ¶
SetSelectable enables or disables built-in selection highlighting.
func (*TileList) SetSelected ¶
SetSelected sets the selected tile index.
func (*TileList) SetUpdateItem ¶
SetUpdateItem registers an optional callback for in-place component updates. When set, SetItems will call fn for each currently pooled tile instead of disposing and recreating it. Use this to update only the data-driven parts of a tile component (text, colors, progress bars) while keeping the node tree structure intact.
tileList.SetUpdateItem(func(idx int, data any, comp *ui.Component) {
spell := data.(Spell)
// update name label, color bar, etc. on comp
})
func (*TileList) TileScrollBar ¶
TileScrollBar returns the internal scrollbar. Used for testing.
func (*TileList) TileScrollPos ¶
TileScrollPos returns the reactive scroll position ref. Used for testing.
type TimeFormat ¶
type TimeFormat int
TimeFormat selects 12-hour or 24-hour time display.
const ( TimeFormat24h TimeFormat = iota TimeFormat12h )
type TimePicker ¶
type TimePicker struct {
Component
// contains filtered or unexported fields
}
TimePicker is a compact hour/minute/second picker using up/down stepper columns separated by ":" dividers, with an optional AM/PM toggle in 12h mode.
func NewTimePicker ¶
func NewTimePicker(name string, source *sg.FontFamily, displaySize float64) *TimePicker
NewTimePicker creates a TimePicker with default 24h format, no seconds.
func (*TimePicker) AmPmButton ¶
func (tp *TimePicker) AmPmButton() *Button
AmPmButton returns the AM/PM toggle button. Useful for styling.
func (*TimePicker) BindTime ¶
func (tp *TimePicker) BindTime(ref *Ref[TimeValue])
BindTime binds the time value to a reactive Ref. Changes to the Ref update the picker, and user interactions update the Ref.
func (*TimePicker) Hour ¶
func (tp *TimePicker) Hour() int
Hour returns the current hour in 24h format (0-23).
func (*TimePicker) HourDownButton ¶
func (tp *TimePicker) HourDownButton() *Button
HourDownButton returns the hour column's down button.
func (*TimePicker) HourUpButton ¶
func (tp *TimePicker) HourUpButton() *Button
HourUpButton returns the hour column's up button. Useful for testing.
func (*TimePicker) Minute ¶
func (tp *TimePicker) Minute() int
Minute returns the current minute (0-59).
func (*TimePicker) MinuteDownButton ¶
func (tp *TimePicker) MinuteDownButton() *Button
MinuteDownButton returns the minute column's down button.
func (*TimePicker) MinuteUpButton ¶
func (tp *TimePicker) MinuteUpButton() *Button
MinuteUpButton returns the minute column's up button.
func (*TimePicker) Second ¶
func (tp *TimePicker) Second() int
Second returns the current second (0-59).
func (*TimePicker) SecondDownButton ¶
func (tp *TimePicker) SecondDownButton() *Button
SecondDownButton returns the second column's down button.
func (*TimePicker) SecondUpButton ¶
func (tp *TimePicker) SecondUpButton() *Button
SecondUpButton returns the second column's up button.
func (*TimePicker) SetEnabled ¶
func (tp *TimePicker) SetEnabled(v bool)
SetEnabled enables or disables the picker and all sub-components.
func (*TimePicker) SetFormat ¶
func (tp *TimePicker) SetFormat(format TimeFormat)
SetFormat sets 12h or 24h display format.
func (*TimePicker) SetOnTimeChanged ¶
func (tp *TimePicker) SetOnTimeChanged(fn func(h, m, s int))
SetOnTimeChanged sets the callback invoked when any time field changes.
func (*TimePicker) SetShowSeconds ¶
func (tp *TimePicker) SetShowSeconds(v bool)
SetShowSeconds shows or hides the seconds column.
func (*TimePicker) SetSize ¶
func (tp *TimePicker) SetSize(w, h float64)
SetSize resizes the picker and repositions sub-components.
func (*TimePicker) SetTime ¶
func (tp *TimePicker) SetTime(h, m, s int)
SetTime sets the time. h is in 24h range (0-23).
func (*TimePicker) UpdateVisuals ¶
func (tp *TimePicker) UpdateVisuals()
UpdateVisuals applies theme colors to all sub-components.
type TimeValue ¶
type TimeValue struct {
Hour, Minute, Second int
}
TimeValue represents a time-of-day as hour (0-23), minute, and second. It is comparable and suitable for use with Ref[TimeValue].
type ToastAnchor ¶
type ToastAnchor int
ToastAnchor specifies which screen corner toasts stack at.
const ( ToastBottomRight ToastAnchor = iota // default ToastBottomLeft ToastTopRight ToastTopLeft )
type ToastManager ¶
type ToastManager struct {
// contains filtered or unexported fields
}
ToastManager manages a stack of transient toast notifications. Use DefaultToastManager; do not construct your own.
func (*ToastManager) DismissAll ¶
func (m *ToastManager) DismissAll()
DismissAll removes all active toasts immediately.
func (*ToastManager) SetAnchor ¶
func (m *ToastManager) SetAnchor(corner ToastAnchor)
SetAnchor sets the screen corner where toasts appear.
func (*ToastManager) SetFont ¶
func (m *ToastManager) SetFont(source *sg.FontFamily, size float64)
SetFont configures the font source used to render toast messages. Call this once at startup before showing toasts. Without a font, messages are not rendered but the toast still appears with icon and progress bar.
func (*ToastManager) SetMargin ¶
func (m *ToastManager) SetMargin(x, y float64)
SetMargin sets the pixel gap between the toast stack and the screen edge (default 16×16).
func (*ToastManager) SetMaxStack ¶
func (m *ToastManager) SetMaxStack(n int)
SetMaxStack sets the maximum number of toasts visible simultaneously (default 4). When the stack is full the oldest toast is dropped immediately.
func (*ToastManager) Show ¶
func (m *ToastManager) Show(message string, variant Variant, opts ...ToastOption)
Show displays a toast with the given message and variant.
type ToastOption ¶
type ToastOption func(*toastConfig)
ToastOption is a functional option for configuring a toast.
func WithDismissOnClick ¶
func WithDismissOnClick(v bool) ToastOption
WithDismissOnClick enables or disables click-to-dismiss (default true).
func WithDuration ¶
func WithDuration(d time.Duration) ToastOption
WithDuration sets the auto-dismiss duration.
func WithOnDismiss ¶
func WithOnDismiss(fn func()) ToastOption
WithOnDismiss sets a callback invoked when the toast is dismissed.
func WithProgress ¶
func WithProgress(v bool) ToastOption
WithProgress shows a shrinking remaining-time bar at the bottom of the toast.
type Toggle ¶
type Toggle struct {
Component
// contains filtered or unexported fields
}
Toggle is a binary on/off switch with an animated sliding thumb.
func (*Toggle) Dispose ¶
func (t *Toggle) Dispose()
Dispose stops reactive watches and disposes the component tree.
func (*Toggle) SetEnabled ¶
SetEnabled overrides Component.SetEnabled to also update visuals.
func (*Toggle) SetOnChange ¶
SetOnChange sets the callback invoked when the toggle changes.
func (*Toggle) ThumbPoly ¶
ThumbPoly returns the rounded thumb polygon node, or nil if not yet created. Used for testing.
func (*Toggle) TrackPoly ¶
TrackPoly returns the rounded track polygon node, or nil if not yet created. Used for testing.
func (*Toggle) Update ¶
Update advances any active thumb animation. Call from your scene's UpdateFunc.
func (*Toggle) UpdateVisuals ¶
func (t *Toggle) UpdateVisuals()
UpdateVisuals applies theme colors based on the current state.
type ToggleButtonBar ¶
type ToggleButtonBar struct {
Component
// contains filtered or unexported fields
}
ToggleButtonBar is a segmented control for single-selection among a set of labeled buttons. Only one button is selected at a time.
func NewToggleButtonBar ¶
func NewToggleButtonBar(name string, source *sg.FontFamily, displaySize float64) *ToggleButtonBar
NewToggleButtonBar creates a new toggle button bar with the given font and display size. If displaySize is 0, the native atlas size is used.
func (*ToggleButtonBar) AddButton ¶
func (t *ToggleButtonBar) AddButton(label string)
AddButton adds a labeled button to the bar and updates layout and visuals.
func (*ToggleButtonBar) BindButtons ¶
func (t *ToggleButtonBar) BindButtons(arr *Array[string])
BindButtons binds the button labels to a reactive Array[string]. When the array changes the bar is rebuilt from the new labels, preserving the selection index where possible. Pass nil to detach.
func (*ToggleButtonBar) BindSelected ¶
func (t *ToggleButtonBar) BindSelected(ref *Ref[int])
BindSelected binds the selection to a reactive Ref[int].
func (*ToggleButtonBar) ButtonCount ¶
func (t *ToggleButtonBar) ButtonCount() int
ButtonCount returns the number of buttons.
func (*ToggleButtonBar) Dispose ¶
func (t *ToggleButtonBar) Dispose()
Dispose cleans up the toggle button bar and all its entries.
func (*ToggleButtonBar) EntriesIsNil ¶
func (t *ToggleButtonBar) EntriesIsNil() bool
EntriesIsNil reports whether the entries slice is nil (after dispose). Used for testing.
func (*ToggleButtonBar) RemoveButton ¶
func (t *ToggleButtonBar) RemoveButton(idx int)
RemoveButton removes the button at the given index.
func (*ToggleButtonBar) Selected ¶
func (t *ToggleButtonBar) Selected() int
Selected returns the currently selected button index.
func (*ToggleButtonBar) SetOnChange ¶
func (t *ToggleButtonBar) SetOnChange(fn func(int))
SetOnChange sets the callback for selection changes.
func (*ToggleButtonBar) SetSelected ¶
func (t *ToggleButtonBar) SetSelected(idx int)
SetSelected sets the selected button index.
func (*ToggleButtonBar) SetSize ¶
func (t *ToggleButtonBar) SetSize(w, h float64)
SetSize sets the toggle button bar dimensions and updates layout.
type ToolBar ¶
type ToolBar struct {
Component
// contains filtered or unexported fields
}
ToolBar is a horizontal or vertical command strip for housing actions, toggle groups, separators, and compact controls.
func NewToolBar ¶
NewToolBar creates a new ToolBar with horizontal orientation and clip overflow.
func (*ToolBar) AddSeparator ¶
func (tb *ToolBar) AddSeparator()
AddSeparator adds a visual divider between items.
func (*ToolBar) AddSpacer ¶
func (tb *ToolBar) AddSpacer()
AddSpacer adds a flexible space that pushes remaining items to the opposite end.
func (*ToolBar) Dispose ¶
func (tb *ToolBar) Dispose()
Dispose cleans up the toolbar and all its items.
func (*ToolBar) Orientation ¶
func (tb *ToolBar) Orientation() Orientation
Orientation returns the current toolbar orientation.
func (*ToolBar) RemoveItem ¶
RemoveItem removes an item by name. Only component items are matched.
func (*ToolBar) SetOrientation ¶
func (tb *ToolBar) SetOrientation(o Orientation)
SetOrientation sets the toolbar orientation (Horizontal or Vertical).
func (*ToolBar) SetOverflowMode ¶
func (tb *ToolBar) SetOverflowMode(mode ToolBarOverflowMode)
SetOverflowMode sets how overflow is handled.
type ToolBarOverflowMode ¶
type ToolBarOverflowMode int
ToolBarOverflowMode controls how items behave when they exceed the toolbar's bounds.
const ( ToolBarClip ToolBarOverflowMode = iota // items clip at edge (default) ToolBarScroll // reserved for future scroll arrows ToolBarWrap // items wrap to new row/column )
type ToolGroup ¶
type ToolGroup struct {
// contains filtered or unexported fields
}
ToolGroup manages mutually-exclusive selection among a set of IconButtons. When one button is activated, all others in the group are deactivated — similar to a radio group but for toolbar icon buttons.
func NewToolGroup ¶
func NewToolGroup() *ToolGroup
NewToolGroup creates a new ToolGroup. By default one button must always be selected; call SetAllowNone(true) to permit deselecting all.
func (*ToolGroup) Add ¶
func (tg *ToolGroup) Add(btn *IconButton)
Add appends an IconButton to the group and wires its click handler to select it (deselecting any previously active button in the group).
func (*ToolGroup) BindSelected ¶
BindSelected binds the group's selection to an external Ref[int].
func (*ToolGroup) ButtonCount ¶
ButtonCount returns the number of buttons in the group.
func (*ToolGroup) Selected ¶
Selected returns the index of the currently active button, or -1 if none.
func (*ToolGroup) SetAllowNone ¶
SetAllowNone controls whether clicking the active button deselects it (selected becomes -1). Default is false.
func (*ToolGroup) SetOnChange ¶
SetOnChange sets the callback invoked when the selection changes. The callback receives the new selected index (-1 if deselected).
func (*ToolGroup) SetSelected ¶
SetSelected activates the button at idx (pass -1 to deselect all).
type Tooltip ¶
type Tooltip struct {
Component
// Configuration — set before first show; take effect on next show.
ShowDelay int // frames of hover before appearing (default 30)
HideDelay int // frames after cursor leaves before hiding (default 0)
Anchor TooltipAnchor // placement strategy (default TooltipAuto)
OffsetX float64 // horizontal nudge after placement (+right)
OffsetY float64 // vertical nudge after placement (+down) (default 4)
FadeInDuration float32 // fade-in duration in seconds (0 = instant)
FadeOutDuration float32 // fade-out duration in seconds (0 = instant)
FadeInEase sg.EaseFunc // easing for fade-in (nil = linear)
FadeOutEase sg.EaseFunc // easing for fade-out (nil = linear)
ClampToScreen bool // keep fully inside viewport (default true)
ClampMargin float64 // minimum gap from each viewport edge (default 4)
// contains filtered or unexported fields
}
Tooltip is a floating overlay that appears after a hover delay, anchored relative to the triggering widget. It embeds Component, giving it full layout and child-management capabilities.
Tooltips are never added directly to the scene — the DefaultTooltipManager manages their lifecycle.
func NewTooltip ¶
NewTooltip creates a Tooltip with sensible defaults.
func (*Tooltip) Dispose ¶
func (tt *Tooltip) Dispose()
Dispose hides the tooltip and releases resources.
func (*Tooltip) Hide ¶
func (tt *Tooltip) Hide()
Hide hides the tooltip immediately, bypassing HideDelay and FadeOut.
func (*Tooltip) SetAnchor ¶
func (tt *Tooltip) SetAnchor(a TooltipAnchor)
SetAnchor sets the Anchor placement strategy.
func (*Tooltip) SetClampMargin ¶
SetClampMargin sets the minimum pixel gap from each viewport edge.
func (*Tooltip) SetClampToScreen ¶
SetClampToScreen enables or disables viewport clamping.
func (*Tooltip) SetFadeOut ¶
SetFadeOut sets the fade-out duration in seconds.
func (*Tooltip) SetHideDelay ¶
SetHideDelay sets the HideDelay.
func (*Tooltip) SetShowDelay ¶
SetShowDelay sets the ShowDelay.
type TooltipAnchor ¶
type TooltipAnchor int
TooltipAnchor controls where a tooltip is placed relative to its trigger.
const ( // Trigger-relative anchors. TooltipAuto TooltipAnchor = iota // pick direction with most available space TooltipAbove // centered horizontally, flush above trigger TooltipBelow // centered horizontally, flush below trigger TooltipLeft // centered vertically, flush left of trigger TooltipRight // centered vertically, flush right of trigger // Viewport-corner anchors. TooltipCornerTopLeft TooltipCornerTopRight TooltipCornerBottomLeft TooltipCornerBottomRight // Mouse-tracking anchor. TooltipFollowMouse // repositions every frame at cursor + OffsetX/OffsetY )
type TooltipManager ¶
type TooltipManager struct {
// Enabled controls whether tooltips are shown at all (default true).
Enabled bool
// contains filtered or unexported fields
}
TooltipManager manages tooltip visibility for the scene. It is driven by a ticker node added to the scene root when SetScene is called.
The package-level DefaultTooltipManager is used by all components.
type TreeList ¶
type TreeList struct {
Component
// contains filtered or unexported fields
}
TreeList is a hierarchical list with expand/collapse support. Visible nodes are flattened into a list and rendered using the same virtualization as List.
func NewTreeList ¶
NewTreeList creates a new tree list with the given item height.
func (*TreeList) BindRoots ¶
func (tl *TreeList) BindRoots(arr *Array[*ReactiveTreeNode])
BindRoots binds the tree list to a reactive Array[*ReactiveTreeNode]. Changes to any Children array anywhere in the subtree — at any depth — are automatically reflected in the tree view without resetting the scroll position or expand/collapse state.
The binding uses a stable internal map so that the *TreeNode pointers backing the selection ref remain valid across tree mutations.
Pass nil to detach the current binding.
func (*TreeList) BindSelected ¶
BindSelected binds the selection to a reactive Ref[*TreeNode].
func (*TreeList) ClearSelection ¶
func (tl *TreeList) ClearSelection()
ClearSelection deselects the current node.
func (*TreeList) CollapseAll ¶
func (tl *TreeList) CollapseAll()
CollapseAll collapses all tree nodes.
func (*TreeList) ExpandAll ¶
func (tl *TreeList) ExpandAll()
ExpandAll expands all tree nodes that have children.
func (*TreeList) IsExpanded ¶
IsExpanded reports whether a tree node is expanded.
func (*TreeList) LeafOnlySelection ¶
LeafOnlySelection reports whether only leaf nodes can be selected.
func (*TreeList) Selectable ¶
Selectable reports whether built-in selection highlighting is enabled.
func (*TreeList) SelectedRef ¶
SelectedRef returns the reactive Ref backing the selection.
func (*TreeList) SetDefaultTextRenderer ¶
func (tl *TreeList) SetDefaultTextRenderer(source *sg.FontFamily, displaySize float64, rowW, rowH float64)
SetDefaultTextRenderer configures a standard text rendering function for the tree list. Each node's Data is expected to be a string. Rows include depth-based indentation, a toggle button (or spacer for leaves), and a label.
func (*TreeList) SetLeafOnlySelection ¶
SetLeafOnlySelection restricts selection to leaf nodes (nodes with no children). Parent nodes remain clickable for expand/collapse but cannot be selected. Has no effect when selectable is false.
func (*TreeList) SetOnChange ¶
SetOnChange sets the callback invoked when the selection changes.
func (*TreeList) SetRenderItem ¶
SetRenderItem sets the factory function for rendering tree nodes.
func (*TreeList) SetSelectable ¶
SetSelectable enables or disables built-in selection highlighting. When enabled, clicking a row selects it and a highlight bar is shown.
func (*TreeList) SetSelected ¶
SetSelected sets the selected node.
func (*TreeList) SetToggleIcons ¶
SetToggleIcons sets custom expand and collapse icon images for tree toggle buttons created by NewTreeToggle. When set, these are used instead of the default procedural glyphs.
type TreeTable ¶
type TreeTable struct {
Component
// contains filtered or unexported fields
}
TreeTable is a hybrid tree + column grid where rows can be expanded/collapsed while each row spans multiple data columns.
func NewTreeTable ¶
func NewTreeTable(name string, source *sg.FontFamily, displaySize float64) *TreeTable
NewTreeTable creates a new TreeTable with the given name, font, and display size.
func (*TreeTable) Columns ¶
func (tt *TreeTable) Columns() []TableColumn
Columns returns a copy of the current column definitions.
func (*TreeTable) ExpandAll ¶
func (tt *TreeTable) ExpandAll()
ExpandAll expands all rows that have children.
func (*TreeTable) IsExpanded ¶
IsExpanded reports whether the given row ID is expanded.
func (*TreeTable) RowIDAt ¶
RowIDAt returns the row ID at the given flat list index, or "" if out of range.
func (*TreeTable) Rows ¶
func (tt *TreeTable) Rows() []TreeTableRow
Rows returns a copy of the original row data.
func (*TreeTable) SetColumns ¶
func (tt *TreeTable) SetColumns(cols []TableColumn)
SetColumns sets the column definitions.
func (*TreeTable) SetExpanded ¶
SetExpanded sets the expansion state for a given row ID.
func (*TreeTable) SetOnRowClick ¶
SetOnRowClick sets the callback for interactive row clicks.
func (*TreeTable) SetOnRowExpand ¶
SetOnRowExpand sets the callback for expand/collapse events.
func (*TreeTable) SetRows ¶
func (tt *TreeTable) SetRows(rows []TreeTableRow)
SetRows sets the row data. Rows may be nested via Children or flat via ParentID.
func (*TreeTable) SetSelected ¶
SetSelected sets the selected flat list index programmatically. This does NOT fire OnRowClick.
func (*TreeTable) SetSortColumn ¶
SetSortColumn sets the sort column key and direction.
func (*TreeTable) VisibleRowCount ¶
VisibleRowCount returns the number of rows currently in the flat list.
type TreeTableRow ¶
type TreeTableRow struct {
ID string
ParentID string // empty = root row
Cells map[string]string
Children []TreeTableRow
}
TreeTableRow represents a row in the TreeTable hierarchy.
type TwoColumnLayout ¶
type TwoColumnLayout struct {
Panel
// LeftAlign controls alignment within the left column.
// Default: AlignEnd (right-aligned, suits labels).
LeftAlign Alignment
// RightAlign controls alignment within the right column.
// Default: AlignStart (left-aligned, suits inputs).
RightAlign Alignment
// LeftWidth sets a fixed pixel width for the left column.
// When zero, ColumnRatio or an even split determines the width.
LeftWidth float64
// ColumnRatio sets the fraction of available width (after Gap) given to the
// left column. 0.3 means left=30%, right=70%. Only used when LeftWidth is 0.
// When both are zero, the columns split evenly (ratio 0.5).
ColumnRatio float64
// Gap is the horizontal space between the two columns.
Gap float64
// RowSpacing is the vertical space between rows.
RowSpacing float64
// contains filtered or unexported fields
}
TwoColumnLayout arranges children in labeled two-column rows. Each column is independently aligned. The primary use case is settings screens, stat sheets, and form dialogs where the left column contains labels and the right column contains input widgets.
Children are added in pairs via AddRow. The left column defaults to right-aligned (AlignEnd) for labels; the right column defaults to left-aligned (AlignStart) for values and inputs.
func NewTwoColumnLayout ¶
func NewTwoColumnLayout(name string) *TwoColumnLayout
NewTwoColumnLayout creates a TwoColumnLayout container with sensible defaults: left column right-aligned, right column left-aligned, 12px gap, 8px row spacing.
func (*TwoColumnLayout) AddRow ¶
func (tl *TwoColumnLayout) AddRow(left, right UIElement)
AddRow adds a row. When both left and right are provided, they are placed in their respective columns. When right is nil, left spans the full available width across both columns (clear:both equivalent).
func (*TwoColumnLayout) RemoveRow ¶
func (tl *TwoColumnLayout) RemoveRow(left UIElement)
RemoveRow removes the row containing left (or the spanning child), detaching it.
func (*TwoColumnLayout) SizeToContent ¶
func (tl *TwoColumnLayout) SizeToContent()
SizeToContent resizes the layout to tightly wrap all rows. Children must have their sizes set before calling this. UpdateLayout is called internally.
type UIElement ¶
type UIElement interface {
// contains filtered or unexported methods
}
UIElement is implemented by all UI component types in this package. The unexported method prevents external types from implementing it.
type ValidationState ¶
type ValidationState int
ValidationState indicates the current validation status of an InputField.
const ( ValidationNone ValidationState = iota // no validation state ValidationError // error state ValidationWarning // warning state ValidationSuccess // success state )
type VisualLine ¶
type VisualLine struct {
RuneStart int // first rune index (inclusive)
RuneEnd int // end rune index (exclusive)
}
VisualLine is the exported representation of a visual line for testing.
type WatchHandle ¶
type WatchHandle = reactive.WatchHandle
func WatchEffect ¶
func WatchEffect(fn func()) WatchHandle
WatchEffect creates a reactive effect that re-runs when dependencies change.
func WatchValue ¶
func WatchValue[T comparable](ref *Ref[T], fn func(old, new T)) WatchHandle
WatchValue watches a specific Ref and calls fn with old and new values.
type Window ¶
type Window struct {
Component
// contains filtered or unexported fields
}
Window is a draggable, closeable, optionally resizable container with a title bar and body panel.
func NewWindow ¶
NewWindow creates a window with the given title, font source, and display size. The window is draggable by the title bar and includes a close button.
func (*Window) BringToFront ¶
func (w *Window) BringToFront()
BringToFront moves this window in front of siblings by setting a high Z-index via the DefaultWindowManager.
func (*Window) Close ¶
func (w *Window) Close()
Close hides the window and fires the onClose callback.
func (*Window) CloseBtn ¶
func (w *Window) CloseBtn() *IconButton
CloseBtn returns the window's close IconButton widget. Used for testing window internals.
func (*Window) FireResult ¶
FireResult hides the window and delivers a result to the registered handler. Typical use: button clicks or keyboard shortcuts inside the modal call FireResult("confirm", nil), FireResult("cancel", nil), etc.
func (*Window) ResizeFlat ¶
ResizeFlat returns the flat sprite resize handle node. Used for testing resize handle visibility.
func (*Window) ResizeHandle ¶
ResizeHandle returns the polygon resize grip node. Used for testing resize handle visibility.
func (*Window) SetCloseIcon ¶
SetCloseIcon sets a custom image for the close button icon at its native size and centers it within the button.
func (*Window) SetCloseable ¶
SetCloseable shows or hides the close button.
func (*Window) SetEnterResult ¶
SetEnterResult configures Enter to call FireResult(key, nil) while the window is visible. Pass "" to disable. Note: if a TextInput inside the dialog has focus, Enter is consumed by that input first.
func (*Window) SetEscResult ¶
SetEscResult configures Escape to call FireResult(key, nil) while the window is visible. Pass "" to disable.
func (*Window) SetMinHeight ¶
SetMinHeight sets the minimum height constraint for the window. Used for testing resize clamping.
func (*Window) SetMinSize ¶
SetMinSize sets the minimum window dimensions enforced during resize.
func (*Window) SetMinWidth ¶
SetMinWidth sets the minimum width constraint for the window. Used for testing resize clamping.
func (*Window) SetModal ¶
SetModal enables or disables modal mode. When modal, a semi-transparent overlay fills the viewport behind the window and intercepts all pointer input so nothing below it can be clicked. The overlay is created lazily the first time the window has a parent in the scene graph; call this after adding the window to the scene (or show it after SetModal) to guarantee the overlay is attached.
func (*Window) SetModalOverlayColor ¶
SetModalOverlayColor sets the color of the modal backdrop overlay. The default is semi-transparent black (RGBA 0,0,0,0.5).
func (*Window) SetMovable ¶
SetMovable controls whether the window can be repositioned by dragging the title bar. Defaults to true. Set to false for fixed-position dialogs.
func (*Window) SetOnClose ¶
func (w *Window) SetOnClose(fn func())
SetOnClose sets the callback invoked when the window is closed.
func (*Window) SetOnModalOverlayClick ¶
func (w *Window) SetOnModalOverlayClick(fn func())
SetOnModalOverlayClick sets a callback invoked when the user clicks the modal backdrop overlay. Set to nil to disable. Use this to implement "click outside to dismiss" behavior.
func (*Window) SetOnResult ¶
SetOnResult registers the handler called when FireResult is invoked. key identifies the outcome (e.g. "confirm", "cancel"); data is optional payload. Set to nil to remove. Intended to be set by the caller each time the modal is opened so each invocation can handle its own outcome independently.
func (*Window) SetResizable ¶
SetResizable enables or disables the resize handle at the bottom-right.
func (*Window) SetTitleBarHeight ¶
SetTitleBarHeight sets the title bar height and recalculates layout.
func (*Window) SetVisible ¶
SetVisible overrides Component.SetVisible to keep the modal overlay in sync.
func (*Window) SizeToContent ¶
func (w *Window) SizeToContent()
SizeToContent sizes the window body to fit its children, then resizes the window to match (adding the title bar height). The resulting size is also set as the minimum size.
func (*Window) TitleLabel ¶
TitleLabel returns the window's title Label widget. Used for testing window internals.
type WindowManager ¶
type WindowManager struct {
// contains filtered or unexported fields
}
WindowManager tracks a set of windows and handles z-ordering so that clicking any registered window automatically brings it to the front. It also tracks the active window and updates title bar colors.
func NewWindowManager ¶
func NewWindowManager() *WindowManager
NewWindowManager creates an empty WindowManager.
func (*WindowManager) Active ¶
func (wm *WindowManager) Active() *Window
Active returns the currently active (foremost) window, or nil.
func (*WindowManager) Add ¶
func (wm *WindowManager) Add(w *Window)
Add registers a window with the manager. Clicking anywhere on the window (title bar, body, resize handle) automatically brings it to the front.
func (*WindowManager) BringToFront ¶
func (wm *WindowManager) BringToFront(w *Window)
BringToFront moves the given window in front of all other managed windows and marks it as the active window, updating title bar colors.
func (*WindowManager) Remove ¶
func (wm *WindowManager) Remove(w *Window)
Remove unregisters a window from the manager.
func (*WindowManager) Windows ¶
func (wm *WindowManager) Windows() []*Window
Windows returns the currently registered windows.
Source Files
¶
- accordion.go
- anchorlayout.go
- animatedimage.go
- badge.go
- button.go
- calendarselector.go
- checkbox.go
- clipboard_default.go
- colorpicker.go
- component.go
- contextmenu.go
- controller.go
- datatable.go
- draghandle.go
- focus.go
- gradienteditor.go
- icons.go
- image.go
- imagecropper.go
- input.go
- inputfield.go
- keybindinput.go
- label.go
- layout.go
- list.go
- markup.go
- maskedinput.go
- menubar.go
- menupopup.go
- navdrawer.go
- nineslice.go
- numberstepper.go
- optionrotator.go
- panel.go
- popover.go
- progressbar.go
- radio.go
- reactive.go
- richtext.go
- roundedrect.go
- scene.go
- scrollbar.go
- scrollpanel.go
- searchbox.go
- select_widget.go
- slider.go
- sortablelist.go
- sortabletreelist.go
- spacer.go
- statweb.go
- tabs.go
- tag.go
- tagbar.go
- textarea.go
- textinput.go
- theme.go
- tilelist.go
- timepicker.go
- toast.go
- toggle.go
- togglebuttonbar.go
- toolbar.go
- toolgroup.go
- tooltip.go
- treelist.go
- treetable.go
- twocolumnlayout.go
- window.go