Version 3.3.1.2

OdinMenuTreeSelection class

Namespace: Sirenix.OdinInspector.Editor
Assembly: Sirenix.OdinInspector.Editor
public class OdinMenuTreeSelection : IList<OdinMenuItem>, ICollection<OdinMenuItem>, IEnumerable<OdinMenuItem>, IEnumerable
Handles the selection of a Odin Menu Tree with support for multi selection.
Inheritance
  • System.Object
  • OdinMenuTreeSelection

Constructors

OdinMenuTreeSelection(Boolean)
Initializes a new instance of the OdinMenuTreeSelection class.
public OdinMenuTreeSelection(bool supportsMultiSelect)
Parameters
System.Boolean supportsMultiSelect

if set to true [supports multi select].

Properties

Count
Gets the count.
public int Count { get; }
Item[Int32]
Gets the OdinMenuItem at the specified index.
public OdinMenuItem this[int index] { get; }
Parameters
System.Int32 index

SelectedValue
Gets the first selected value, returns null if non is selected.
public object SelectedValue { get; }
SelectedValues
Gets all selected values.
public IEnumerable<object> SelectedValues { get; }
SupportsMultiSelect
Gets or sets a value indicating whether multi selection is supported.
public bool SupportsMultiSelect { get; set; }

Methods

Add(OdinMenuItem)
Adds a menu item to the selection. If the menu item is already selected, then the item is pushed to the bottom of the selection list. If multi selection is off, then the previous selected menu item is removed first. Adding a item to the selection triggers SelectionChanged.
public void Add(OdinMenuItem item)
Parameters
OdinMenuItem item

The item.

Clear()
Clears the selection and triggers Sirenix.OdinInspector.Editor.OdinMenuTreeSelection.OnSelectionChanged.
public void Clear()
ConfirmSelection()
Triggers OnSelectionConfirmed.
public void ConfirmSelection()
Contains(OdinMenuItem)
Determines whether an OdinMenuItem is selected.
public bool Contains(OdinMenuItem item)
Parameters
OdinMenuItem item

Returns
System.Boolean

CopyTo(OdinMenuItem[], Int32)
Copies all the elements of the current array to the specified array starting at the specified destination array index.
public void CopyTo(OdinMenuItem[] array, int arrayIndex)
Parameters
OdinMenuItem[] array

System.Int32 arrayIndex

GetEnumerator()
Gets the enumerator.
public IEnumerator<OdinMenuItem> GetEnumerator()
Returns
System.Collections.Generic.IEnumerator<OdinMenuItem>

IndexOf(OdinMenuItem)
Searches for the specified menu item and returns the index location.
public int IndexOf(OdinMenuItem item)
Parameters
OdinMenuItem item

Returns
System.Int32

Remove(OdinMenuItem)
Removes the specified menu item and triggers SelectionChanged.
public bool Remove(OdinMenuItem item)
Parameters
OdinMenuItem item

Returns
System.Boolean

RemoveAt(Int32)
Removes the menu item at the specified index and triggers SelectionChanged.
public void RemoveAt(int index)
Parameters
System.Int32 index

Events

SelectionChanged
Occurs whenever the selection has changed.
public event Action<SelectionChangedType> SelectionChanged
SelectionConfirmed
Usually occurs whenever the user hits return, or double click a menu item.
public event Action<OdinMenuTreeSelection> SelectionConfirmed
Extension Methods