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)
| 121 | // can be chained directly after the New call. |
| 122 | // Use Run call at the end to start the Stage running. |
| 123 | func 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. |