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

Function NewMenu

core/menu.go:123–125  ·  view source on GitHub ↗

NewMenu returns a new menu stage based on the given menu constructor function, in connection with given widget, which provides key context for constructing the menu at given RenderWindow position (e.g., use ContextMenuPos or WinPos method on ctx Widget). Make further configuration choices using Set*

(menu func(m *Scene), ctx Widget, pos image.Point)

Source from the content-addressed store, hash-verified

121// can be chained directly after the New call.
122// Use Run call at the end to start the Stage running.
123func NewMenu(menu func(m *Scene), ctx Widget, pos image.Point) *Stage {
124 return NewMenuStage(newMenuScene(menu, ctx.AsTree().Name), ctx, pos)
125}
126
127// AddContextMenu adds the given context menu to [WidgetBase.ContextMenus].
128// It is the main way that code should modify a widget's context menus.

Callers 7

ShowContextMenuMethod · 0.85
pasteMenuMethod · 0.85
DragDropMethod · 0.85
openMenuMethod · 0.85
openMenuMethod · 0.85
pasteMenuMethod · 0.85
dragDropMethod · 0.85

Calls 3

NewMenuStageFunction · 0.85
newMenuSceneFunction · 0.85
AsTreeMethod · 0.65

Tested by

no test coverage detected