Api Editor Menu
class

Menu

public class Menu : Widget

Constructors

Menu(Widget parent)
Menu(String title, Widget parent)

Properties

Name Type Description
Title String
Icon String
ToolTipsVisible Boolean This property holds whether tooltips of menu actions should be visible. This property specifies whether action menu entries show their tooltip. By default, this property is false.
ToolTip virtual String
ParentMenu Menu
RootMenu Menu
HasOptions Boolean
HasMenus Boolean
OptionCount Int32
MenuCount Int32
Widgets IReadOnlyList<Widget>
SelectedOption Option

Methods

static PathElement[] GetSplitPath(String path)

Splits a path as a list of /-delimited elements, each with the form "[#]name[:icon][@order]".

path — Path to split.
static PathElement[] GetSplitPath(ITitleProvider item)

Combines the Value (if exists) and Value, then splits it with String).

Void AddOptions(IEnumerable<T> items, Func<T, String> getPath, Action<T> action = null, Boolean flat = False, Boolean reduce = True, String defaultSubMenuIcon = folder)
Void AddOptions(IEnumerable<T> items, Action<T> action = null, Boolean flat = False, Boolean reduce = True, String defaultSubMenuIcon = folder)
Void AddOptions(IEnumerable<T> items, Func<T, PathElement[]> getPath, Action<T> action = null, Boolean flat = False, Boolean reduce = True, String defaultSubMenuIcon = folder)
virtual Option AddOption(String name, String icon = null, Action action = null, String shortcut = null)
virtual Option AddOptionWithImage(String name, Pixmap icon, Action action = null, String shortcut = null)
Option AddOption(String[] path, String icon = null, Action action = null, String shortcut = null)

Like AddOption, except will automatically create the menu path from the array of names

Option AddOption(ReadOnlySpan<PathElement> path, Action action = null, String shortcut = null)
virtual Option AddOption(Option option)
T AddWidget(T widget)

Add a widget as an action to the menu. Some widgets such as Widget and LineEdit require MouseEvent) to set Accepted to to prevent the menu from closing.

Label AddHeading(String title)
Void GetPathTo(String path, List<Menu> list)
Void GetPathTo(ReadOnlySpan<PathElement> path, List<Menu> list)
Menu FindOrCreateMenu(String name)
Menu AddMenu(String name, String icon = null)
Menu AddMenu(Menu menu)
Option GetOption(String name)
Void RemoveOption(String name)
Void RemoveOption(Option option)
Void RemoveWidget(Widget widget)
Void RemoveOptions()

Remove all options

Void RemoveMenus()

Remove all menus

Void RemoveWidgets()

Remove all widgets

Option AddSeparator()
Void OpenAt(Vector2 position, Boolean modal = True)
Void OpenAtCursor(Boolean modal = False)

Open this menu at the mouse cursor position

Void Clear()
Assembly: Sandbox.Tools Namespace: Editor Full Name: Editor.Menu