Documentation
¶
Overview ¶
Package ui owns the immediate-mode frame tree, controls, editors, input routing and the Wayland run loop behind the public nefergui facade.
Index ¶
- func Run[T any](ctx context.Context, model *T, view func(*Frame, *T), options ...WindowOption) error
- func RunFrames[T any](ctx context.Context, frames int, model *T, view func(*Frame, *T), ...) error
- type ButtonEvent
- type ButtonOption
- type ChangeEvent
- type CommonOption
- type ContainerOption
- type DisabledOption
- type EditEvent
- type EditOption
- type Frame
- type HeadingOption
- type Node
- func (n Node) Aside(options ...ContainerOption) Node
- func (n Node) Box(options ...ContainerOption) Node
- func (n Node) Button(label string, options ...ButtonOption) ButtonEvent
- func (n Node) Checkbox(label string, value *bool, options ...ButtonOption) ChangeEvent
- func (n Node) Column(options ...ContainerOption) Node
- func (n Node) Element(typ string, options ...ContainerOption) Node
- func (n Node) Footer(options ...ContainerOption) Node
- func (n Node) Header(options ...ContainerOption) Node
- func (n Node) Heading(text string, options ...HeadingOption)
- func (n Node) Icon(name string, options ...ContainerOption)
- func (n Node) Image(img image.Image, options ...ContainerOption)
- func (n Node) Input(label string, value *string, options ...EditOption) EditEvent
- func (n Node) Main(options ...ContainerOption) Node
- func (n Node) Nav(options ...ContainerOption) Node
- func (n Node) Radio(label, option string, selected *string, options ...ButtonOption) ChangeEvent
- func (n Node) Row(options ...ContainerOption) Node
- func (n Node) Scroll(options ...ContainerOption) Node
- func (n Node) Section(options ...ContainerOption) Node
- func (n Node) Separator(options ...ContainerOption)
- func (n Node) Slider(label string, value *float64, min, max, step float64, options ...ValueOption) ChangeEvent
- func (n Node) Spacer(options ...ContainerOption)
- func (n Node) Stack(options ...ContainerOption) Node
- func (n Node) Text(text string, options ...ContainerOption)
- func (n Node) Textarea(label string, value *string, options ...EditOption) EditEvent
- type ValueOption
- type WindowOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ButtonEvent ¶
type ButtonEvent struct {
// contains filtered or unexported fields
}
Control event values are immutable snapshots; querying them never consumes events.
func (ButtonEvent) Activated ¶
func (e ButtonEvent) Activated() bool
type ButtonOption ¶
type ButtonOption interface {
// contains filtered or unexported methods
}
type ChangeEvent ¶
type ChangeEvent struct {
// contains filtered or unexported fields
}
func (ChangeEvent) Changed ¶
func (e ChangeEvent) Changed() bool
type CommonOption ¶
type CommonOption struct {
// contains filtered or unexported fields
}
CommonOption is the concrete type of Key, ID, Class and Inline; it belongs to every option family. It is exported only so the root facade can return it.
func Class ¶
func Class(class string) CommonOption
func ID ¶
func ID(id string) CommonOption
func Inline ¶
func Inline(src string) CommonOption
func Key ¶
func Key(key string) CommonOption
type ContainerOption ¶
type ContainerOption interface {
// contains filtered or unexported methods
}
ContainerOption, ButtonOption and EditOption are separate option families.
type DisabledOption ¶
type DisabledOption struct {
// contains filtered or unexported fields
}
DisabledOption is the concrete type of Disabled. It applies to every interactive control (buttons, value controls and editors) but not to containers or headings. Exported only so the root facade can return it.
func Disabled ¶
func Disabled(v bool) DisabledOption
Disabled blocks focus and interaction on an interactive control.
type EditOption ¶
type EditOption interface {
// contains filtered or unexported methods
}
func Password ¶
func Password(v bool) EditOption
func Placeholder ¶
func Placeholder(v string) EditOption
type Frame ¶
type Frame struct {
// contains filtered or unexported fields
}
Frame is valid only during one call to the view function.
func (*Frame) Diagnostics ¶
Diagnostics returns a copy of frame diagnostics (populated with -tags nefergui_debug).
func (*Frame) Root ¶
func (f *Frame) Root(options ...ContainerOption) Node
type HeadingOption ¶
type HeadingOption interface {
// contains filtered or unexported methods
}
HeadingOption accepts common CSS options and Level, but not control options.
func Level ¶
func Level(level int) HeadingOption
Level sets the accessibility heading level (1 through 6).
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is an ephemeral handle into the current frame. Do not retain it between frames.
func (Node) Aside ¶
func (n Node) Aside(options ...ContainerOption) Node
func (Node) Box ¶
func (n Node) Box(options ...ContainerOption) Node
func (Node) Button ¶
func (n Node) Button(label string, options ...ButtonOption) ButtonEvent
func (Node) Checkbox ¶
func (n Node) Checkbox(label string, value *bool, options ...ButtonOption) ChangeEvent
func (Node) Column ¶
func (n Node) Column(options ...ContainerOption) Node
func (Node) Footer ¶
func (n Node) Footer(options ...ContainerOption) Node
func (Node) Header ¶
func (n Node) Header(options ...ContainerOption) Node
func (Node) Heading ¶
func (n Node) Heading(text string, options ...HeadingOption)
func (Node) Icon ¶
func (n Node) Icon(name string, options ...ContainerOption)
func (Node) Image ¶
func (n Node) Image(img image.Image, options ...ContainerOption)
Image borrows a decoded Go image. Treat its pixels as immutable while passed to Image; pass a new image value to change pixels. Renderer cache identity requires a comparable image.Image value (for example, *image.RGBA).
func (Node) Input ¶
func (n Node) Input(label string, value *string, options ...EditOption) EditEvent
func (Node) Main ¶
func (n Node) Main(options ...ContainerOption) Node
func (Node) Nav ¶
func (n Node) Nav(options ...ContainerOption) Node
func (Node) Radio ¶
func (n Node) Radio(label, option string, selected *string, options ...ButtonOption) ChangeEvent
func (Node) Row ¶
func (n Node) Row(options ...ContainerOption) Node
func (Node) Scroll ¶
func (n Node) Scroll(options ...ContainerOption) Node
func (Node) Section ¶
func (n Node) Section(options ...ContainerOption) Node
func (Node) Separator ¶
func (n Node) Separator(options ...ContainerOption)
func (Node) Slider ¶
func (n Node) Slider(label string, value *float64, min, max, step float64, options ...ValueOption) ChangeEvent
func (Node) Spacer ¶
func (n Node) Spacer(options ...ContainerOption)
func (Node) Stack ¶
func (n Node) Stack(options ...ContainerOption) Node
func (Node) Text ¶
func (n Node) Text(text string, options ...ContainerOption)
type ValueOption ¶
type ValueOption interface {
// contains filtered or unexported methods
}
ValueOption accepts CSS options and Disabled for pointer-backed controls.
type WindowOption ¶
type WindowOption interface {
// contains filtered or unexported methods
}
func Size ¶
func Size(w, h int) WindowOption
func Styles ¶
func Styles(s string) WindowOption
func Title ¶
func Title(s string) WindowOption
func Transparent ¶
func Transparent() WindowOption
Transparent requests an alpha-capable Wayland surface (opaque by default).