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

Function RecycleTabWidget

core/tabs.go:338–346  ·  view source on GitHub ↗

RecycleTabWidget returns a tab with the given widget type in the tab frame, first by looking for an existing one with the given name, and if not found, making and configuring a new one. It returns the resulting widget.

(ts *Tabs, name string)

Source from the content-addressed store, hash-verified

336// first by looking for an existing one with the given name, and if not found,
337// making and configuring a new one. It returns the resulting widget.
338func RecycleTabWidget[T tree.NodeValue](ts *Tabs, name string) *T {
339 fr := ts.RecycleTab(name)
340 if fr.HasChildren() {
341 return any(fr.Child(0)).(*T)
342 }
343 w := tree.New[T](fr)
344 any(w).(Widget).AsWidget().UpdateWidget()
345 return w
346}
347
348// deleteTabIndex deletes the tab at the given index, returning whether it was successful.
349func (ts *Tabs) deleteTabIndex(idx int) bool {

Callers

nothing calls this directly

Calls 5

RecycleTabMethod · 0.80
ChildMethod · 0.80
UpdateWidgetMethod · 0.80
AsWidgetMethod · 0.65
HasChildrenMethod · 0.45

Tested by

no test coverage detected