Files
inkwell/ui.manager.go
T
mr.zeroandClaude Opus 5 08f15a7e3d
ci/woodpecker/push/woodpecker Pipeline was successful
Manager.Set and Manager.All
Set is the deliberate overwrite: it replaces a registered entry in place,
keeping its position in the insertion order, and falls back to Register
when the name is new. Register keeps panicking on duplicates.

All returns every entry in insertion order; orderedWidgets is now just
that call, and reversedWidgets builds on it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 09:50:28 +02:00

20 lines
604 B
Go

package inkwell
// UIManager registers Widget instances. Same shape as every other manager.
type UIManager = Manager[Widget]
// reversedWidgets iterates a manager's contents in reverse registration
// order — used by the engine for top-down input dispatch (the widget
// drawn on top gets the click first).
func reversedWidgets(m *UIManager) []Widget {
all := m.All()
out := make([]Widget, len(all))
for i, w := range all {
out[len(all)-1-i] = w
}
return out
}
// orderedWidgets iterates in registration order — bottom-up draw.
func orderedWidgets(m *UIManager) []Widget { return m.All() }