parentWidget returns the parent as a [WidgetBase] or nil if this is the root and has no parent.
()
| 364 | // parentWidget returns the parent as a [WidgetBase] or nil |
| 365 | // if this is the root and has no parent. |
| 366 | func (wb *WidgetBase) parentWidget() *WidgetBase { |
| 367 | if wb.Parent == nil { |
| 368 | return nil |
| 369 | } |
| 370 | pw, ok := wb.Parent.(Widget) |
| 371 | if ok { |
| 372 | return pw.AsWidget() |
| 373 | } |
| 374 | return nil // the parent may be a non-widget in [tree.UnmarshalRootJSON] |
| 375 | } |
| 376 | |
| 377 | // IsVisible returns true if a widget is visible for rendering according |
| 378 | // to the [states.Invisible] flag on it or any of its parents. |
no test coverage detected