Reorderable List Control for Unity
ElementAdderMenuCommandAttribute Class |
Annotate IElementAdderMenuCommandTContext implementations with a
ElementAdderMenuCommandAttribute to associate it with the contract
type of addable elements.

SystemObject SystemAttribute
Rotorz.ReorderableListElementAdderMenuCommandAttribute
Rotorz.ReorderableListElementAdderMenuCommandAttribute
Namespace: Rotorz.ReorderableList
Assembly: Editor.ReorderableList (in Editor.ReorderableList.dll) Version: 0.0.0.0 (0.3.0.0)

public sealed class ElementAdderMenuCommandAttribute : Attribute
public sealed class ElementAdderMenuCommandAttribute extends Attribute
The ElementAdderMenuCommandAttribute type exposes the following members.

Name | Description | |
---|---|---|
![]() | ElementAdderMenuCommandAttribute |
Initializes a new instance of the ElementAdderMenuCommandAttribute class.
|

Name | Description | |
---|---|---|
![]() | Equals | Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute.) |
![]() | GetHashCode | Returns the hash code for this instance. (Inherited from Attribute.) |
![]() | IsDefaultAttribute | When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class. (Inherited from Attribute.) |
![]() | Match | When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.) |

Name | Description | |
---|---|---|
![]() | ContractType |
Gets the contract type of addable elements.
|
![]() | TypeId | When implemented in a derived class, gets a unique identifier for this Attribute. (Inherited from Attribute.) |

The following source code demonstrates how to add a helper menu command to the add element menu of a shopping list:
[ElementAdderMenuCommand(typeof(ShoppingItem))] public class AddFavoriteShoppingItemsCommand : IElementAdderMenuCommand<ShoppingList> { public AddFavoriteShoppingItemsCommand() { Content = new GUIContent("Add Favorite Items"); } public GUIContent Content { get; private set; } public bool CanExecute(IElementAdder<ShoppingList> elementAdder) { return true; } public void Execute(IElementAdder<ShoppingList> elementAdder) { // TODO: Add favorite items to the shopping list! } }
@ElementAdderMenuCommand(ShoppingItem) class AddFavoriteShoppingItemsCommand extends IElementAdderMenuCommand.<ShoppingList> { var _content:GUIContent = new GUIContent('Add Favorite Items'); function get Content():GUIContent { return _content; } function CanExecute(elementAdder:IElementAdder.<ShoppingList>):boolean { return true; } function Execute(elementAdder:IElementAdder.<ShoppingList>) { // TODO: Add favorite items to the shopping list! } }
