Documentation
¶
Index ¶
- Constants
- Variables
- func AccessibilityTree(root Widget) []platform.AccessibilityNode
- func BlendOver(dst, src graphics.Color) graphics.Color
- func CheckRecursiveLayout(depth int, maxDepth int) bool
- func ChildLocal(child Widget, x, y float32) (float32, float32, bool)
- func ChildLocalAmong(child Widget, x, y float32, siblings []Widget) (float32, float32, bool)
- func ChildLocalAmongFor(child Widget, x, y float32, siblings []Widget, floorOn bool) (float32, float32, bool)
- func ChildLocalFor(child Widget, x, y float32, floorOn bool) (float32, float32, bool)
- func ClearDragOverlay()
- func CloseDebug()
- func ColorLerp(a, b graphics.Color, t float32) graphics.Color
- func ContainsWidget(root, target Widget) bool
- func DefaultIcon() *graphics.Image
- func DetectAnchorCycles(w Widget) []string
- func DrawFocusRing(c *graphics.Canvas, r graphics.Rect, radius float32)
- func DrawFocusRingInk(c *graphics.Canvas, r graphics.Rect, radius float32, ink graphics.Color)
- func DrawSVG(canvas *graphics.Canvas, doc *SVGDocument, x, y, width, height float32)
- func DrawShadow(c *graphics.Canvas, r graphics.Rect, radius float32, spec theme.ShadowSpec)
- func Ease(k theme.Easing, t float32) float32
- func ExportTreeJSON(root Widget) error
- func InitDebug()
- func IsInteractive(w Widget) bool
- func LogEvent(widgetName, eventType string)
- func LogEventf(widgetName, format string, args ...interface{})
- func MinTouchTarget() float32
- func OpenURL(url string)
- func PrintTree(root Widget, indent int)
- func PrintTreeToFile(root Widget, indent int, f *os.File)
- func RegisterInteractiveType(name string)
- func RegisterNamedWidget(id string, w Widget)
- func ReportTestCoverage()
- func ScaleGradient(g graphics.Gradient, r graphics.Rect) graphics.Gradient
- func SetAnimationFrameRequester(fn func())
- func SetDefaultChrome(f func(root *Window, w platform.Window) platform.TitleBar)
- func SetDragOverlay(img *graphics.Image, x, y, w, h float32)
- func SetTouchProfile(on bool)
- func SetTreePaths(root Widget)
- func ShadowToken(name string) (theme.ShadowSpec, bool)
- func TouchHitFrame(child Widget, f graphics.Rect) graphics.Rect
- func TouchHitFrameAmong(child Widget, f graphics.Rect, siblings []Widget) graphics.Rect
- func TouchHitFrameAmongWith(child Widget, f graphics.Rect, siblings []Widget, floorOn bool) graphics.Rect
- func TouchHitFrameWith(child Widget, f graphics.Rect, floorOn bool) graphics.Rect
- func TouchProfile() bool
- func TouchProfileForSize(width, height, scale float32) bool
- func TrackWidgetCreation(w Widget)
- func TrackWidgetDisposal(w Widget)
- func ValidateLayout(w Widget, rect graphics.Rect) []string
- func ValidateTheme(w Widget) []string
- func ValidateZIndex(w Widget) []string
- type Animation
- type App
- type AppOptions
- type BaseContainer
- func (c *BaseContainer) AddChild(child Widget)
- func (c *BaseContainer) AppendChild(child Widget)
- func (c *BaseContainer) Children() []Widget
- func (c *BaseContainer) ChildrenI() []interface{}
- func (c *BaseContainer) ClearChildren()
- func (c *BaseContainer) DefaultPanelAt(x, y float32) Widget
- func (c *BaseContainer) DetachChild(child Widget) bool
- func (c *BaseContainer) DispatchMouseDown(x, y float32, button int) bool
- func (c *BaseContainer) DispatchMouseMove(x, y float32)
- func (c *BaseContainer) DispatchMouseUp(x, y float32, button int) bool
- func (c *BaseContainer) DispatchMouseWheel(x, y, dx, dy float32) bool
- func (c *BaseContainer) Dispose()
- func (c *BaseContainer) MoveChildToFront(child Widget)
- func (c *BaseContainer) PaintChildren(canvas *graphics.Canvas)
- func (c *BaseContainer) RemoveChild(idx int) bool
- type BaseWidget
- func (w *BaseWidget) AccessibilityLabel() string
- func (w *BaseWidget) AccessibilityNode() platform.AccessibilityNode
- func (w *BaseWidget) AccessibilityRole() string
- func (w *BaseWidget) ApplyEnabled(enabled bool)
- func (w *BaseWidget) ApplyVisible(visible bool)
- func (w *BaseWidget) ClearNeedsLayout()
- func (w *BaseWidget) ContainsPoint(x, y float32) bool
- func (w *BaseWidget) DebugName() string
- func (w *BaseWidget) Dispose()
- func (w *BaseWidget) DrawTooltip(canvas *graphics.Canvas, rect graphics.Rect)
- func (w *BaseWidget) Enabled() bool
- func (w *BaseWidget) Focusable() bool
- func (w *BaseWidget) Focused() bool
- func (w *BaseWidget) FrameRect() graphics.Rect
- func (w *BaseWidget) FromLocal(x, y float32) (float32, float32)
- func (w *BaseWidget) GetAnchors() *layout.Anchors
- func (w *BaseWidget) GetLayoutProps() *layout.LayoutProps
- func (w *BaseWidget) GlobalFrameRect() graphics.Rect
- func (w *BaseWidget) HasMouseHandlers() bool
- func (w *BaseWidget) Height() float32
- func (w *BaseWidget) HeightExplicit() bool
- func (w *BaseWidget) Hovered() bool
- func (w *BaseWidget) InvalidateAncestors()
- func (w *BaseWidget) LocalRect() graphics.Rect
- func (w *BaseWidget) MarkClean()
- func (w *BaseWidget) MarkForRedraw()
- func (w *BaseWidget) MinimumDimensions() (float32, float32)
- func (w *BaseWidget) Modifiers() platform.Modifiers
- func (w *BaseWidget) NeedsLayout() bool
- func (w *BaseWidget) NeedsRedraw() bool
- func (w *BaseWidget) OnBlur()
- func (w *BaseWidget) OnClick(x, y float32)
- func (w *BaseWidget) OnFocus()
- func (w *BaseWidget) OnMouseDown(x, y float32, button int) bool
- func (w *BaseWidget) OnMouseMove(x, y float32)
- func (w *BaseWidget) OnMouseUp(x, y float32, button int) bool
- func (w *BaseWidget) OnMouseWheel(x, y, dx, dy float32) bool
- func (w *BaseWidget) Paint(canvas *graphics.Canvas, rect graphics.Rect)
- func (w *BaseWidget) PanelAt(x, y float32) Widget
- func (w *BaseWidget) Parent() Widget
- func (w *BaseWidget) PointFromRoot(x, y float32) graphics.Point
- func (w *BaseWidget) PointToRoot(x, y float32) graphics.Point
- func (w *BaseWidget) PreferredDimensions(target interface{}, width, height float32) (float32, float32)
- func (w *BaseWidget) Redraw()
- func (w *BaseWidget) Scale() float32
- func (w *BaseWidget) SetAccessibilityActions(actions ...platform.AccessibilityAction) *BaseWidget
- func (w *BaseWidget) SetAccessibilityChecked(checked int8) *BaseWidget
- func (w *BaseWidget) SetAccessibilityClickable(clickable bool) *BaseWidget
- func (w *BaseWidget) SetAccessibilityExpanded(expanded int8) *BaseWidget
- func (w *BaseWidget) SetAccessibilityHint(hint string) *BaseWidget
- func (w *BaseWidget) SetAccessibilityLabel(label string) *BaseWidget
- func (w *BaseWidget) SetAccessibilityRole(role string) *BaseWidget
- func (w *BaseWidget) SetAccessibilitySelected(selected bool) *BaseWidget
- func (w *BaseWidget) SetAccessibilityValue(value string) *BaseWidget
- func (w *BaseWidget) SetAnchors(anchors *layout.Anchors)
- func (w *BaseWidget) SetBounds(x, y, width, height float32) *BaseWidget
- func (w *BaseWidget) SetDebugName(name string)
- func (w *BaseWidget) SetEnabled(enabled bool) *BaseWidget
- func (w *BaseWidget) SetFocused(focused bool) *BaseWidget
- func (w *BaseWidget) SetFrameRect(rect graphics.Rect)
- func (w *BaseWidget) SetFrameRectDirect(rect graphics.Rect)
- func (w *BaseWidget) SetHeight(height float32) *BaseWidget
- func (w *BaseWidget) SetHeightDirect(height float32)
- func (w *BaseWidget) SetHovered(hovered bool) *BaseWidget
- func (w *BaseWidget) SetHoveredState(hovered bool)
- func (w *BaseWidget) SetLayoutProps(props *layout.LayoutProps)
- func (w *BaseWidget) SetNeedsLayout()
- func (w *BaseWidget) SetOnClick(handler func()) *BaseWidget
- func (w *BaseWidget) SetOnKeyDown(handler func(keyCode platform.KeyCode, modifiers platform.Modifiers)) *BaseWidget
- func (w *BaseWidget) SetOnMouseDown(handler func(x, y float32, button int)) *BaseWidget
- func (w *BaseWidget) SetOnMouseEnter(handler func()) *BaseWidget
- func (w *BaseWidget) SetOnMouseExit(handler func()) *BaseWidget
- func (w *BaseWidget) SetOnMouseMove(handler func(x, y float32)) *BaseWidget
- func (w *BaseWidget) SetOnMouseUp(handler func(x, y float32, button int)) *BaseWidget
- func (w *BaseWidget) SetParent(p Widget)
- func (w *BaseWidget) SetTabIndex(index int)
- func (w *BaseWidget) SetTooltip(text string) *BaseWidget
- func (w *BaseWidget) SetTooltipDelay(d time.Duration) *BaseWidget
- func (w *BaseWidget) SetTreePath(path string)
- func (w *BaseWidget) SetVisible(visible bool) *BaseWidget
- func (w *BaseWidget) SetWidth(width float32) *BaseWidget
- func (w *BaseWidget) SetWidthDirect(width float32)
- func (w *BaseWidget) SetX(x float32) *BaseWidget
- func (w *BaseWidget) SetY(y float32) *BaseWidget
- func (w *BaseWidget) SetZIndex(z float32) *BaseWidget
- func (w *BaseWidget) StartTooltipTimer(mouseX, mouseY float32)
- func (w *BaseWidget) StopTooltipTimer()
- func (w *BaseWidget) TabIndex() int
- func (w *BaseWidget) ToLocal(x, y float32) (float32, float32)
- func (w *BaseWidget) TooltipDelay() time.Duration
- func (w *BaseWidget) TooltipText() string
- func (w *BaseWidget) TreePath() string
- func (w *BaseWidget) Visible() bool
- func (w *BaseWidget) Width() float32
- func (w *BaseWidget) WidthExplicit() bool
- func (w *BaseWidget) Window() *Window
- func (w *BaseWidget) ZIndex() float32
- type CacheBase
- type ClickBehaviour
- type ClickHandler
- type Container
- type ContextMenuHoster
- type CursorProvider
- type DragData
- type DragManager
- type DragOverlayInfo
- type DragSource
- type DropTarget
- type EventHandler
- type EventListener
- type FocusHandler
- type HoverHandler
- type HoverTarget
- type Layer
- type LayerManager
- func (lm *LayerManager) AddLayer(zIndex int, widget Widget) *Layer
- func (lm *LayerManager) AddLayerWithPaint(zIndex int, paint func(canvas *graphics.Canvas, rect graphics.Rect), ...) *Layer
- func (lm *LayerManager) CloseTopLayer() bool
- func (lm *LayerManager) Dispose()
- func (lm *LayerManager) HandleKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool
- func (lm *LayerManager) HandleKeyUp(keyCode platform.KeyCode, mod platform.Modifiers) bool
- func (lm *LayerManager) HandleMouseDown(x, y float32, button int) bool
- func (lm *LayerManager) HandleMouseMove(x, y float32) bool
- func (lm *LayerManager) HandleMouseUp(x, y float32, button int) bool
- func (lm *LayerManager) HandleMouseWheel(x, y float32, dx, dy float32) bool
- func (lm *LayerManager) HandleRune(ch rune) bool
- func (lm *LayerManager) HandleTextEditing(text string, start, length int) bool
- func (lm *LayerManager) HitTest(x, y float32) *Layer
- func (lm *LayerManager) LayerCount() int
- func (lm *LayerManager) MoveToFront(layer *Layer)
- func (lm *LayerManager) Paint(canvas *graphics.Canvas)
- func (lm *LayerManager) RemoveLayer(layer *Layer)
- func (lm *LayerManager) RemoveLayerByWidget(widget Widget)
- func (lm *LayerManager) TopLayer() Widget
- type MenuStripHost
- type ModalBackdrop
- func (mb *ModalBackdrop) ContainsPoint(x, y float32) bool
- func (mb *ModalBackdrop) OnMouseDown(x, y float32, button int) bool
- func (mb *ModalBackdrop) OnMouseMove(x, y float32)
- func (mb *ModalBackdrop) OnMouseUp(x, y float32, button int) bool
- func (mb *ModalBackdrop) Paint(canvas *graphics.Canvas, rect graphics.Rect)
- type ModalPopup
- type MouseArea
- func (m *MouseArea) CursorAt(x, y float32) *platform.Cursor
- func (m *MouseArea) Focusable() bool
- func (m *MouseArea) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool
- func (m *MouseArea) OnMouseDoubleClick(x, y float32, button int) bool
- func (m *MouseArea) OnMouseDown(x, y float32, button int) bool
- func (m *MouseArea) OnMouseMove(x, y float32)
- func (m *MouseArea) OnMouseUp(x, y float32, button int) bool
- func (m *MouseArea) Paint(canvas *graphics.Canvas, rect graphics.Rect)
- func (m *MouseArea) Pressed() bool
- func (m *MouseArea) SetCursor(c *platform.Cursor) *MouseArea
- func (m *MouseArea) SetFillParent() *MouseArea
- func (m *MouseArea) SetFocusable(b bool) *MouseArea
- func (m *MouseArea) SetHoveredState(v bool)
- func (m *MouseArea) SetPushed(v bool)
- func (m *MouseArea) SetStateTarget(w Widget) *MouseArea
- type OSWindow
- type Panel
- func (p *Panel) AddChild(child Widget)
- func (p *Panel) ApplyOpacity(a float32)
- func (p *Panel) BackdropBlur() bool
- func (p *Panel) Clear()
- func (p *Panel) ClearGradient() *Panel
- func (p *Panel) Clickable() bool
- func (p *Panel) CursorAt(x, y float32) *platform.Cursor
- func (p *Panel) Dispose()
- func (p *Panel) EffectiveBackground() (graphics.Color, bool)
- func (p *Panel) FinishAnimations()
- func (p *Panel) Focusable() bool
- func (p *Panel) GetContentHeight() float32
- func (p *Panel) GetContentWidth() float32
- func (p *Panel) HoverAt(x, y float32)
- func (p *Panel) Layout() interface{}
- func (p *Panel) OnBubbledMouseDown(x, y float32, button int) bool
- func (p *Panel) OnBubbledMouseUp(x, y float32, button int) bool
- func (p *Panel) OnKeyDown(keyCode platform.KeyCode, mod platform.Modifiers) bool
- func (p *Panel) OnMouseDown(x, y float32, button int) bool
- func (p *Panel) OnMouseMove(x, y float32)
- func (p *Panel) OnMouseUp(x, y float32, button int) bool
- func (p *Panel) OnMouseWheel(x, y float32, dx, dy float32) bool
- func (p *Panel) Padding() float32
- func (p *Panel) Paint(canvas *graphics.Canvas, rect graphics.Rect)
- func (p *Panel) PanelAt(x, y float32) Widget
- func (p *Panel) PreferredDimensions(target interface{}, w, h float32) (float32, float32)
- func (p *Panel) Pressed() bool
- func (p *Panel) Radius() float32
- func (p *Panel) RemoveChild(child Widget) bool
- func (p *Panel) Selected() bool
- func (p *Panel) SetBackdropBlur(on bool) *Panel
- func (p *Panel) SetBackground(bg interface{}) *Panel
- func (p *Panel) SetBackgroundToken(name string) *Panel
- func (p *Panel) SetBorderColor(color interface{})
- func (p *Panel) SetBorderWidth(width float32)
- func (p *Panel) SetBoundProperty(propName string, value interface{})
- func (p *Panel) SetClickable(b bool) *Panel
- func (p *Panel) SetClipChildren(b bool) *Panel
- func (p *Panel) SetContentHeight(height float32)
- func (p *Panel) SetContentWidth(width float32)
- func (p *Panel) SetCornerRadius(r float32) *Panel
- func (p *Panel) SetCursor(c *platform.Cursor) *Panel
- func (p *Panel) SetEnabled(enabled bool) *Panel
- func (p *Panel) SetFocusable(b bool)
- func (p *Panel) SetFrameRect(rect graphics.Rect)
- func (p *Panel) SetGradient(g graphics.Gradient) *Panel
- func (p *Panel) SetGradientUnit(g graphics.Gradient) *Panel
- func (p *Panel) SetHoverInk(c graphics.Color) *Panel
- func (p *Panel) SetHoveredState(hovered bool)
- func (p *Panel) SetLayout(l interface{}) *Panel
- func (p *Panel) SetOnClick(fn func()) *Panel
- func (p *Panel) SetOnPress(fn func(bool)) *Panel
- func (p *Panel) SetOpacity(a float32) *Panel
- func (p *Panel) SetPadding(padding float32) *Panel
- func (p *Panel) SetPressedInk(c graphics.Color) *Panel
- func (p *Panel) SetPushed(v bool) *Panel
- func (p *Panel) SetSelected(selected bool) *Panel
- func (p *Panel) SetSelectedInk(c graphics.Color) *Panel
- func (p *Panel) SetShadow(spec theme.ShadowSpec) *Panel
- func (p *Panel) SetShadowToken(name string) *Panel
- func (p *Panel) SetSticky(on bool) *Panel
- func (p *Panel) SetStickyInset(px float32) *Panel
- func (p *Panel) Sticky() bool
- func (p *Panel) StickyInset() float32
- func (p *Panel) ValidateLayout()
- func (p *Panel) Window() *OSWindow
- type PerfTimer
- type SVGDocument
- type SVGElement
- type ScrollHandler
- type TabIndexSetter
- type Widget
- type Window
- func (w *Window) AddChild(child Widget)
- func (w *Window) AddLayerFor(from Widget, x, y float32, ...) *Layer
- func (w *Window) AsPanel() *Panel
- func (w *Window) Children() []Widget
- func (w *Window) ClickCount() int
- func (w *Window) ContentOrigin() (float32, float32)
- func (w *Window) CursorAt(x, y float32) *platform.Cursor
- func (w *Window) Device() graphics.Device
- func (w *Window) DismissContextMenu(id string)
- func (w *Window) DismissModal(mp *ModalPopup)
- func (w *Window) DismissPopupContextMenu()
- func (w *Window) DismissTopModal()
- func (w *Window) Dispose()
- func (w *Window) FocusedChild() Widget
- func (w *Window) HandleEvent(ev *platform.Event) bool
- func (w *Window) HeldModifiers() platform.Modifiers
- func (w *Window) KeyDown(k platform.KeyCode) bool
- func (w *Window) Layout() interface{}
- func (w *Window) MarkForRedraw()
- func (w *Window) MarkPainted()
- func (w *Window) Modifiers() platform.Modifiers
- func (w *Window) NeedsPaint() bool
- func (w *Window) Paint(canvas *graphics.Canvas, rect graphics.Rect)
- func (w *Window) PaintLayerOverlay(canvas *graphics.Canvas, translateY float32)
- func (w *Window) PanelAt(x, y float32) Widget
- func (w *Window) RemoveChild(child Widget) bool
- func (w *Window) RenderToImage(wpx, hpx int) (*graphics.Image, error)
- func (w *Window) Scale() float32
- func (w *Window) SetBackground(ink graphics.Ink) *Window
- func (w *Window) SetBoundProperty(propName string, value interface{})
- func (w *Window) SetContentOrigin(x, y float32)
- func (w *Window) SetDisplayScale(scale float32)
- func (w *Window) SetFocusedChild(child Widget)
- func (w *Window) SetFrameRect(rect graphics.Rect)
- func (w *Window) SetLayerPaintExternal()
- func (w *Window) SetLayout(layout interface{})
- func (w *Window) SetOnAction(handler func(action string) bool) *Window
- func (w *Window) SetOnBack(fn func() bool)
- func (w *Window) SetOnKeyDown(handler func(keyCode platform.KeyCode, modifiers platform.Modifiers)) *Window
- func (w *Window) SetOnMouseDown(handler func(x, y float32, button int)) *Window
- func (w *Window) SetOnMouseMove(handler func(x, y float32)) *Window
- func (w *Window) SetOnMouseUp(handler func(x, y float32, button int)) *Window
- func (w *Window) SetOnResize(fn func(width, height float32))
- func (w *Window) SetOpacity(opacity float32) *Window
- func (w *Window) SetPadding(padding float32) *Window
- func (w *Window) SetTouchProfile(on bool)
- func (w *Window) SetWindowSize(width, height float32)
- func (w *Window) ShowContextMenuPositioned(id string, x, y float32)
- func (w *Window) ShowModal(content Widget, pw, ph float32) *ModalPopup
- func (w *Window) ShowNonModal(content Widget, pw, ph float32) *ModalPopup
- func (w *Window) ShowPopupContextMenu(cm Widget, x, y float32)
- func (w *Window) TakeScreenShot(onImg func(i *graphics.Image, err error))
- func (w *Window) TextInputArea() (bool, graphics.Rect)
- func (w *Window) TouchProfile() bool
- func (w *Window) ValidateLayout()
- func (w *Window) Window() *Window
- type WindowOptions
Constants ¶
const ( EventLogPath = "/tmp/meui_events.log" PerfLogPath = "/tmp/meui_perf.log" TreeJSONPath = "/tmp/meui_tree.json" CrashScreenshotPath = "/tmp/meui_crash.jpeg" )
Log files
const DragThreshold float32 = 6
DragThreshold is the minimum distance (in pixels) the mouse must move before a drag operation begins.
Variables ¶
var ( // Debug infrastructure DebugEnabled = os.Getenv("MEUI_DEBUG") == "1" // Master switch EventTraceEnabled = os.Getenv("MEUI_EVENT_TRACE") == "1" // Log all events PerfMetricsEnabled = os.Getenv("MEUI_PERF") == "1" // Log performance metrics TreeJSONEnabled = os.Getenv("MEUI_TREE_JSON") == "1" // Export tree as JSON ScreenshotCrashEnabled = os.Getenv("MEUI_SCREENSHOT_CRASH") == "1" // Screenshot on crash // Safety net infrastructure LayoutValidateEnabled = getEnvDefault("MEUI_LAYOUT_VALIDATE", true) // Validate layout results AnchorCycleDetectEnabled = getEnvDefault("MEUI_ANCHOR_CYCLE_DETECT", true) // Detect anchor cycles LifecycleTrackEnabled = getEnvDefault("MEUI_LIFECYCLE_TRACK", false) // Track widget lifecycle StrictModeEnabled = getEnvDefault("MEUI_STRICT", false) // Nil safety (fail fast) QMLValidateEnabled = getEnvDefault("MEUI_QML_VALIDATE", true) // Enhanced QML validation ThemeCheckEnabled = getEnvDefault("MEUI_THEME_CHECK", false) // Theme compliance ZIndexValidateEnabled = getEnvDefault("MEUI_ZINDEX_VALIDATE", true) // Z-index validation RecursiveLayoutDetectEnabled = getEnvDefault("MEUI_RECURSIVE_LAYOUT_DETECT", true) // Layout depth limits TestCoverageEnabled = getEnvDefault("MEUI_TEST_COVERAGE", false) // Test coverage reporting )
Debug and safety net flags (controlled by environment variables)
Functions ¶
func AccessibilityTree ¶ added in v0.5.7
func AccessibilityTree(root Widget) []platform.AccessibilityNode
AccessibilityTree flattens the widget tree into platform accessibility nodes. It is deliberately backend-neutral: the Android/iOS/desktop bridges decide how to publish the nodes to the OS.
Stable IDs are derived from the traversal path, not pointer values, so a screen-reader action can be routed back to the same node across frames. Bounds are absolute window-local logical coordinates.
func BlendOver ¶
BlendOver composites src OVER dst in straight (non-premultiplied) alpha. A Box uses it to paint its hover and press washes: the theme supplies a translucent ink, and the box keeps its own fill underneath.
func CheckRecursiveLayout ¶
CheckRecursiveLayout detects potential infinite layout loops
func ChildLocal ¶
ChildLocal maps a point in the PARENT's space to the child's local space, when the point is inside the child's hit frame. The hit frame may be expanded to the touch floor; the COORDINATES are always taken against the child's REAL frame.
The distinction is the whole point of the floor. Expanding the frame is meant to widen where a finger may land; it must not move the widget's origin. Using the expanded frame for the subtraction shifted every local coordinate by half the expansion (11px for a 22px control), so a small control's top half reported coordinates from its bottom half — the spin box's up arrow acted as DOWN, and the only way to press it was to click ABOVE the widget.
func ChildLocalAmong ¶
ChildLocalAmong is ChildLocal with the sibling-clamped expansion (see TouchHitFrameAmong).
func ChildLocalAmongFor ¶
func ChildLocalAmongFor(child Widget, x, y float32, siblings []Widget, floorOn bool) (float32, float32, bool)
ChildLocalAmongFor is ChildLocalAmong with an explicit floor setting.
func ChildLocalFor ¶
ChildLocalFor is ChildLocal with an explicit floor setting.
func ClearDragOverlay ¶
func ClearDragOverlay()
ClearDragOverlay clears the global drag ghost overlay.
func ColorLerp ¶
ColorLerp interpolates per channel in straight (non-premultiplied) space; alpha included. t is clamped to [0,1].
func ContainsWidget ¶
ContainsWidget reports whether target is root or sits in root's subtree, using the same Children() the focus traversal uses.
func DefaultIcon ¶ added in v0.1.4
DefaultIcon returns the toolkit's fallback window icon, or nil if it cannot be decoded (an embedded asset, so nil means a broken build rather than a bad file). WindowOptions.Icon overrides it; WindowOptions.NoIcon suppresses it.
func DetectAnchorCycles ¶
DetectAnchorCycles checks for circular anchor dependencies
func DrawFocusRing ¶
DrawFocusRing paints the active platform's focus indicator (theme Effects.Focus) around or inside r. Kind selects the construction:
ring outer accent ring (macOS, Adwaita) — offset grows it out inset accent stroke inside the bounds (Breeze) two-tone contrasting double rect (Fluent) underline accent bar along the bottom edge (Metro-ish text fields)
Call when the widget owns focus; radius matches the widget's corner radius so the indicator follows its shape.
func DrawFocusRingInk ¶
DrawFocusRingInk is DrawFocusRing with an explicit colour for the ring. A field in an error state uses its error ink: the accent ring drawn on top of a red border read as "focused, fine" when the point was "this value is wrong".
func DrawSVG ¶
func DrawSVG(canvas *graphics.Canvas, doc *SVGDocument, x, y, width, height float32)
DrawSVG renders an SVG document onto a canvas at the specified position. The vector is rasterized ONCE at 4x, box-filtered to the target size (a true 16-tap area average — see boxFilter4x) and drawn 1:1 pixel-aligned, matching Skia's analytic stroke coverage closely.
func DrawShadow ¶
DrawShadow paints a soft drop shadow behind r using concentric rounded rects with decaying alpha — no FBO round trip (unlike the blur-pipeline DropShadow), so it batches with the frame's SDF quads and costs one quad ring per step.
Draw BEFORE the widget's own background; the background covers the interior and only the fringe remains.
func Ease ¶
Ease maps normalized time to eased progress. Curves are the concrete forms of the theme's easing intents.
func ExportTreeJSON ¶
ExportTreeJSON exports the widget tree as JSON
func IsInteractive ¶
IsInteractive reports whether a widget is a TAPPABLE TARGET, which is what the hit-slop expansion turns on. It is exported because the touch AUDIT must ask the same question the hit test does: a widget that is interactive but that this does not recognise stays 14px with nothing failing anywhere.
This predicate was WRONG in a way that made the whole floor inert, and the audit is what found it. It used to ask two questions and both were the wrong one:
- HasMouseHandlers reports whether callbacks are INSTALLED, but every real control (Button, CheckBox, Switch, Slider, …) handles input by OVERRIDING OnMouseDown instead, so it answered false for all of them;
- `interface{ SetOnClicked(func()) }` never matched either, because Button's method is fluent — `SetOnClicked(func()) *Button` — and a method that returns something does not satisfy an interface that returns nothing.
So nothing was ever recognised and the expansion expanded nothing. The fix is a NAME-BASED registry of the types that are targets. Reflection cannot answer it: Go generates a distinct wrapper for a promoted method, so comparing method pointers reports "overridden" for every widget that merely embeds BaseWidget — measured on ProgressBar, which declares no input methods at all and whose promoted pointers still differ from BaseWidget's.
Containers are excluded separately (expanding a panel would steal hits from the gaps between its children), and so is Label: it handles input for text selection, but a label is not something a finger aims at, and expanding one beside a checkbox would take the checkbox's own expansion.
func LogEvent ¶
func LogEvent(widgetName, eventType string)
LogEvent logs an event to the event log file
func LogEventf ¶
func LogEventf(widgetName, format string, args ...interface{})
LogEventf logs a formatted event
func MinTouchTarget ¶
func MinTouchTarget() float32
MinTouchTarget is the effective floor in logical px: the theme's metric when the preset sets one (48 on Android, 44 on iOS), else the historical 44. The theme is the right source because the floor is a published per-platform number, and putting it in the preset is what lets one widget set serve both.
func OpenURL ¶
func OpenURL(url string)
OpenURL launches the platform browser for the given URL. Used as the default action for clicked links in Markdown and rich-text labels when the application does not install its own OnLinkClicked handler.
It delegates to the platform seam, so a backend with a real URL opener (the SDL3 adapter, which also covers Android and iOS) is used where there is one; otherwise the seam's fallback shells out. The error is dropped because this is a fire-and-forget default action — an app that cares installs its own handler.
func PrintTree ¶
PrintTree prints the widget tree starting from this widget. indent is the indentation level (number of spaces / 2).
func PrintTreeToFile ¶
PrintTreeToFile prints the widget tree to a file.
func RegisterInteractiveType ¶
func RegisterInteractiveType(name string)
RegisterInteractiveType adds a widget type to the interactive registry. An APP-defined widget that handles input needs this: the registry is keyed by type name, and without an entry the touch-target floor would silently not apply to it on a phone — a widget that works with a mouse and is frustrating with a thumb.
func RegisterNamedWidget ¶
func ReportTestCoverage ¶
func ReportTestCoverage()
ReportTestCoverage reports untested widget/layout paths
func ScaleGradient ¶
ScaleGradient resolves a unit gradient (Start/End/Center in 0..1 of the shape) against a concrete rect. The gradient types express geometry in the shape's own pixels, which a scene author does not know until layout runs.
func SetAnimationFrameRequester ¶ added in v0.5.9
func SetAnimationFrameRequester(fn func())
SetAnimationFrameRequester installs the callback used to request one more frame while an animation is running. Passing nil disables the request.
func SetDefaultChrome ¶
SetDefaultChrome registers the title bar AddWindow installs on each window. Passing nil disables the default. Called by the widgets package.
func SetDragOverlay ¶
SetDragOverlay sets the global drag ghost overlay (position is in Window coordinates).
func SetTouchProfile ¶
func SetTouchProfile(on bool)
SetTouchProfile enables/disables the DEFAULT touch floor. A window carries its own setting (see Window.SetTouchProfile) and App.AddWindow derives one from the window's form factor, so this is the fallback for a window that has none — the headless tests, and a host with one logical surface. It stays exported for tests and for a host that knows better than the size classes.
func SetTreePaths ¶
func SetTreePaths(root Widget)
SetTreePaths walks the widget tree starting from root and sets tree paths. The path format is "i,j,k" where i,j,k are indices in parent's children. Root's children have paths "0", "1", etc.
func ShadowToken ¶
func ShadowToken(name string) (theme.ShadowSpec, bool)
ShadowToken resolves a named shadow from the active theme. It exists so a scene can say `shadow: "card"` and stay theme-driven: the preset decides what a card's elevation is, and a dark preset can make it deeper without touching the QML.
func TouchHitFrame ¶
TouchHitFrame expands frame f, when needed, so that interactive widgets present at least MinTouchTarget square hit area centered on the widget. Non-interactive widgets (no mouse handlers, no click handler) and containers pass through unchanged — expanding panels would steal hits from sibling gaps.
func TouchHitFrameAmong ¶
TouchHitFrameAmong expands a child's hit frame to the floor and then CLAMPS the expansion against its siblings, so two close targets cannot both claim the same pixel.
This is Android's own caveat, stated in its touch-target guidance: very small and close-together targets cannot all be expanded, and the honest answer is to split the gap between them rather than let one swallow the other. Without it the hit test walks children in reverse and the LAST one wins the overlap, so a checkbox beside another checkbox becomes partly unreachable — which is worse than not expanding at all, because it fails only near the edge and looks like a stray mis-tap.
func TouchHitFrameAmongWith ¶
func TouchHitFrameAmongWith(child Widget, f graphics.Rect, siblings []Widget, floorOn bool) graphics.Rect
TouchHitFrameAmongWith is TouchHitFrameAmong for a specific floor setting.
func TouchHitFrameWith ¶
TouchHitFrameWith is TouchHitFrame for a specific floor setting (a window's, or a test's).
func TouchProfile ¶
func TouchProfile() bool
TouchProfileForSize reports whether a surface of this size wants the touch floor, using the same size classes the window uses. It exists so a host or a test can ask the question without a window. TouchProfile reports whether the floor is active, which the touch audit asserts: the floor hung off a switch nothing flipped for its whole life, so "is it on" is a question worth being able to ask.
func TouchProfileForSize ¶
func TrackWidgetCreation ¶
func TrackWidgetCreation(w Widget)
TrackWidgetCreation records widget creation with stack trace
func TrackWidgetDisposal ¶
func TrackWidgetDisposal(w Widget)
TrackWidgetDisposal records widget disposal
func ValidateLayout ¶
ValidateLayout checks for layout issues (overlapping, zero-sized, negative coords)
func ValidateTheme ¶
ValidateTheme checks if widget has required theme settings
func ValidateZIndex ¶
ValidateZIndex checks for invalid z-index values
Types ¶
type Animation ¶
type Animation struct {
// contains filtered or unexported fields
}
Animation interpolates a float32 toward a target using the theme's motion tokens (duration + easing intent). Evaluation is lazy at Paint time — the render loop is continuous, so a running animation simply re-renders each frame until it settles; no timers or tick plumbing.
Zero value is usable: Value() returns 0 until the first Set.
func (*Animation) Set ¶
Set starts a transition toward target using timing. Idempotent: retargeting to the in-flight target is a no-op; retargeting mid-flight continues from the CURRENT value (no jump).
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the toolkit-facing application facade: it opens windows, installs a widget tree as their content, and runs the backend event loop. It speaks only platform.App, so the backend (SDL3 today) is chosen at the composition root and never named here.
func NewApp ¶
func NewApp(backend platform.App, opts AppOptions) *App
NewApp wires the facade to a platform backend.
app := meui.NewApp(sdl3.NewApp(), meui.AppOptions{})
app.AddWindow(root, meui.WindowOptions{Title: "TradeUI"})
app.Run()
func (*App) AddWindow ¶
AddWindow opens an OS window, installs root as its content and event sink, lays it out against the real window size, and shows it.
func (*App) Backend ¶
Backend returns the platform backend, for OS services such as the clipboard and dialogs.
func (*App) PostTask ¶
func (a *App) PostTask(fn func())
PostTask queues fn on the UI thread (see platform.TaskQueue for the contract).
type AppOptions ¶
type AppOptions struct {
// Title is used for the first window when a window supplies none.
Title string
// Size is the default window size when a window supplies none.
Size graphics.Size
}
AppOptions configures the application facade.
type BaseContainer ¶
type BaseContainer struct {
BaseWidget
// contains filtered or unexported fields
}
BaseContainer is a struct for widgets that have children. Embeds BaseWidget and adds child management + event dispatch helpers. Widgets that need children should embed this instead of BaseWidget.
func (*BaseContainer) AddChild ¶
func (c *BaseContainer) AddChild(child Widget)
AddChild appends a child and sets its parent. Triggers layout + redraw.
func (*BaseContainer) AppendChild ¶
func (c *BaseContainer) AppendChild(child Widget)
AppendChild appends a child without setting its parent. The caller must call child.SetParent(outerWidget) themselves. Used by containers in other packages that need to set the parent to the outer widget, not the embedded BaseContainer.
func (*BaseContainer) Children ¶
func (c *BaseContainer) Children() []Widget
Children returns the child list.
func (*BaseContainer) ChildrenI ¶
func (c *BaseContainer) ChildrenI() []interface{}
ChildrenI returns children as []interface{} for layout compatibility.
func (*BaseContainer) ClearChildren ¶
func (c *BaseContainer) ClearChildren()
ClearChildren disposes and removes all children.
func (*BaseContainer) DefaultPanelAt ¶
func (c *BaseContainer) DefaultPanelAt(x, y float32) Widget
DefaultPanelAt returns the deepest child containing (x,y) in local coords. Returns nil if no child matches — the caller decides what to return as fallback.
func (*BaseContainer) DetachChild ¶
func (c *BaseContainer) DetachChild(child Widget) bool
DetachChild removes a child without calling Dispose. Useful for reparenting.
func (*BaseContainer) DispatchMouseDown ¶
func (c *BaseContainer) DispatchMouseDown(x, y float32, button int) bool
DispatchMouseDown iterates children and dispatches OnMouseDown to the first hit. Returns true if any child handled the event.
func (*BaseContainer) DispatchMouseMove ¶
func (c *BaseContainer) DispatchMouseMove(x, y float32)
DispatchMouseMove iterates children and dispatches OnMouseMove to all hits.
func (*BaseContainer) DispatchMouseUp ¶
func (c *BaseContainer) DispatchMouseUp(x, y float32, button int) bool
DispatchMouseUp iterates children and dispatches OnMouseUp to the first hit.
func (*BaseContainer) DispatchMouseWheel ¶
func (c *BaseContainer) DispatchMouseWheel(x, y, dx, dy float32) bool
DispatchMouseWheel iterates children and dispatches OnMouseWheel to the first hit.
func (*BaseContainer) Dispose ¶
func (c *BaseContainer) Dispose()
Dispose cleans up children and resources.
func (*BaseContainer) MoveChildToFront ¶
func (c *BaseContainer) MoveChildToFront(child Widget)
MoveChildToFront removes the child and re-adds it at the end, making it the topmost in z-order.
func (*BaseContainer) PaintChildren ¶
func (c *BaseContainer) PaintChildren(canvas *graphics.Canvas)
PaintChildren iterates children and paints each one. Call this from your widget's Paint() after drawing your own content.
func (*BaseContainer) RemoveChild ¶
func (c *BaseContainer) RemoveChild(idx int) bool
RemoveChild removes a child by index. Returns false if out of range.
type BaseWidget ¶
type BaseWidget struct {
// contains filtered or unexported fields
}
func NewBaseWidget ¶
func NewBaseWidget() *BaseWidget
func (*BaseWidget) AccessibilityLabel ¶ added in v0.5.7
func (w *BaseWidget) AccessibilityLabel() string
AccessibilityLabel returns the configured screen-reader label.
func (*BaseWidget) AccessibilityNode ¶ added in v0.5.7
func (w *BaseWidget) AccessibilityNode() platform.AccessibilityNode
AccessibilityNode implements the optional provider consumed by AccessibilityTree. Bounds and absolute coordinates are filled by the tree walker, which owns coordinate conversion.
func (*BaseWidget) AccessibilityRole ¶ added in v0.5.7
func (w *BaseWidget) AccessibilityRole() string
AccessibilityRole returns the configured semantics role.
func (*BaseWidget) ApplyEnabled ¶
func (w *BaseWidget) ApplyEnabled(enabled bool)
ApplyEnabled is the non-fluent form used by reflective property appliers: interface{ SetEnabled(bool) } fails to match widgets whose SetEnabled returns *BaseWidget (the fluent pattern), silently no-opping `enabled: false` for most widgets.
func (*BaseWidget) ApplyVisible ¶
func (w *BaseWidget) ApplyVisible(visible bool)
ApplyVisible is the non-fluent form for reflective appliers (see ApplyEnabled).
func (*BaseWidget) ClearNeedsLayout ¶
func (w *BaseWidget) ClearNeedsLayout()
func (*BaseWidget) ContainsPoint ¶
func (w *BaseWidget) ContainsPoint(x, y float32) bool
func (*BaseWidget) DebugName ¶
func (w *BaseWidget) DebugName() string
DebugName returns the debug name of this widget.
func (*BaseWidget) Dispose ¶
func (w *BaseWidget) Dispose()
Dispose cleans up resources held by this widget. Nil out event handlers and parent reference to allow GC.
func (*BaseWidget) DrawTooltip ¶
func (w *BaseWidget) DrawTooltip(canvas *graphics.Canvas, rect graphics.Rect)
DrawTooltip renders the tooltip on the canvas if visible. Call from widget's Paint().
func (*BaseWidget) Enabled ¶
func (w *BaseWidget) Enabled() bool
func (*BaseWidget) Focusable ¶
func (w *BaseWidget) Focusable() bool
WidthIsExplicit/HeightIsExplicit report that QML set width/height directly — layouts must not let measured preferences override them (a fixed-width wrapping label would otherwise grow to its unwrapped text width and never wrap).
func (*BaseWidget) Focused ¶
func (w *BaseWidget) Focused() bool
func (*BaseWidget) FrameRect ¶
func (w *BaseWidget) FrameRect() graphics.Rect
── Coordinate spaces (the system-wide contract) ─────────────────────
FRAME space — parent-relative. FrameRect()/SetFrameRect() store a widget's position in its PARENT's local space plus its size. Only a parent may interpret the origin: PaintChildren translates the canvas by the child's frame origin, containers hit-test children by their frames, and layout managers write frames in the parent's space. LOCAL space — widget-relative, origin (0,0) at the widget's own top-left. Everything a widget does about itself lives here: Paint(canvas, rect) receives rect = LocalRect(), and mouse events arrive as OnMouseDown(x, y) in local coordinates.
A widget reading its OWN FrameRect() for X/Y inside Paint, hit-testing or event handling is mixing the two spaces (the historic scrollbar double-offset: bars laid out at FrameRect() were shifted by the widget's position inside its parent). Use LocalRect() instead; the API takes sizes wherever only the extent matters so the space cannot be passed wrongly (see ScrollbarHost.LayoutBars).
FrameRect returns the widget's frame in the PARENT's local space plus its size. Use LocalRect() for the widget's own (0,0)-based rect.
func (*BaseWidget) FromLocal ¶
func (w *BaseWidget) FromLocal(x, y float32) (float32, float32)
FromLocal converts widget-local coordinates to window coordinates.
func (*BaseWidget) GetAnchors ¶
func (w *BaseWidget) GetAnchors() *layout.Anchors
GetAnchors returns the anchor properties for this widget
func (*BaseWidget) GetLayoutProps ¶
func (w *BaseWidget) GetLayoutProps() *layout.LayoutProps
GetLayoutProps returns the layout properties for this widget
func (*BaseWidget) GlobalFrameRect ¶
func (w *BaseWidget) GlobalFrameRect() graphics.Rect
GlobalFrameRect is deprecated and returns FrameRect(). FrameRect() returns coordinates in parent-local space, not absolute.
func (*BaseWidget) HasMouseHandlers ¶
func (w *BaseWidget) HasMouseHandlers() bool
HasMouseHandlers reports whether mouse-down/up callbacks are installed on this widget (touch hit-slop uses this to identify interactive targets).
func (*BaseWidget) Height ¶
func (w *BaseWidget) Height() float32
func (*BaseWidget) HeightExplicit ¶
func (w *BaseWidget) HeightExplicit() bool
HeightExplicit reports whether the height came from an explicit size.
func (*BaseWidget) Hovered ¶
func (w *BaseWidget) Hovered() bool
func (*BaseWidget) InvalidateAncestors ¶
func (w *BaseWidget) InvalidateAncestors()
InvalidateAncestors marks this widget's PARENTS as needing layout.
IT EXISTS because a widget's frame is set by its parent's layout, not by itself, so a widget that changes its own size and only marks ITSELF leaves the old frame exactly where it was — which reads as the widget failing to resize, and no amount of SetNeedsLayout on the widget itself will move it.
Collapsible is the first widget in the tree that changes its own height (a collapsed row is its header, an open one is header plus body), which is what made the gap visible: the toggle worked and nothing moved.
func (*BaseWidget) LocalRect ¶
func (w *BaseWidget) LocalRect() graphics.Rect
LocalRect returns the widget's own rect in LOCAL space: origin (0,0), size equal to FrameRect().Size(). This is the rect Paint receives and the space all widget-local geometry (hit tests, bar layout, clip rects) must use.
func (*BaseWidget) MarkClean ¶
func (w *BaseWidget) MarkClean()
func (*BaseWidget) MarkForRedraw ¶
func (w *BaseWidget) MarkForRedraw()
func (*BaseWidget) MinimumDimensions ¶
func (w *BaseWidget) MinimumDimensions() (float32, float32)
func (*BaseWidget) Modifiers ¶
func (w *BaseWidget) Modifiers() platform.Modifiers
func (*BaseWidget) NeedsLayout ¶
func (w *BaseWidget) NeedsLayout() bool
func (*BaseWidget) NeedsRedraw ¶
func (w *BaseWidget) NeedsRedraw() bool
func (*BaseWidget) OnBlur ¶
func (w *BaseWidget) OnBlur()
func (*BaseWidget) OnClick ¶
func (w *BaseWidget) OnClick(x, y float32)
func (*BaseWidget) OnFocus ¶
func (w *BaseWidget) OnFocus()
func (*BaseWidget) OnMouseDown ¶
func (w *BaseWidget) OnMouseDown(x, y float32, button int) bool
func (*BaseWidget) OnMouseMove ¶
func (w *BaseWidget) OnMouseMove(x, y float32)
func (*BaseWidget) OnMouseWheel ¶
func (w *BaseWidget) OnMouseWheel(x, y, dx, dy float32) bool
func (*BaseWidget) PanelAt ¶
func (w *BaseWidget) PanelAt(x, y float32) Widget
PanelAt returns the deepest child widget containing the point (in local coordinates). This is a default implementation for widgets that don't have children. Override this in container widgets (Window, Panel).
func (*BaseWidget) Parent ¶
func (w *BaseWidget) Parent() Widget
Parent returns the parent widget, if any.
func (*BaseWidget) PointFromRoot ¶
func (w *BaseWidget) PointFromRoot(x, y float32) graphics.Point
PointFromRoot converts root coordinates to local coordinates. Walks the parent chain, subtracting each ancestor's FrameRect offset and re-adding any scroll offset that PointToRoot subtracted.
func (*BaseWidget) PointToRoot ¶
func (w *BaseWidget) PointToRoot(x, y float32) graphics.Point
PointToRoot converts local coordinates to root (window) coordinates. Walks the parent chain, adding each ancestor's FrameRect offset. PointToRoot converts local coordinates to root (window) coordinates. If any ancestor implements scrollAdjuster, its scroll offset is subtracted so coordinates account for ScrollPane scrolling (which translates the canvas during paint without changing widget FrameRects).
func (*BaseWidget) PreferredDimensions ¶
func (w *BaseWidget) PreferredDimensions(target interface{}, width, height float32) (float32, float32)
func (*BaseWidget) Redraw ¶
func (w *BaseWidget) Redraw()
Redraw forces an immediate redraw of this widget and all ancestors. This is called by the frame loop when NeedsRedraw() returns true.
func (*BaseWidget) Scale ¶
func (w *BaseWidget) Scale() float32
Scale returns the scale for this widget. Default is 1.0.
func (*BaseWidget) SetAccessibilityActions ¶ added in v0.5.7
func (w *BaseWidget) SetAccessibilityActions(actions ...platform.AccessibilityAction) *BaseWidget
SetAccessibilityActions replaces the supported action list.
func (*BaseWidget) SetAccessibilityChecked ¶ added in v0.5.7
func (w *BaseWidget) SetAccessibilityChecked(checked int8) *BaseWidget
SetAccessibilityChecked sets the tri-state checked value: -1 unchecked, 0 mixed/unknown, 1 checked.
func (*BaseWidget) SetAccessibilityClickable ¶ added in v0.5.7
func (w *BaseWidget) SetAccessibilityClickable(clickable bool) *BaseWidget
SetAccessibilityClickable marks the node as activatable.
func (*BaseWidget) SetAccessibilityExpanded ¶ added in v0.5.7
func (w *BaseWidget) SetAccessibilityExpanded(expanded int8) *BaseWidget
SetAccessibilityExpanded sets the expanded state: -1 collapsed, 0 unknown, 1 expanded.
func (*BaseWidget) SetAccessibilityHint ¶ added in v0.5.7
func (w *BaseWidget) SetAccessibilityHint(hint string) *BaseWidget
SetAccessibilityHint sets the action hint ("Opens settings").
func (*BaseWidget) SetAccessibilityLabel ¶ added in v0.5.7
func (w *BaseWidget) SetAccessibilityLabel(label string) *BaseWidget
SetAccessibilityLabel sets the name announced by a screen reader. It is separate from visible text so an icon-only button can still have a name.
func (*BaseWidget) SetAccessibilityRole ¶ added in v0.5.7
func (w *BaseWidget) SetAccessibilityRole(role string) *BaseWidget
SetAccessibilityRole sets the semantics role (button, heading, textbox, tab, static, …). An empty role with a label is treated as static text.
func (*BaseWidget) SetAccessibilitySelected ¶ added in v0.5.7
func (w *BaseWidget) SetAccessibilitySelected(selected bool) *BaseWidget
SetAccessibilitySelected marks a tab/list item as selected.
func (*BaseWidget) SetAccessibilityValue ¶ added in v0.5.7
func (w *BaseWidget) SetAccessibilityValue(value string) *BaseWidget
SetAccessibilityValue sets the current value/state text (a slider value, a selected item, a text field's contents).
func (*BaseWidget) SetAnchors ¶
func (w *BaseWidget) SetAnchors(anchors *layout.Anchors)
SetAnchors sets the anchor properties for this widget
func (*BaseWidget) SetBounds ¶
func (w *BaseWidget) SetBounds(x, y, width, height float32) *BaseWidget
func (*BaseWidget) SetDebugName ¶
func (w *BaseWidget) SetDebugName(name string)
SetDebugName sets a human-readable name for this widget (used in debug output).
func (*BaseWidget) SetEnabled ¶
func (w *BaseWidget) SetEnabled(enabled bool) *BaseWidget
func (*BaseWidget) SetFocused ¶
func (w *BaseWidget) SetFocused(focused bool) *BaseWidget
func (*BaseWidget) SetFrameRect ¶
func (w *BaseWidget) SetFrameRect(rect graphics.Rect)
func (*BaseWidget) SetFrameRectDirect ¶
func (w *BaseWidget) SetFrameRectDirect(rect graphics.Rect)
SetFrameRectDirect sets the frame rect without triggering a redraw. Used during layout/resizing to avoid infinite redraw loops. Like SetFrameRect, a SIZE change marks the widget for re-layout.
func (*BaseWidget) SetHeight ¶
func (w *BaseWidget) SetHeight(height float32) *BaseWidget
func (*BaseWidget) SetHeightDirect ¶
func (w *BaseWidget) SetHeightDirect(height float32)
func (*BaseWidget) SetHovered ¶
func (w *BaseWidget) SetHovered(hovered bool) *BaseWidget
func (*BaseWidget) SetHoveredState ¶
func (w *BaseWidget) SetHoveredState(hovered bool)
func (*BaseWidget) SetLayoutProps ¶
func (w *BaseWidget) SetLayoutProps(props *layout.LayoutProps)
SetLayoutProps sets the layout properties for this widget
func (*BaseWidget) SetNeedsLayout ¶
func (w *BaseWidget) SetNeedsLayout()
func (*BaseWidget) SetOnClick ¶
func (w *BaseWidget) SetOnClick(handler func()) *BaseWidget
func (*BaseWidget) SetOnKeyDown ¶
func (w *BaseWidget) SetOnKeyDown(handler func(keyCode platform.KeyCode, modifiers platform.Modifiers)) *BaseWidget
func (*BaseWidget) SetOnMouseDown ¶
func (w *BaseWidget) SetOnMouseDown(handler func(x, y float32, button int)) *BaseWidget
func (*BaseWidget) SetOnMouseEnter ¶
func (w *BaseWidget) SetOnMouseEnter(handler func()) *BaseWidget
func (*BaseWidget) SetOnMouseExit ¶
func (w *BaseWidget) SetOnMouseExit(handler func()) *BaseWidget
func (*BaseWidget) SetOnMouseMove ¶
func (w *BaseWidget) SetOnMouseMove(handler func(x, y float32)) *BaseWidget
func (*BaseWidget) SetOnMouseUp ¶
func (w *BaseWidget) SetOnMouseUp(handler func(x, y float32, button int)) *BaseWidget
func (*BaseWidget) SetParent ¶
func (w *BaseWidget) SetParent(p Widget)
SetParent sets the parent widget.
func (*BaseWidget) SetTabIndex ¶
func (w *BaseWidget) SetTabIndex(index int)
func (*BaseWidget) SetTooltip ¶
func (w *BaseWidget) SetTooltip(text string) *BaseWidget
SetTooltip sets the tooltip text for this widget. Default delay is 2 seconds.
func (*BaseWidget) SetTooltipDelay ¶
func (w *BaseWidget) SetTooltipDelay(d time.Duration) *BaseWidget
SetTooltipDelay sets a custom delay for the tooltip.
func (*BaseWidget) SetTreePath ¶
func (w *BaseWidget) SetTreePath(path string)
SetTreePath sets the tree path string (e.g., "1,2,4,5").
func (*BaseWidget) SetVisible ¶
func (w *BaseWidget) SetVisible(visible bool) *BaseWidget
func (*BaseWidget) SetWidth ¶
func (w *BaseWidget) SetWidth(width float32) *BaseWidget
func (*BaseWidget) SetWidthDirect ¶
func (w *BaseWidget) SetWidthDirect(width float32)
func (*BaseWidget) SetX ¶
func (w *BaseWidget) SetX(x float32) *BaseWidget
func (*BaseWidget) SetY ¶
func (w *BaseWidget) SetY(y float32) *BaseWidget
func (*BaseWidget) SetZIndex ¶
func (w *BaseWidget) SetZIndex(z float32) *BaseWidget
SetZIndex orders the widget among its siblings: higher paints later and is hit first. Equal z keeps insertion order.
func (*BaseWidget) StartTooltipTimer ¶
func (w *BaseWidget) StartTooltipTimer(mouseX, mouseY float32)
StartTooltipTimer starts the tooltip show timer (called on mouse enter).
func (*BaseWidget) StopTooltipTimer ¶
func (w *BaseWidget) StopTooltipTimer()
StopTooltipTimer cancels the tooltip timer and hides the tooltip (called on mouse exit).
func (*BaseWidget) TabIndex ¶
func (w *BaseWidget) TabIndex() int
func (*BaseWidget) ToLocal ¶
func (w *BaseWidget) ToLocal(x, y float32) (float32, float32)
ToLocal converts window coordinates to widget-local coordinates.
func (*BaseWidget) TooltipDelay ¶
func (w *BaseWidget) TooltipDelay() time.Duration
TooltipDelay returns the delay before showing the tooltip.
func (*BaseWidget) TooltipText ¶
func (w *BaseWidget) TooltipText() string
TooltipText returns the tooltip text for this widget.
func (*BaseWidget) TreePath ¶
func (w *BaseWidget) TreePath() string
TreePath returns the tree path string.
func (*BaseWidget) Visible ¶
func (w *BaseWidget) Visible() bool
func (*BaseWidget) Width ¶
func (w *BaseWidget) Width() float32
func (*BaseWidget) WidthExplicit ¶
func (w *BaseWidget) WidthExplicit() bool
WidthExplicit reports whether the width came from an explicit author-chosen size (QML `width`) rather than a constructor default or layout pass.
func (*BaseWidget) Window ¶
func (w *BaseWidget) Window() *Window
Window walks up the parent chain to find the root Window. Returns nil if not found.
func (*BaseWidget) ZIndex ¶
func (w *BaseWidget) ZIndex() float32
ZIndex reports the sibling order (0 by default).
type CacheBase ¶
type CacheBase struct {
// contains filtered or unexported fields
}
CacheBase provides offscreen-image caching for expensive-to-render widgets. Embed in any widget, call GetCached in Paint, and Invalidate when content changes.
func (*CacheBase) GetCached ¶
func (c *CacheBase) GetCached(canvas *graphics.Canvas, rect graphics.Rect, draw func(*graphics.Canvas, graphics.Rect))
GetCached returns the cached image if valid and the same size, otherwise renders into a new offscreen image via draw, caches it, and draws it. MEUI_NO_CACHEBASE=1 bypasses the offscreen cache (draws directly) — diagnostic for resize-flash forensics (offscreen re-render + glReadPixels + re-upload every size-change frame stalls the pipe).
func (*CacheBase) Invalidate ¶
func (c *CacheBase) Invalidate()
Invalidate marks the cached image as stale, forcing a re-render on the next GetCached call.
type ClickBehaviour ¶
type ClickBehaviour struct {
OnClick func()
OnPress func(pressed bool)
// contains filtered or unexported fields
}
ClickBehaviour is the press/click state machine behind every plain clickable surface: a Panel with `clickable: true` (QML's Rectangle) and a MouseArea both run it, so a click cannot mean two different things depending on which element carried it. The widgets that have their own semantics (Button's toggle, a tab's selection) keep their own handlers — this exists for the surface that has none.
func (*ClickBehaviour) Activate ¶
func (c *ClickBehaviour) Activate(enabled bool) bool
Activate is the keyboard path for Enter/Space: a press and a release in one step, because a keyboard "click" has no visible down/up on a plain box (a Button animates its own press instead).
func (*ClickBehaviour) Down ¶
func (c *ClickBehaviour) Down(enabled, inside bool, button int) bool
Down arms the click. It reports whether anything changed, so the caller knows to repaint. Only the primary button activates a surface.
func (*ClickBehaviour) Pressed ¶
func (c *ClickBehaviour) Pressed() bool
Pressed reports whether the pointer is down on this surface.
func (*ClickBehaviour) Up ¶
func (c *ClickBehaviour) Up(enabled, inside bool, button int) bool
Up ends the press, firing OnClick when the pointer is still inside the surface. It reports whether the visual state changed: a release outside still has to clear the pressed feedback even though no click fires.
type ClickHandler ¶
type ClickHandler interface {
OnClick(x, y float32)
}
type Container ¶
type Container interface {
Widget
Children() []Widget
PanelAt(x, y float32) Widget
ValidateLayout()
}
Container is an interface for widgets that can contain children.
type ContextMenuHoster ¶
type ContextMenuHoster interface {
SetOnDismiss(func())
OnExternalDismiss()
}
ContextMenuHoster is an interface for widgets that can host a context menu. Window checks for this when showing a context menu popup.
type CursorProvider ¶
CursorProvider is an optional interface for widgets that want to specify a custom mouse cursor when the pointer is over them.
type DragData ¶
type DragData struct {
Type string // identifies what's being dragged (e.g. "listview-item", "tab")
Source Widget // the widget that initiated the drag
Data interface{} // arbitrary payload
Index int // source index within the source widget
}
DragData carries the payload of a drag operation.
type DragManager ¶
type DragManager struct {
// Active is true while a drag is in progress.
Active bool
// Data holds the current drag payload.
Data *DragData
// Source is the widget that initiated the drag.
Source Widget
// Target is the current drop target under the cursor.
Target DropTarget
// GhostLayer is an optional layer that renders a drag ghost.
GhostLayer *Layer
// contains filtered or unexported fields
}
DragManager tracks the current drag operation. There is one DragManager per Window.
func NewDragManager ¶
func NewDragManager(w *Window) *DragManager
NewDragManager creates a new DragManager for the given Window.
func (*DragManager) Cancel ¶
func (dm *DragManager) Cancel()
Cancel ends the drag without performing a drop.
func (*DragManager) End ¶
func (dm *DragManager) End(x, y float32)
End is called on mouse up to finalize the drop.
func (*DragManager) RecordStart ¶
func (dm *DragManager) RecordStart(x, y float32)
RecordStart records the initial mouse press position for later threshold check.
func (*DragManager) StartCheck ¶
func (dm *DragManager) StartCheck(source Widget, x, y float32) bool
StartCheck checks whether the mouse has moved far enough from the start position to initiate a drag. If so, it calls OnDragStart on the source. Returns true if a drag was started.
func (*DragManager) Update ¶
func (dm *DragManager) Update(x, y float32, localX, localY float32)
Update is called during mouse drag to update ghost position and hit-test for drop targets.
type DragOverlayInfo ¶
DragOverlayInfo holds ghost image data for drag preview. Drawn by Window at the very end of Paint, on top of everything.
var GlobalOverlay *DragOverlayInfo
GlobalOverlay is the current drag ghost overlay, drawn on top of everything.
type DragSource ¶
type DragSource interface {
// OnDragStart is called when a drag begins. Return non-nil to start the drag.
OnDragStart(x, y float32) *DragData
}
DragSource is implemented by widgets that can initiate drags.
type DropTarget ¶
type DropTarget interface {
// OnDragEnter is called when the drag enters the widget's bounds.
OnDragEnter(data *DragData, x, y float32)
// OnDragOver is called as the cursor moves over the widget during a drag.
OnDragOver(data *DragData, x, y float32)
// OnDragDrop is called when the drag is released over the widget.
OnDragDrop(data *DragData, x, y float32)
// OnDragLeave is called when the drag leaves the widget's bounds.
OnDragLeave(data *DragData)
}
DropTarget is implemented by widgets that can accept drops.
type EventHandler ¶
type EventListener ¶
type FocusHandler ¶
type FocusHandler interface {
OnFocus()
OnBlur()
}
type HoverHandler ¶
type HoverHandler interface {
SetHoveredState(bool)
}
type HoverTarget ¶
type HoverTarget interface {
HoverAt(x, y float32)
}
HoverTarget is for a widget that owns a pointer position inside its own area without being the deepest hit there — a SplitView's handle sits above its panels, but everywhere else the panels' children are the hit. The window calls HoverAt on every widget along the hit chain (the deepest hit, then its parents) with **widget-local** coordinates on each pointer move, so such a widget learns both when the pointer arrives and when it leaves.
type Layer ¶
type Layer struct {
X float32
Y float32
Width float32
Height float32
ZIndex int
Visible bool
Widget Widget
Paint func(canvas *graphics.Canvas, rect graphics.Rect)
// Owner is the widget that opened a PAINT-ONLY layer (a combo box's dropdown, a
// menu drawn by a callback). Such a layer has no Widget to route input to, but it
// still has to be TOLD when it is closed — otherwise a dropdown removed by Escape
// leaves its owner believing the list is still open. It is never a hit target.
Owner Widget
}
func (*Layer) ContainsPoint ¶
func (*Layer) SetFrameRect ¶
type LayerManager ¶
type LayerManager struct {
Layers []*Layer
// contains filtered or unexported fields
}
func NewLayerManager ¶
func NewLayerManager() *LayerManager
func (*LayerManager) AddLayerWithPaint ¶
func (*LayerManager) CloseTopLayer ¶
func (lm *LayerManager) CloseTopLayer() bool
CloseTopLayer closes the topmost VISIBLE layer and reports whether it closed one.
It is what Escape does when no drag is in progress, and it exists because a layer with no focusable child could otherwise not be dismissed by keyboard at all: the window's key handling walked the FOCUSED widget and the children, so a popup whose contents were all non-focusable had no path to the key. A layer is also the toolkit's own drag ghost, so this is what removes a drag's ghost if the drag is ended some other way.
The widget is told through OnClosed so a popup can release whatever it owns — a combobox that opened a list, a menu that grabbed the pointer — and so can a PAINT-ONLY layer's Owner, which has no widget to route to but still has to know its dropdown is gone.
The layer is removed FIRST, then the owner is told: a widget's OnClosed usually removes the layer itself, and notifying before the splice let that call shift the slice out from under the loop.
func (*LayerManager) Dispose ¶
func (lm *LayerManager) Dispose()
func (*LayerManager) HandleKeyDown ¶
HandleKeyDown dispatches key events to the topmost layer widget.
func (*LayerManager) HandleKeyUp ¶
HandleKeyUp dispatches a key release to the topmost layer widget.
It exists because the window now DELIVERS key-ups: a popup that acted on a key press needs to know the key was let go, and the layer is where a popup lives. The window dropping key-ups — which it did, with a note saying "no key-up behavior yet" — meant a layer could never observe a release.
func (*LayerManager) HandleMouseDown ¶
func (lm *LayerManager) HandleMouseDown(x, y float32, button int) bool
func (*LayerManager) HandleMouseMove ¶
func (lm *LayerManager) HandleMouseMove(x, y float32) bool
func (*LayerManager) HandleMouseUp ¶
func (lm *LayerManager) HandleMouseUp(x, y float32, button int) bool
func (*LayerManager) HandleMouseWheel ¶
func (lm *LayerManager) HandleMouseWheel(x, y float32, dx, dy float32) bool
func (*LayerManager) HandleRune ¶
func (lm *LayerManager) HandleRune(ch rune) bool
HandleRune dispatches character input to the topmost layer widget.
func (*LayerManager) HandleTextEditing ¶
func (lm *LayerManager) HandleTextEditing(text string, start, length int) bool
HandleTextEditing dispatches an IME composition to the topmost layer widget, so a dialog opened without focus can still show its preedit.
func (*LayerManager) HitTest ¶
func (lm *LayerManager) HitTest(x, y float32) *Layer
func (*LayerManager) LayerCount ¶
func (lm *LayerManager) LayerCount() int
LayerCount is how many layers are open, which a window needs to decide whether Escape should close one or fall through to a widget.
func (*LayerManager) MoveToFront ¶
func (lm *LayerManager) MoveToFront(layer *Layer)
func (*LayerManager) Paint ¶
func (lm *LayerManager) Paint(canvas *graphics.Canvas)
func (*LayerManager) RemoveLayer ¶
func (lm *LayerManager) RemoveLayer(layer *Layer)
func (*LayerManager) RemoveLayerByWidget ¶
func (lm *LayerManager) RemoveLayerByWidget(widget Widget)
func (*LayerManager) TopLayer ¶
func (lm *LayerManager) TopLayer() Widget
TopLayer is the topmost visible layer's widget, or nil. It is the widget a key belongs to when the window is routing to a popup rather than to the focused child.
type MenuStripHost ¶
type MenuStripHost interface{ IsMenuStrip() bool }
MenuStripHost marks widgets (menu bars) that must keep receiving pointer moves while a popup menu is open: hovering another title hover-switches the open menu.
type ModalBackdrop ¶
type ModalBackdrop struct {
BaseWidget
// contains filtered or unexported fields
}
func (*ModalBackdrop) ContainsPoint ¶
func (mb *ModalBackdrop) ContainsPoint(x, y float32) bool
func (*ModalBackdrop) OnMouseDown ¶
func (mb *ModalBackdrop) OnMouseDown(x, y float32, button int) bool
func (*ModalBackdrop) OnMouseMove ¶
func (mb *ModalBackdrop) OnMouseMove(x, y float32)
type ModalPopup ¶
type MouseArea ¶
type MouseArea struct {
BaseWidget
// HoverEnabled is QML's name for "track hover even without buttons". It is
// accepted for scene readability; the toolkit always tracks hover, because a
// position-based hover walk is cheaper than a second code path.
HoverEnabled bool
OnClicked func()
OnPressed func()
OnReleased func()
OnPositionChanged func(x, y float32)
OnDoubleClicked func()
// contains filtered or unexported fields
}
MouseArea is a transparent input region. Size and position come from its parent (anchors.fill) or from explicit width/height.
func (*MouseArea) OnMouseDoubleClick ¶
OnMouseDoubleClick is dispatched by the window's click-count path when a widget implements it; kept here so a scene can wire a double-click without a new widget.
func (*MouseArea) OnMouseDown ¶
OnMouseDown arms the press.
func (*MouseArea) OnMouseMove ¶
OnMouseMove reports the pointer in the area's own coordinates.
func (*MouseArea) SetFillParent ¶
SetFillParent sizes the area to its parent — QML's anchors.fill: parent, without requiring the parent to run an anchor pass before the first frame.
func (*MouseArea) SetFocusable ¶
SetFocusable makes the area a keyboard target: it joins the Tab order and Enter/Space activate it.
func (*MouseArea) SetHoveredState ¶
SetHoveredState forwards hover to the state target as well as tracking it here, so a box painted by the area responds while the pointer is over it.
func (*MouseArea) SetPushed ¶
SetPushed lets the window or a parent drive the visual press state (a drag that started elsewhere, a test).
func (*MouseArea) SetStateTarget ¶
SetStateTarget points the area's hover/press state at another widget (a Panel), which is how a scene lights up the box a MouseArea sits on. Setting a target does not take over the target's own input; it only forwards state.
type OSWindow ¶
type OSWindow struct{}
OSWindow is a stub for the underlying OS-level window concept. The shim does not currently use it; methods are stubs so call sites that retrieve it compile and run as no-ops.
func (*OSWindow) ContentRect ¶
ContentRect returns the content rectangle in screen coordinates. Stub: returns zero rect until a backend provides one.
func (*OSWindow) SetContentRect ¶
type Panel ¶
type Panel struct {
BaseContainer
DrawCallback func(canvas *graphics.Canvas, rect graphics.Rect)
MouseDownCallback func(where graphics.Point, button, clickCount int, mod platform.Modifiers) bool
MouseUpCallback func(where graphics.Point, button int, mod platform.Modifiers) bool
MouseMoveCallback func(where graphics.Point, mod platform.Modifiers) bool
MouseDragCallback func(where graphics.Point, button int, mod platform.Modifiers) bool
MouseWheelCallback func(where, delta graphics.Point, mod platform.Modifiers) bool
UpdateCursorCallback func(where graphics.Point) *platform.Cursor
RuneTypedCallback func(ch rune) bool
// contains filtered or unexported fields
}
func (*Panel) AddChild ¶
AddChild appends a child and sets its parent to this Panel (not the embedded BaseContainer).
func (*Panel) ApplyOpacity ¶
ApplyOpacity is the non-fluent form the QML loader's common-property pass uses (a fluent setter returning *Panel does not satisfy interface{ ApplyOpacity(float32) }).
func (*Panel) BackdropBlur ¶
BackdropBlur reports whether the box frosts its backdrop.
func (*Panel) ClearGradient ¶
ClearGradient returns to the solid background.
func (*Panel) CursorAt ¶
CursorAt points at a clickable box. An explicit cursor wins; returning nil lets the walk fall through to the parent.
func (*Panel) EffectiveBackground ¶
EffectiveBackground resolves the panel background for the current theme: the token when one is set (live), otherwise the stored colour.
func (*Panel) FinishAnimations ¶
func (p *Panel) FinishAnimations()
FinishAnimations snaps every state transition to its target. Tests and reduce-motion apps call it; the window's loop keeps painting until they settle.
func (*Panel) Focusable ¶
Focusable reports whether the panel can take the keyboard. A clickable box can: a div with a click handler that a keyboard cannot reach is not a control.
func (*Panel) GetContentHeight ¶
func (*Panel) GetContentWidth ¶
func (*Panel) HoverAt ¶
HoverAt is the position-based hover walk (see HoverTarget): a clickable box lights up whether the pointer is over its own face or over a label child that is the actual hit.
func (*Panel) OnBubbledMouseDown ¶
OnBubbledMouseDown handles a press that reached this panel because a CHILD was the deepest hit and declined it (see Window.handleMouseDown). It deliberately does NOT dispatch to children: they have already been asked.
func (*Panel) OnBubbledMouseUp ¶
OnBubbledMouseUp is the release half of OnBubbledMouseDown.
func (*Panel) OnKeyDown ¶
OnKeyDown activates a focused clickable box with Enter or Space, which is what a keyboard user means by "click the card".
func (*Panel) OnMouseMove ¶
func (*Panel) PanelAt ¶
PanelAt returns the deepest child widget containing the point (in LOCAL coordinates).
func (*Panel) PreferredDimensions ¶
PreferredDimensions returns the preferred size of the panel based on its children.
func (*Panel) Pressed ¶
Pressed reports whether the pointer is down on this box (the visual press state).
func (*Panel) RemoveChild ¶
RemoveChild removes a child widget and cleans up its references.
func (*Panel) SetBackdropBlur ¶
SetBackdropBlur frosts the box: what is already painted behind it is blurred with the renderer's kernel, then the box's own translucent fill and border go on top. It is the frosted-glass card, and it is deliberately a BOOLEAN — the blur strength is the renderer's (one kernel on both sides); a per-box radius would drift from GL.
func (*Panel) SetBackground ¶
func (*Panel) SetBackgroundToken ¶
SetBackgroundToken pins the panel background to a theme role so runtime theme switches recolour it.
func (*Panel) SetBorderColor ¶
func (p *Panel) SetBorderColor(color interface{})
func (*Panel) SetBorderWidth ¶
func (*Panel) SetBoundProperty ¶
func (*Panel) SetClickable ¶
SetClickable makes the box an input target: it tracks hover and press, paints them, points the cursor at itself and takes Enter/Space when focused. Its children still get the press first — a card containing a button must let the button win — and only a press that no child consumed clicks the box.
func (*Panel) SetClipChildren ¶
SetClipChildren clips children to this panel's (rounded) rect — what a web card with an image needs, and what `clip: true` means in QML.
func (*Panel) SetContentHeight ¶
func (*Panel) SetContentWidth ¶
func (*Panel) SetCornerRadius ¶
SetCornerRadius rounds the panel's background, border and shadow together, so the three can never disagree about the shape. It is QML's Rectangle radius.
func (*Panel) SetCursor ¶
SetCursor forces a cursor over the box. Nil falls back to the pointing hand when the box is clickable.
func (*Panel) SetEnabled ¶
func (*Panel) SetFocusable ¶
SetFocusable toggles whether this panel can receive keyboard focus.
func (*Panel) SetFrameRect ¶
SetFrameRect overrides BaseWidget to trigger layout on resize.
func (*Panel) SetGradient ¶
SetGradient fills the panel with a gradient instead of a solid colour. The background colour still applies when no gradient is set.
func (*Panel) SetGradientUnit ¶
SetGradientUnit fills the panel with a gradient whose geometry is expressed in 0..1 of the box, so a scene can say "top to bottom" without knowing the size the layout will give it. Paint resolves it against the final rect.
func (*Panel) SetHoverInk ¶
SetHoverInk overrides the theme's hover wash for this box; zero uses the theme's Hovered role.
func (*Panel) SetHoveredState ¶
SetHoveredState starts the hover wash's transition. The window drives it through the hover chain, so a box lights up and fades out the same way whether the pointer is on its face or on a label inside it.
func (*Panel) SetOnClick ¶
SetOnClick installs the box's click handler. Setting a handler also makes the box clickable, because a handler nothing can call is the failure this tree keeps finding.
func (*Panel) SetOnPress ¶
SetOnPress installs the press-state handler (down/up), which a scene uses when it wants a custom pressed visual rather than the theme wash.
func (*Panel) SetOpacity ¶
SetOpacity sets the panel's own paint opacity (0..1). It applies to the panel's fill, border, shadow and state wash; children keep their own opacity.
func (*Panel) SetPadding ¶
func (*Panel) SetPressedInk ¶
SetPressedInk overrides the theme's press wash; zero uses the theme's Pressed role.
func (*Panel) SetPushed ¶
SetPushed drives the pressed visual from outside (a MouseArea forwarding its state, a drag that began elsewhere, a test).
func (*Panel) SetSelected ¶
SetSelected marks the box as the chosen one in its group — a nav item, a day cell, a list row. It paints the theme's Selected ink UNDER the hover/press wash, so the selected state survives a hover instead of being replaced by it.
func (*Panel) SetSelectedInk ¶
SetSelectedInk overrides the theme's Selected role for this box; zero uses the theme.
func (*Panel) SetShadow ¶
func (p *Panel) SetShadow(spec theme.ShadowSpec) *Panel
SetShadow paints a drop shadow behind the panel from an explicit spec. The token route (SetShadowToken) is preferred in a theme-driven app.
func (*Panel) SetShadowToken ¶
SetShadowToken resolves a named shadow ("card", "popup", "window", "none") from the ACTIVE theme, so a scene that says `shadow: "card"` follows the preset.
func (*Panel) SetSticky ¶
SetSticky pins the box to the top of its scroll viewport while its section is in view. The scroll pane positions it; the box just declares it.
func (*Panel) SetStickyInset ¶
SetStickyInset is how far below the viewport's top edge a sticky box pins (useful under a fixed bar the pane does not know about).
func (*Panel) StickyInset ¶
StickyInset reports the pin offset.
func (*Panel) ValidateLayout ¶
func (p *Panel) ValidateLayout()
ValidateLayout applies the layout if needed.
type PerfTimer ¶
type PerfTimer struct {
// contains filtered or unexported fields
}
PerfTimer measures performance of an operation
func StartPerfTimer ¶
StartPerfTimer starts a performance timer
type SVGDocument ¶
type SVGDocument struct {
Width float32
Height float32
ViewBox [4]float32
Elements []SVGElement
}
SVGDocument represents a parsed SVG file
func LoadSVGByName ¶
func LoadSVGByName(name string) (*SVGDocument, error)
LoadSVGByName loads an SVG from the embedded assets/icons directory
type SVGElement ¶
type SVGElement struct {
Type string
Attrs map[string]string
Children []SVGElement
Text string
}
SVGElement represents a parsed SVG element
type ScrollHandler ¶
type TabIndexSetter ¶
type Widget ¶
type Widget interface {
Paint(canvas *graphics.Canvas, rect graphics.Rect)
ContainsPoint(x, y float32) bool
FrameRect() graphics.Rect
SetFrameRect(rect graphics.Rect)
MarkForRedraw()
SetParent(parent Widget)
Parent() Widget
PreferredDimensions(target interface{}, width, height float32) (float32, float32)
MinimumDimensions() (float32, float32)
}
func FocusableWidgets ¶
FocusableWidgets returns the widgets in root's subtree that can take keyboard focus, in TabIndex order (tree order among equal indices).
It is the ONE focus traversal: the window's Tab uses it, a dialog's Tab uses it with the dialog's content as the root, and a container's own Children() decides what is reachable — so a TabPanel offers only its active page and a layer's content (which is not in the window tree) is reachable at all.
func GetNamedWidget ¶
func NamedWidgets ¶
func NamedWidgets() []Widget
NamedWidgets returns all globally registered named widgets.
func NearestFocusable ¶
NearestFocusable returns w when it can take focus, otherwise the nearest ancestor that can. A click hits the DEEPEST widget — a label, a cell, an icon inside the control the user meant — and focusing that instead of the control is why a table row or a framed field was never focused by clicking it.
type Window ¶
type Window struct {
*BaseContainer
LayerManager *LayerManager
Drag *DragManager
// contains filtered or unexported fields
}
Window is the top-level container that receives events and manages children.
func (*Window) AddLayerFor ¶
func (w *Window) AddLayerFor(from Widget, x, y float32, paint func(canvas *graphics.Canvas, rect graphics.Rect)) *Layer
AddLayerFor places a layer at a point given in `from`'s own local coordinates and returns it. Callers never convert spaces themselves: the window adds the position within the tree and the tree's origin.
func (*Window) Children ¶
Children returns the window's content tree. It is the accessor that makes the window usable wherever a Container is — a tree walk, an audit, a debug dump — which it was not before: the window had AddChild and PanelAt but no way to enumerate what it held, so anything that walked a tree had to start somewhere else or give up.
func (*Window) ClickCount ¶
func (*Window) ContentOrigin ¶
ContentOrigin returns the content tree's origin in window space.
func (*Window) CursorAt ¶
CursorAt implements meuishim.CursorSource — the hover cursor for the widget under (x, y), via the standard hit-test walk.
func (*Window) Device ¶
Device returns the device the window last painted through, or nil if it has not painted yet. Offscreen work outside a paint pass uses this.
func (*Window) DismissContextMenu ¶
DismissContextMenu dismisses a named context menu popup.
func (*Window) DismissModal ¶
func (w *Window) DismissModal(mp *ModalPopup)
func (*Window) DismissPopupContextMenu ¶
func (w *Window) DismissPopupContextMenu()
DismissPopupContextMenu dismisses the current popup context menu.
func (*Window) DismissTopModal ¶
func (w *Window) DismissTopModal()
func (*Window) Dispose ¶
func (w *Window) Dispose()
Dispose cleans up all resources held by the Window.
func (*Window) FocusedChild ¶
func (*Window) HandleEvent ¶
HandleEvent implements platform.Sink. Returns true when consumed.
func (*Window) HeldModifiers ¶
HeldModifiers reports what is held RIGHT NOW, computed from the keys themselves rather than from the last event's modifier field.
It is the answer for a paint or a timer asking "is shift down" between two events, which `Modifiers()` cannot give: that describes the last event that arrived, and moving the mouse is an event carrying no modifiers — so a shift-held UI asked mid-drag would say no.
func (*Window) KeyDown ¶
KeyDown reports whether a key is currently held. It is the answer to "is the user holding shift RIGHT NOW", which an event's modifier bits cannot give: they describe the event that arrived, not the state the keyboard is in.
func (*Window) MarkForRedraw ¶
func (w *Window) MarkForRedraw()
func (*Window) MarkPainted ¶ added in v0.5.9
func (w *Window) MarkPainted()
MarkPainted clears redraw requests through the tree. The platform loop calls it after Paint has submitted a frame.
func (*Window) Modifiers ¶
RemoveChild removes a child widget from the Window. Modifiers reports the modifiers of the LAST INPUT EVENT — which is what an event handler wants.
It was changed at one point to compute from the keys that are down, on the theory that "is shift held" wants the current state. That broke the node graph's shift+wheel and ctrl+wheel, which are exactly the handlers that read this: a wheel event carries no modifiers, so the pump queries the OS and puts them on the event, and the widget reads them back here. Two different questions, one method:
- "what did THIS event carry" — Modifiers(), which is this
- "what is held right now" — HeldModifiers(), which answers it from the keys
Collapsing them broke a real caller for the sake of a case no caller had, which is the trade this project keeps learning: extending the contract is cheaper than redefining it.
func (*Window) NeedsPaint ¶ added in v0.5.9
NeedsPaint reports whether a frame would change pixels. It is the gate the platform loop uses to skip clear/draw/swap on an idle window; running animations keep it true.
func (*Window) PaintLayerOverlay ¶
PaintLayerOverlay paints all layers translated by translateY (the content-space offset the layers' coordinates are expressed in).
func (*Window) PanelAt ¶
PanelAt returns the deepest child widget containing the point (in local coordinates).
func (*Window) RemoveChild ¶
func (*Window) RenderToImage ¶
RenderToImage renders the window contents to an offscreen image at the given pixel dimensions. Used by render_demo for screenshot capture.
func (*Window) Scale ¶
Scale returns the display's content scale factor (1.0 = normal, 2.0 = Retina).
func (*Window) SetBoundProperty ¶
func (*Window) SetContentOrigin ¶
SetContentOrigin records where the content tree's (0,0) sits in window space. It is non-zero when the host reserves a strip for window chrome — the custom title bar — and it is the *only* bar knowledge the toolkit needs: widgets keep speaking their own tree's coordinates.
func (*Window) SetDisplayScale ¶
SetDisplayScale overrides the detected display scale. Useful when the window moves to a different monitor and the user wants to set the scale explicitly.
func (*Window) SetFocusedChild ¶
SetFocusedChild moves keyboard focus to child (nil clears it). It is the only public way in, and it goes through the same blur-then-focus path as a click: assigning the field directly left the previous widget saying it was still focused, which is how two controls ended up both looking — and acting — focused.
func (*Window) SetFrameRect ¶
SetFrameRect overrides BaseWidget to trigger layout on resize.
func (*Window) SetLayerPaintExternal ¶
func (w *Window) SetLayerPaintExternal()
SetLayerPaintExternal switches layer painting off inside Window.Paint: the host paints them via PaintLayerOverlay AFTER the title bar, so dropdowns/popups overlay the chrome instead of being overpainted by it.
func (*Window) SetOnAction ¶
SetOnAction installs the app's handler for a semantic action resolved by the global keymap (platform.Event.Actions — window.close, app.exit-fullscreen, or an app-specific binding). It runs only when the widgets declined the key, so a shortcut never steals a key a text field needed; it is how an app binds a command without the toolkit learning every app's vocabulary.
func (*Window) SetOnBack ¶
SetOnBack installs the handler for the OS back gesture. It returns true when the app handled it — it popped its own navigation — and false to let the window close, which is what happens at the root of the stack. A nil handler always closes.
This is the app's half of Android's back contract. Without it the gesture reaches nothing and the system closes the app, which is what happened before the back event existed at all.
func (*Window) SetOnKeyDown ¶
func (w *Window) SetOnKeyDown(handler func(keyCode platform.KeyCode, modifiers platform.Modifiers)) *Window
Additional methods needed by other code
func (*Window) SetOnMouseDown ¶
func (*Window) SetOnMouseMove ¶
func (*Window) SetOnMouseUp ¶
func (*Window) SetOnResize ¶
SetOnResize installs the app's resize hook. It receives the CONTENT size, once per actual change, so a responsive scene can reflow without polling Width().
func (*Window) SetOpacity ¶
func (*Window) SetPadding ¶
func (*Window) SetTouchProfile ¶
SetTouchProfile turns the touch floor on or off FOR THIS WINDOW. It is a manual setting: a later resize will not override it.
func (*Window) SetWindowSize ¶
SetWindowSize resizes the OS window to the given content dimensions. The status bar size grip calls this to resize the window on drag.
func (*Window) ShowContextMenuPositioned ¶
The menu is displayed as a non-modal popup layer. The id must have been registered via RegisterNamedWidget during QML loading.
func (*Window) ShowNonModal ¶
func (w *Window) ShowNonModal(content Widget, pw, ph float32) *ModalPopup
func (*Window) ShowPopupContextMenu ¶
ShowPopupContextMenu shows a standalone context menu widget at the given position. The menu is displayed as a non-modal popup layer. The widget should be a *ContextMenu or any widget that implements PreferredSize() and ContextMenuHoster.
func (*Window) TakeScreenShot ¶
func (*Window) TextInputArea ¶
TextInputArea reports whether a widget is editing text, and where it is, in WINDOW coordinates.
It is the handover between the two halves of on-screen-keyboard support: the toolkit knows what has focus, the backend knows how to tell the OS, and neither can answer alone. A backend polls this and calls platform.Window.SetTextInput when it changes.
"Editing text" is the same test the rune path uses — the focused widget accepts OnCharacter — so the keyboard cannot appear for a widget that would then ignore what was typed.
func (*Window) TouchProfile ¶
TouchProfile reports whether THIS window uses the touch floor. An explicit setting wins; otherwise it is the process default.
func (*Window) ValidateLayout ¶
func (w *Window) ValidateLayout()
ValidateLayout applies the layout if needed.
func (*Window) Window ¶
Window returns the window itself.
Without this, the promoted BaseWidget.Window() wins, and for a *Window it walks Parent() — which a Window does not have — so it returns nil. Any caller doing .Window() on a window then gets nil and can fall back to process-global state, which is how a window ends up using another window's values.
type WindowOptions ¶
type WindowOptions struct {
Title string
Size graphics.Size
// NoChrome skips the standard title bar. The default is to install it: the
// desktop backends create undecorated windows, so without chrome a window
// can be neither moved, maximized nor resized. Mobile hosts — where the OS
// owns the surface — and any app that draws its own chrome pass true.
NoChrome bool
// Icon is the window icon used by the window manager and the taskbar.
// Nil installs DefaultIcon(); set NoIcon to suppress the icon entirely.
// A backend that cannot set an icon ignores it.
Icon *graphics.Image
// NoIcon suppresses the default icon for this window.
NoIcon bool
}
WindowOptions configures one window added to the app.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package flow provides declarative widget wrappers for MeUi.
|
Package flow provides declarative widget wrappers for MeUi. |
|
Package graphics is the meui drawing seam: meui-owned value types, a Paint, and a Canvas facade.
|
Package graphics is the meui drawing seam: meui-owned value types, a Paint, and a Canvas facade. |
|
enums/paintstyle
Package paintstyle mirrors the reference toolkit's paint-style enum.
|
Package paintstyle mirrors the reference toolkit's paint-style enum. |
|
enums/pathop
Package pathop mirrors the reference toolkit's path-op enum.
|
Package pathop mirrors the reference toolkit's path-op enum. |
|
enums/slant
Package slant mirrors the reference toolkit's slant enum.
|
Package slant mirrors the reference toolkit's slant enum. |
|
enums/spacing
Package spacing mirrors the reference toolkit's spacing enum.
|
Package spacing mirrors the reference toolkit's spacing enum. |
|
enums/weight
Package weight mirrors the reference toolkit's weight enum.
|
Package weight mirrors the reference toolkit's weight enum. |
|
textshape
Package textshape provides the pure-Go shaping foundation for MeUI.
|
Package textshape provides the pure-Go shaping foundation for MeUI. |
|
Package keymap provides the global, user-mappable key-binding dictionary: stable action names ("window.close") mapped to key + modifier combinations, with JSON persistence so applications (and a future Settings UI) can override the defaults at startup.
|
Package keymap provides the global, user-mappable key-binding dictionary: stable action names ("window.close") mapped to key + modifier combinations, with JSON persistence so applications (and a future Settings UI) can override the defaults at startup. |
|
Package mobile is the reusable phone shell: one widget that gives a scene the platform navigation, a large title or app bar, a bottom bar or rail, a FAB, a snackbar and safe-area layout.
|
Package mobile is the reusable phone shell: one widget that gives a scene the platform navigation, a large title or app bar, a bottom bar or rail, a FAB, a snackbar and safe-area layout. |
|
Package platform is the OS-facing seam: the contract the toolkit uses for windows, events, input, clipboard, dialogs, displays and cross-thread work, with the renderer/windowing backend supplied behind it.
|
Package platform is the OS-facing seam: the contract the toolkit uses for windows, events, input, clipboard, dialogs, displays and cross-thread work, with the renderer/windowing backend supplied behind it. |
|
Package resources gives a scene a namespace for its files.
|
Package resources gives a scene a namespace for its files. |
|
Package view is the behaviour layer for a QML view.
|
Package view is the behaviour layer for a QML view. |

































