setScene sets the Scene pointer for this widget and all of its children. This can be necessary when creating widgets outside the usual New* paradigm, e.g., when reading from a JSON file.
(sc *Scene)
| 293 | // This can be necessary when creating widgets outside the usual New* paradigm, |
| 294 | // e.g., when reading from a JSON file. |
| 295 | func (wb *WidgetBase) setScene(sc *Scene) { |
| 296 | wb.WidgetWalkDown(func(cw Widget, cwb *WidgetBase) bool { |
| 297 | cwb.Scene = sc |
| 298 | return tree.Continue |
| 299 | }) |
| 300 | } |
| 301 | |
| 302 | // AsWidget returns the given [tree.Node] as a [WidgetBase] or nil. |
| 303 | func AsWidget(n tree.Node) *WidgetBase { |
nothing calls this directly
no test coverage detected