Menuclass
One entry in a menu, and the menu it opens. A menu with no options is a plain command; give it options and it becomes a submenu. A root menu with no parent is a context menu, or a heading in a `Sandbox.UI.MenuBar`.
Constructors2
Showing 2 constructors
No results match this filter.
Methods20
Showing 20 methods
public void Activate()
Do what a click on this row does. A submenu row opens, a checkable row toggles, a command runs and takes the whole menu down with it.
void—public Sandbox.UI.Menu AddMenu(string text, string icon = null)
Add a submenu. Same as `Sandbox.UI.Menu.AddOption(System.String,System.String,System.Action)` without an action.
| Parameter | Type | Description |
|---|---|---|
| text | string | — |
| icon = null | string | — |
public T AddWidget(T widget)
Add any panel as a row - a text entry, a slider, a heading. It's shown in the list like an option but the menu leaves it alone.
| Parameter | Type | Description |
|---|---|---|
| widget | T | — |
T—public void Clear()
Delete every row.
void—public void Close()
Hide this menu's options, and any open submenus.
void—public Sandbox.UI.Menu FindOption(string text)
The first option with this text, or null.
| Parameter | Type | Description |
|---|---|---|
| text | string | — |
protected virtual void OnChildAdded(Sandbox.UI.Panel child)
A panel nested inside a menu - from Razor, or AddChild - is a row of it, not part of the row itself. It stays hidden in the row until the menu opens and moves it into the list.
| Parameter | Type | Description |
|---|---|---|
| child | Panel | — |
void—protected virtual void OnClick(Sandbox.UI.MousePanelEvent e)
| Parameter | Type | Description |
|---|---|---|
| e | MousePanelEvent | — |
void—public virtual void OnDeleted()
void—protected virtual void OnMouseMove(Sandbox.UI.MousePanelEvent e)
| Parameter | Type | Description |
|---|---|---|
| e | MousePanelEvent | — |
void—protected virtual void OnMouseOut(Sandbox.UI.MousePanelEvent e)
| Parameter | Type | Description |
|---|---|---|
| e | MousePanelEvent | — |
void—protected virtual void OnMouseOver(Sandbox.UI.MousePanelEvent e)
| Parameter | Type | Description |
|---|---|---|
| e | MousePanelEvent | — |
void—No results match this filter.
Properties17
Showing 17 properties
public bool Sandbox.UI.Menu.Checkable { get; set; }
Clicking toggles `Sandbox.UI.Menu.Checked` instead of running `Sandbox.UI.Menu.Clicked`.
bool—public bool Sandbox.UI.Menu.Checked { get; set; }
Shows a check mark in the gutter.
bool—public System.Action Sandbox.UI.Menu.Clicked { get; set; }
Runs when the row is activated.
Action—public bool Sandbox.UI.Menu.Enabled { get; set; }
A disabled row is dimmed and does nothing when clicked.
bool—public bool Sandbox.UI.Menu.HasOptions { get; set; }
Does this row open a submenu?
bool—public Sandbox.UI.Menu Sandbox.UI.Menu.Highlighted { get; set; }
The row with the keyboard or hover highlight, in this menu's list.
public string Sandbox.UI.Menu.Icon { get; set; }
Material icon shown in the gutter, before the text.
string—public bool Sandbox.UI.Menu.IsOpen { get; set; }
Whether this menu's options are showing.
bool—public bool Sandbox.UI.Menu.IsSeparator { get; set; }
Draws a line between rows instead of a row.
bool—public System.Collections.Generic.IReadOnlyList`1<Sandbox.UI.Menu> Sandbox.UI.Menu.Options { get; set; }
The option rows of this menu, in order.
public Sandbox.UI.Menu Sandbox.UI.Menu.ParentMenu { get; set; }
The menu this row is an option of. Null for a root menu.
public System.Collections.Generic.IReadOnlyList`1<Sandbox.UI.Panel> Sandbox.UI.Menu.Rows { get; set; }
Everything the list shows, in order - the options and any other panels added.
public string Sandbox.UI.Menu.Shortcut { get; set; }
Shortcut text drawn on the right, like "Ctrl+S". Display only - nothing dispatches it yet.
string—public bool Sandbox.UI.Menu.StaysOpen { get; set; }
Whether the menu stays up after this row is activated. Checkable rows do, so several can be flipped in one go; commands close the menu. Set it to say otherwise.
bool—public string Sandbox.UI.Menu.Text { get; set; }
The text shown on the row.
string—public System.Action`1<bool> Sandbox.UI.Menu.Toggled { get; set; }
Runs with the new state when a checkable row is toggled. Setting it makes the row checkable.
Action<bool>—No results match this filter.