Interface IReorderableListAdaptor
Adaptor allowing reorderable list control to interface with list data.
Namespace: Unity.VisualScripting.ReorderableList
Syntax
public interface IReorderableListAdaptor
Properties
Count
Gets count of elements in list.
Declaration
int Count { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
Add()
Add new element at end of list.
Declaration
void Add()
BeginGUI()
Occurs before any list items are drawn.
Declaration
void BeginGUI()
Remarks
This method is only used to handle GUI repaint events.
CanDrag(Int32)
Determines whether an item can be reordered by dragging mouse.
Declaration
bool CanDrag(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Zero-based index for list element. |
Returns
Type | Description |
---|---|
Boolean | A value of |
Remarks
This should be a light-weight method since it will be used to determine whether grab handle should be included for each item in a reorderable list.
Please note that returning a value of false
does not prevent movement
on list item since other draggable items can be moved around it.
CanRemove(Int32)
Determines whether an item can be removed from list.
Declaration
bool CanRemove(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Zero-based index for list element. |
Returns
Type | Description |
---|---|
Boolean | A value of |
Remarks
This should be a light-weight method since it will be used to determine whether remove button should be included for each item in list.
This is redundant when HideRemoveButtons is specified.
Clear()
Clear all elements from list.
Declaration
void Clear()
DrawItem(Rect, Int32)
Draws main interface for a list item.
Declaration
void DrawItem(Rect position, int index)
Parameters
Type | Name | Description |
---|---|---|
Rect | position | Position in GUI. |
Int32 | index | Zero-based index of array element. |
Remarks
This method is used to handle all GUI events.
DrawItemBackground(Rect, Int32)
Draws background of a list item.
Declaration
void DrawItemBackground(Rect position, int index)
Parameters
Type | Name | Description |
---|---|---|
Rect | position | Total position of list element in GUI. |
Int32 | index | Zero-based index of array element. |
Remarks
This method is only used to handle GUI repaint events.
Background of list item spans a slightly larger area than the main interface that is drawn by DrawItem(Rect, Int32) since it is drawn behind the grab handle.
Duplicate(Int32)
Duplicate existing element.
Declaration
void Duplicate(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Zero-based index of list element. |
Remarks
Consider using the ICloneable interface to duplicate list elements where appropriate.
EndGUI()
Occurs after all list items have been drawn.
Declaration
void EndGUI()
Remarks
This method is only used to handle GUI repaint events.
GetItemHeight(Int32)
Gets height of list item in pixels.
Declaration
float GetItemHeight(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Zero-based index of array element. |
Returns
Type | Description |
---|---|
Single | Measurement in pixels. |
Insert(Int32)
Insert new element at specified index.
Declaration
void Insert(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Zero-based index for list element. |
Move(Int32, Int32)
Move element from source index to destination index.
Declaration
void Move(int sourceIndex, int destIndex)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sourceIndex | Zero-based index of source element. |
Int32 | destIndex | Zero-based index of destination element. |
Remove(Int32)
Remove element at specified index.
Declaration
void Remove(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Zero-based index of list element. |