avyos.dev/pkg/graphics/widget/engine
package engine
Overview
No package-level documentation is provided.
| Export Group | Count |
|---|---|
| Constants | 0 |
| Variables | 0 |
| Functions | 0 |
| Types | 2 |
Types
Element
type Element struct {
// contains filtered or unexported fields
}Element is the universal DOM-like node. Every UI element is an Element. It implements widget.Widget and renders entirely from attributes. Based on its attributes, it can behave as any widget: button, text input, checkbox, slider, container, etc.
Functions
BuildMenuPopup
func BuildMenuPopup(menu *Element, closeFn func()) (*Element, int, int, bool)BuildMenuPopup clones a menu subtree and returns popup content plus dimensions.
NewElement
func NewElement(tag string) *ElementNewElement creates a new Element with the given tag.
Methods
AddChild
func (e *Element) AddChild(child *Element)AddChild adds a child element.
Attr
func (e *Element) Attr(name, def string) stringAttr returns the string attribute or default.
AttrBool
func (e *Element) AttrBool(name string, def bool) boolAttrBool returns a boolean attribute or default.
AttrColor
func (e *Element) AttrColor(name string, def color.NRGBA) color.NRGBAAttrColor returns a color attribute or default.
AttrFloat
func (e *Element) AttrFloat(name string, def float64) float64AttrFloat returns a float attribute or default.
AttrInt
func (e *Element) AttrInt(name string, def int) intAttrInt returns an integer attribute or default.
BindSignal
func (e *Element) BindSignal(name string, fn interface{}) boolBindSignal binds a runtime signal handler (for example "clicked").
Bounds
func (e *Element) Bounds() image.RectangleChildElements
func (e *Element) ChildElements() []*ElementChildElements returns child elements.
Children
func (e *Element) Children() []gfxwidget.WidgetChildren returns child widgets (for app.App damage tracking).
ClearChildren
func (e *Element) ClearChildren()ClearChildren removes all child elements.
DirtyRects
func (e *Element) DirtyRects() []image.RectangleDirtyRects returns optional subregions that should be redrawn for this widget. Nil means repaint the full widget bounds.
Draw
func (e *Element) Draw(buf *core.Buffer)EmitSignal
func (e *Element) EmitSignal(name string, args ...interface{})EmitSignal emits a signal by name with optional args.
FindChild
func (e *Element) FindChild(id string) *ElementFindChild finds a descendant by id (depth-first).
GetAttribute
func (e *Element) GetAttribute(name string) stringGetAttribute returns an attribute value.
HandleEvent
func (e *Element) HandleEvent(ev gfxinput.Event) boolHasAttribute
func (e *Element) HasAttribute(name string) boolHasAttribute reports whether the attribute key exists.
ID
func (e *Element) ID() stringID returns the element's id.
IsDirty
func (e *Element) IsDirty() boolIsFocused
func (e *Element) IsFocused() boolIsVisible
func (e *Element) IsVisible() boolMarkClean
func (e *Element) MarkClean()MarkDirty
func (e *Element) MarkDirty()MinSize
func (e *Element) MinSize() image.PointScrollTextAreaToBottom
func (e *Element) ScrollTextAreaToBottom()ScrollTextAreaToBottom moves the multiline viewport to the newest lines.
SelfDirty
func (e *Element) SelfDirty() boolSetAttribute
func (e *Element) SetAttribute(name string, value interface{})SetAttribute sets an attribute value and marks dirty.
SetBounds
func (e *Element) SetBounds(r image.Rectangle)SetFocused
func (e *Element) SetFocused(focused bool)SetID
func (e *Element) SetID(id string)SetID updates the element id.
SetTerminalBuffer
func (e *Element) SetTerminalBuffer(lines [][]TerminalCell, cursorCol, cursorRow int, showCursor bool)SetTerminalBuffer updates a multiline element with terminal-styled cells. It keeps the text-area scroll state while replacing its backing lines.
SetVisible
func (e *Element) SetVisible(visible bool)Tag
func (e *Element) Tag() stringTag returns the element's tag name.
TextAreaAtBottom
func (e *Element) TextAreaAtBottom(threshold int) boolTextAreaAtBottom reports whether the current multiline viewport is at the end.
TerminalCell
type TerminalCell struct {
Char rune
Fg color.NRGBA
Bg color.NRGBA
Underline bool
}TerminalCell holds one terminal glyph with resolved foreground/background colors.