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

Method AddContextMenu

core/menu.go:131–133  ·  view source on GitHub ↗

AddContextMenu adds the given context menu to [WidgetBase.ContextMenus]. It is the main way that code should modify a widget's context menus. Context menu functions are run in reverse order, and separators are automatically added between each context menu function.

(menu func(m *Scene))

Source from the content-addressed store, hash-verified

129// Context menu functions are run in reverse order, and separators are
130// automatically added between each context menu function.
131func (wb *WidgetBase) AddContextMenu(menu func(m *Scene)) {
132 wb.ContextMenus = append(wb.ContextMenus, menu)
133}
134
135// applyContextMenus adds the [Widget.ContextMenus] to the given menu scene
136// in reverse order. It also adds separators between each context menu function.

Callers 13

InitMethod · 0.80
InitMethod · 0.80
InitMethod · 0.80
InitMethod · 0.80
makeFilesRowMethod · 0.80
InitMethod · 0.80
InitMethod · 0.80
InitMethod · 0.80
InitMethod · 0.80
InitMethod · 0.80
InitMethod · 0.80
InitMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected