Documentation
¶
Index ¶
- Variables
- func ClampDim(v, min, max float64) float64
- func ClipboardRead() (string, error)
- func ClipboardWrite(s string)
- func IsKeyJustPressed(key engine.Key) bool
- func ResolveAutoInsets(i, fallback render.Insets) render.Insets
- func SetScene(s *sg.Scene)
- type Alignment
- type Anchor
- type Background
- type BackgroundType
- type ComponentState
- type LayoutMode
- type Orientation
Constants ¶
This section is empty.
Variables ¶
var ( DefaultButtonPadding = render.Insets{Top: 8, Right: 16, Bottom: 8, Left: 16} DefaultTextInputPadding = render.Insets{Top: 8, Right: 8, Bottom: 8, Left: 8} DefaultTextAreaPadding = render.Insets{Top: 8, Right: 8, Bottom: 8, Left: 8} DefaultBarPadding = render.Insets{Top: 4, Right: 4, Bottom: 4, Left: 4} )
Default auto-padding values per component type.
var ActiveScene *sg.Scene
ActiveScene holds the current scene for input injection support. Set via SetScene; used by TextInput/TextArea to read injected chars/keys.
var AutoPadding = render.Insets{Top: -1, Right: -1, Bottom: -1, Left: -1}
AutoPadding is the sentinel Insets value meaning "use the component's built-in default padding". All four fields are -1.
var FallbackScene *sg.Scene
FallbackScene keeps the last non-nil scene registered with SetScene. It lets injected-key lookups continue to work when ActiveScene is nil.
var StateFallbacks = [StateCount][]ComponentState{ StateDefault: {}, StateHover: {StateDefault}, StateActive: {StateHover, StateDefault}, StateDisabled: {StateDefault}, StateFocus: {StateActive, StateHover, StateDefault}, StateFocusHover: {StateHover, StateFocus, StateDefault}, StateFocusActive: {StateFocus, StateActive, StateDefault}, StateFocusDisabled: {StateDisabled, StateDefault}, }
StateFallbacks defines the fallback chain for each state. Each entry is tried left-to-right; the first non-zero value is used. StateDefault has no fallbacks (it is the terminal).
Functions ¶
func ClipboardRead ¶
ClipboardRead reads the current clipboard contents.
func IsKeyJustPressed ¶
IsKeyJustPressed returns true if the key was just pressed via real input or was present in the injected keys queue.
func ResolveAutoInsets ¶
ResolveAutoInsets returns fallback if i is auto, otherwise returns i unchanged.
Types ¶
type Alignment ¶
type Alignment int
Alignment controls child positioning. Used for both cross-axis (Align) and main-axis (Justify) in VBox/HBox layouts.
type Anchor ¶
type Anchor int
Anchor identifies a position within a parent container. Used by AnchorLayout to pin children to edges or corners.
type Background ¶
type Background struct {
Type BackgroundType
Color sg.Color
Slice *render.NineSlice
Gradient *render.GradientColors
}
Background describes how to render a component's background.
func GradientBackground ¶
func GradientBackground(g *render.GradientColors) Background
GradientBackground creates a gradient background.
func SliceBackground ¶
func SliceBackground(s *render.NineSlice) Background
SliceBackground creates a nine-slice background.
func SolidBackground ¶
func SolidBackground(c sg.Color) Background
SolidBackground creates a solid-color background.
type BackgroundType ¶
type BackgroundType uint8
BackgroundType tags the kind of background rendering.
const ( BgNone BackgroundType = iota BgSolid BgNineSlice BgGradient )
type ComponentState ¶
type ComponentState uint8
ComponentState represents the visual state of a component.
const ( StateDefault ComponentState = iota StateHover StateActive StateDisabled StateFocus StateFocusHover StateFocusActive StateFocusDisabled StateCount // exported sentinel for array sizing )
func ComputeState ¶
func ComputeState(enabled, focused, hovered, active bool) ComponentState
ComputeState maps component boolean flags to a ComponentState.
type LayoutMode ¶
type LayoutMode int
LayoutMode controls how a Component arranges its children.
const ( // LayoutNone uses manual positioning; children keep their own X/Y. LayoutNone LayoutMode = iota // LayoutVBox stacks children vertically with spacing between them. LayoutVBox // LayoutHBox stacks children horizontally with spacing between them. LayoutHBox // LayoutGrid arranges children in a fixed-column grid. LayoutGrid // LayoutFlow arranges children left-to-right, wrapping to new rows when // the available width is exceeded. 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 )
type Orientation ¶
type Orientation int
Orientation represents horizontal or vertical direction.
const ( Horizontal Orientation = iota Vertical )