OdinMenuItem

A menu item that represents one or more objects.

namespace Sirenix.OdinInspector.Editor
{
public class OdinMenuItem
}

Requirements

Namespace: Sirenix.OdinInspector.Editor
Assembly: Sirenix.OdinInspector
Version: 2.0.0.0

See Also

Fields

Return Type Definition Description
bool DefaultToggledState The default toggled state

Constructors

Definition Description
OdinMenuItem(OdinMenuTree, string, IList) Initializes a new instance of the OdinMenuItem class.
OdinMenuItem(OdinMenuTree, string, Object) Initializes a new instance of the OdinMenuItem class.

Events

Definition Description
OnDrawItem Occurs right after the menu item is done drawing, and right before mouse input is handles so you can take control of that.
OnRightClick Occurs when the user has right-clicked the menu item.

Properties

Return Type Definition Description
List<OdinMenuItem> ChildMenuItems Gets the child menu items.
int FlatTreeIndex Gets the index location of the menu item.
Texture Icon Gets or sets the icon that is used when the menu item is not selected.
Func<Texture> IconGetter Gets or sets the icon getter.
Texture IconSelected Gets or sets the icon that is used when the menu item is selected.
bool IsSelected Gets a value indicating whether this instance is selected.
bool IsVisible Gets or sets a value indicating whether the menu item is visible. Not that setting this to false will not hide its children as well. For that see use Toggled.
Rect LabelRect Gets the drawn label rect.
OdinMenuTree MenuTree Gets the menu tree instance.
string Name Gets or sets the raw menu item name.
OdinMenuItem NextVisualMenuItem Gets the next visual menu item.
Object ObjectInstance Gets the first object of the ObjectInstances
IEnumerable<Object> ObjectInstances Gets the object instances the menu item represents
OdinMenuItem Parent Gets the parent menu item.
OdinMenuItem PrevVisualMenuItem Gets the previous visual menu item.
Rect Rect Gets the drawn rect.
string SearchString Gets or sets the search string used when searching for menu items.
string SmartName Gets a nice menu item name. If the raw name value is null or a dollar sign, then the name is retrieved from the object itself.
OdinMenuStyle Style Gets or sets the style. If null is specified, then the menu trees DefaultMenuStyle is used.
bool Toggled Gets or sets a value indicating whether this OdinMenuItem is toggled / expanded. This value tries it best to be persistent.
Object Value Gets or sets the value the menu item represents.

Methods

Return Type Definition Description
bool Deselect() Deselects this instance.
void DrawMenuItem(int) Draws the menu item with the specified indent level.
void DrawMenuItems(int) Draws this menu item followed by all of its child menu items
IEnumerable<OdinMenuItem> GetChildMenuItemsRecursive(bool) Gets the child menu items recursive in a DFS.
string GetFullPath() Gets the full menu item path.
IEnumerable<OdinMenuItem> GetParentMenuItemsRecursive(bool, bool) Gets the child menu items recursive in a DFS.
void HandleMouseEvents(Rect, Rect) Handles the mouse events.
void OnDrawMenuItem(Rect, Rect) Override this to add custom GUI to the menu items. This is called right after the menu item is done drawing, and right before mouse input is handles so you can take control of that.
void Select(bool) Selects the specified add to selection.
void SetObjectInstance(Object) Sets the object instance
void SetObjectInstances(IList) Sets the object instances