MCPcopy Create free account
hub / github.com/cogentcore/core / parentWidget

Method parentWidget

core/widget.go:366–375  ·  view source on GitHub ↗

parentWidget returns the parent as a [WidgetBase] or nil if this is the root and has no parent.

()

Source from the content-addressed store, hash-verified

364// parentWidget returns the parent as a [WidgetBase] or nil
365// if this is the root and has no parent.
366func (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.

Callers 12

OnAddMethod · 0.95
IsVisibleMethod · 0.95
PushBoundsMethod · 0.95
StyleMethod · 0.95
updateParentRelSizesMethod · 0.95
styleSizeUpdateMethod · 0.95
setPosFromParentMethod · 0.95
setBBoxesMethod · 0.95
InitMethod · 0.80
ApplyScenePosMethod · 0.80
parentSizeMethod · 0.80

Calls 1

AsWidgetMethod · 0.65

Tested by

no test coverage detected