Interface IElementAdderMenuBuilder<TContext>
Interface for building an IElementAdderMenu.
Namespace: Unity.VisualScripting.ReorderableList.Element_Adder_Menu
Syntax
public interface IElementAdderMenuBuilder<TContext>
Type Parameters
Name | Description |
---|---|
TContext | Type of the context object that elements can be added to. |
Methods
AddCustomCommand(IElementAdderMenuCommand<TContext>)
Adds a custom command to the menu.
Declaration
void AddCustomCommand(IElementAdderMenuCommand<TContext> command)
Parameters
Type | Name | Description |
---|---|---|
IElementAdderMenuCommand<TContext> | command | The custom command. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
AddTypeFilter(Func<Type, Boolean>)
Adds a filter function which determines whether types can be included or whether they need to be excluded.
Declaration
void AddTypeFilter(Func<Type, bool> typeFilter)
Parameters
Type | Name | Description |
---|---|---|
Func<Type, Boolean> | typeFilter | Filter function. |
Remarks
If a filter function returns a value of false
then that type
will not be included in the menu interface.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
GetMenu()
Builds and returns a new IElementAdderMenu instance.
Declaration
IElementAdderMenu GetMenu()
Returns
Type | Description |
---|---|
IElementAdderMenu | A new IElementAdderMenu instance each time the method is invoked. |
SetContractType(Type)
Sets contract type of the elements that can be included in the IElementAdderMenu.
Only non-abstract class types that are assignable from the contractType
will be included in the built menu.
Declaration
void SetContractType(Type contractType)
Parameters
Type | Name | Description |
---|---|---|
Type | contractType | Contract type of addable elements. |
SetElementAdder(IElementAdder<TContext>)
Set the IElementAdder<TContext> implementation which is used when adding new elements to the context object.
Declaration
void SetElementAdder(IElementAdder<TContext> elementAdder)
Parameters
Type | Name | Description |
---|---|---|
IElementAdder<TContext> | elementAdder | Element adder. |
Remarks
Specify a value of null
for elementAdder
to
prevent the selection of any types.
SetTypeDisplayNameFormatter(Func<Type, String>)
Set the function that formats the display of type names in the user interface.
Declaration
void SetTypeDisplayNameFormatter(Func<Type, string> formatter)
Parameters
Type | Name | Description |
---|---|---|
Func<Type, String> | formatter | Function that formats display name of type; or |
Remarks
Specify a value of null
for formatter
to
assume the default formatting function.