ElementAdderMenuCommandAttribute Class |
Namespace: Rotorz.ReorderableList
public sealed class ElementAdderMenuCommandAttribute : 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! } }