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

Method CopyFieldsFrom

core/widget.go:314–333  ·  view source on GitHub ↗
(from tree.Node)

Source from the content-addressed store, hash-verified

312}
313
314func (wb *WidgetBase) CopyFieldsFrom(from tree.Node) {
315 wb.NodeBase.CopyFieldsFrom(from)
316 frm := AsWidget(from)
317
318 n := len(wb.ContextMenus)
319 if len(frm.ContextMenus) > n {
320 wb.ContextMenus = append(wb.ContextMenus, frm.ContextMenus[n:]...)
321 }
322
323 wb.Stylers.DoWith(&frm.Stylers, func(to, from *[]func(s *styles.Style)) {
324 n := len(*to)
325 if len(*from) > n {
326 *to = append(*to, (*from)[n:]...)
327 }
328 })
329
330 wb.Listeners.DoWith(&frm.Listeners, func(to, from *events.Listeners) {
331 to.CopyFromExtra(*from)
332 })
333}
334
335func (wb *WidgetBase) Destroy() {
336 wb.deleteParts()

Callers

nothing calls this directly

Calls 4

AsWidgetFunction · 0.85
DoWithMethod · 0.80
CopyFromExtraMethod · 0.80
CopyFieldsFromMethod · 0.65

Tested by

no test coverage detected