C# Класс Borodar.ReorderableList.ReorderableListControl

Base class for custom reorderable list control.
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
AnchorBackgroundColor UnityEngine.Color
TargetBackgroundColor UnityEngine.Color

Защищенные свойства (Protected)

Свойство Тип Описание
CommandClearAll UnityEngine.GUIContent
CommandDuplicate UnityEngine.GUIContent
CommandInsertAbove UnityEngine.GUIContent
CommandInsertBelow UnityEngine.GUIContent
CommandMoveToBottom UnityEngine.GUIContent
CommandMoveToTop UnityEngine.GUIContent
CommandRemove UnityEngine.GUIContent
DefaultContextHandler GenericMenu.MenuFunction2

Private Properties

Свойство Тип Описание
AcceptReorderDrag void
AutoFocusItem void
AutoScrollTowardsMouse void
BeginTrackingReorderDrag void
CheckForAutoFocusControl void
ContainsRect bool
CountDigits int
DefaultContextMenuHandler void
DoRemoveButton bool
Draw void
Draw void
DrawEmptyListControl void
DrawFloatingListItem void
DrawFooterControls void
DrawLayoutEmptyList UnityEngine.Rect
DrawLayoutListField UnityEngine.Rect
DrawListContainerAndItems void
DrawListItem void
FixStyles void
GetListRectWithAutoLayout UnityEngine.Rect
GetReorderableListControlID int
HandleDropInsertion void
IsTrackingControl bool
PrepareState void
ReorderableListControl System.Collections.Generic
ShowContextMenu void
StopTrackingReorderDrag void

Открытые методы

Метод Описание
CalculateListHeight ( IReorderableListAdaptor adaptor ) : float

Calculate height of list control in pixels.

CalculateListHeight ( int itemCount, float itemHeight ) : float

Calculate height of list control in pixels.

DoCommand ( GUIContent command, int itemIndex, IReorderableListAdaptor adaptor ) : bool

Call to manually perform command.

Warning message is logged to console if attempted to execute unknown command.

DoCommand ( string commandName, int itemIndex, IReorderableListAdaptor adaptor ) : bool

Call to manually perform command.

Warning message is logged to console if attempted to execute unknown command.

Draw ( IReorderableListAdaptor adaptor ) : void
Draw ( IReorderableListAdaptor adaptor, DrawEmpty drawEmpty ) : void
Draw ( Rect position, IReorderableListAdaptor adaptor ) : void
Draw ( Rect position, IReorderableListAdaptor adaptor, DrawEmptyAbsolute drawEmpty ) : void

Draw list control with absolute positioning.

DrawControlFromState ( IReorderableListAdaptor adaptor, DrawEmpty drawEmpty, ReorderableListFlags flags ) : void

Generate and draw control from state object.

DrawControlFromState ( Rect position, IReorderableListAdaptor adaptor, DrawEmptyAbsolute drawEmpty, ReorderableListFlags flags ) : void

Generate and draw control from state object.

ReorderableListControl ( ReorderableListFlags flags ) : System.Collections.Generic

Initializes a new instance of ReorderableListControl.

Защищенные методы

Метод Описание
AddItem ( IReorderableListAdaptor adaptor ) : void

Add item at end of list and raises the event ItemInserted.

AddItemsToMenu ( GenericMenu menu, int itemIndex, IReorderableListAdaptor adaptor ) : void

Invoked to generate context menu for list item.

ClearAll ( IReorderableListAdaptor adaptor ) : bool

Remove all items from list.

The event ItemRemoving is raised for each item prior to clearing array and allows entire operation to be cancelled.

DrawDropIndicator ( Rect position ) : void

Draws drop insertion indicator.

This method is only ever called during repaint events.

DuplicateItem ( IReorderableListAdaptor adaptor, int itemIndex ) : void

Duplicate specified item and raises the event ItemInserted.

HandleCommand ( string commandName, int itemIndex, IReorderableListAdaptor adaptor ) : bool

Invoked to handle context command.

It is important to set the value of GUI.changed to true if any changes are made by command handler.

Default command handling functionality can be inherited:

InsertItem ( IReorderableListAdaptor adaptor, int itemIndex ) : void

Insert item at specified index and raises the event ItemInserted.

MoveItem ( IReorderableListAdaptor adaptor, int sourceIndex, int destIndex ) : void

Move item from source index to destination index.

OnAddMenuClicked ( AddMenuClickedEventArgs args ) : void

Raises event when add menu button is clicked.

OnItemInserted ( ItemInsertedEventArgs args ) : void

Raises event after list item is inserted or duplicated.

OnItemMoved ( ItemMovedEventArgs args ) : void

Raises event after list item has been moved.

OnItemMoving ( ItemMovingEventArgs args ) : void

Raises event immediately before list item is moved and provides oppertunity to cancel.

OnItemRemoving ( ItemRemovingEventArgs args ) : void

Raises event before list item is removed and provides oppertunity to cancel.

RemoveItem ( IReorderableListAdaptor adaptor, int itemIndex ) : bool

Remove specified item.

The event ItemRemoving is raised prior to removing item and allows removal to be cancelled.

Приватные методы

Метод Описание
AcceptReorderDrag ( IReorderableListAdaptor adaptor ) : void

Accept reordering.

AutoFocusItem ( int controlID, int itemIndex ) : void

Indicate that first control of list item should be automatically focused if possible.

AutoScrollTowardsMouse ( ) : void
BeginTrackingReorderDrag ( int controlID, int itemIndex ) : void

Begin tracking drag and drop within list.

CheckForAutoFocusControl ( ) : void

Checks to see if list control needs to be automatically focused.

ContainsRect ( Rect a, Rect b ) : bool
CountDigits ( int number ) : int
DefaultContextMenuHandler ( object userData ) : void
DoRemoveButton ( Rect position, bool visible ) : bool

Draw remove button.

Draw ( Rect position, int controlID, IReorderableListAdaptor adaptor, DrawEmptyAbsolute drawEmpty ) : void

Draw list control with absolute positioning.

Draw ( int controlID, IReorderableListAdaptor adaptor, DrawEmpty drawEmpty ) : void

Draw layout version of list control.

DrawEmptyListControl ( Rect position, DrawEmptyAbsolute drawEmpty ) : void

Draw content for empty list (layout version).

DrawFloatingListItem ( IReorderableListAdaptor adaptor, float targetSlotPosition ) : void
DrawFooterControls ( Rect position, IReorderableListAdaptor adaptor ) : void

Draw additional controls below list control and highlight drop target.

DrawLayoutEmptyList ( IReorderableListAdaptor adaptor, DrawEmpty drawEmpty ) : Rect

Draw content for empty list (layout version).

DrawLayoutListField ( IReorderableListAdaptor adaptor, float padding ) : Rect

Do layout version of list field.

DrawListContainerAndItems ( Rect position, IReorderableListAdaptor adaptor ) : void

Draw list container and items.

DrawListItem ( Rect position, IReorderableListAdaptor adaptor, int itemIndex ) : void
FixStyles ( ) : void

Correct if for some reason one or more styles are missing!

GetListRectWithAutoLayout ( IReorderableListAdaptor adaptor, float padding ) : Rect
GetReorderableListControlID ( ) : int
HandleDropInsertion ( Rect position, IReorderableListAdaptor adaptor ) : void
IsTrackingControl ( int controlID ) : bool

Gets a value indicating whether item in current list is currently being tracked.

PrepareState ( int controlID, IReorderableListAdaptor adaptor ) : void

Prepare initial state for list control.

ReorderableListControl ( ) : System.Collections.Generic
ShowContextMenu ( int itemIndex, IReorderableListAdaptor adaptor ) : void
StopTrackingReorderDrag ( ) : void

Stop tracking drag and drop.

Описание методов

AddItem() защищенный Метод

Add item at end of list and raises the event ItemInserted.
protected AddItem ( IReorderableListAdaptor adaptor ) : void
adaptor IReorderableListAdaptor Reorderable list adaptor.
Результат void

AddItemsToMenu() защищенный Метод

Invoked to generate context menu for list item.
protected AddItemsToMenu ( GenericMenu menu, int itemIndex, IReorderableListAdaptor adaptor ) : void
menu UnityEditor.GenericMenu Menu which can be populated.
itemIndex int Zero-based index of item which was right-clicked.
adaptor IReorderableListAdaptor Reorderable list adaptor.
Результат void

CalculateListHeight() публичный Метод

Calculate height of list control in pixels.
public CalculateListHeight ( IReorderableListAdaptor adaptor ) : float
adaptor IReorderableListAdaptor Reorderable list adaptor.
Результат float

CalculateListHeight() публичный Метод

Calculate height of list control in pixels.
public CalculateListHeight ( int itemCount, float itemHeight ) : float
itemCount int Count of items in list.
itemHeight float Fixed height of list item.
Результат float

ClearAll() защищенный Метод

Remove all items from list.

The event ItemRemoving is raised for each item prior to clearing array and allows entire operation to be cancelled.

protected ClearAll ( IReorderableListAdaptor adaptor ) : bool
adaptor IReorderableListAdaptor Reorderable list adaptor.
Результат bool

DoCommand() публичный Метод

Call to manually perform command.

Warning message is logged to console if attempted to execute unknown command.

public DoCommand ( GUIContent command, int itemIndex, IReorderableListAdaptor adaptor ) : bool
command UnityEngine.GUIContent Content representing command.
itemIndex int Zero-based index of item which was right-clicked.
adaptor IReorderableListAdaptor Reorderable list adaptor.
Результат bool

DoCommand() публичный Метод

Call to manually perform command.

Warning message is logged to console if attempted to execute unknown command.

public DoCommand ( string commandName, int itemIndex, IReorderableListAdaptor adaptor ) : bool
commandName string Name of command. This is the text shown in the context menu.
itemIndex int Zero-based index of item which was right-clicked.
adaptor IReorderableListAdaptor Reorderable list adaptor.
Результат bool

Draw() публичный Метод

public Draw ( IReorderableListAdaptor adaptor ) : void
adaptor IReorderableListAdaptor
Результат void

Draw() публичный Метод

public Draw ( IReorderableListAdaptor adaptor, DrawEmpty drawEmpty ) : void
adaptor IReorderableListAdaptor
drawEmpty DrawEmpty
Результат void

Draw() публичный Метод

public Draw ( Rect position, IReorderableListAdaptor adaptor ) : void
position UnityEngine.Rect
adaptor IReorderableListAdaptor
Результат void

Draw() публичный Метод

Draw list control with absolute positioning.
public Draw ( Rect position, IReorderableListAdaptor adaptor, DrawEmptyAbsolute drawEmpty ) : void
position UnityEngine.Rect Position of list control in GUI.
adaptor IReorderableListAdaptor Reorderable list adaptor.
drawEmpty DrawEmptyAbsolute Delegate for drawing empty list.
Результат void

DrawControlFromState() публичный статический Метод

Generate and draw control from state object.
public static DrawControlFromState ( IReorderableListAdaptor adaptor, DrawEmpty drawEmpty, ReorderableListFlags flags ) : void
adaptor IReorderableListAdaptor Reorderable list adaptor.
drawEmpty DrawEmpty Delegate for drawing empty list.
flags ReorderableListFlags Optional flags to pass into list field.
Результат void

DrawControlFromState() публичный статический Метод

Generate and draw control from state object.
public static DrawControlFromState ( Rect position, IReorderableListAdaptor adaptor, DrawEmptyAbsolute drawEmpty, ReorderableListFlags flags ) : void
position UnityEngine.Rect Position of control.
adaptor IReorderableListAdaptor Reorderable list adaptor.
drawEmpty DrawEmptyAbsolute Delegate for drawing empty list.
flags ReorderableListFlags Optional flags to pass into list field.
Результат void

DrawDropIndicator() защищенный Метод

Draws drop insertion indicator.

This method is only ever called during repaint events.

protected DrawDropIndicator ( Rect position ) : void
position UnityEngine.Rect Position if the drop indicator.
Результат void

DuplicateItem() защищенный Метод

Duplicate specified item and raises the event ItemInserted.
protected DuplicateItem ( IReorderableListAdaptor adaptor, int itemIndex ) : void
adaptor IReorderableListAdaptor Reorderable list adaptor.
itemIndex int Zero-based index of item.
Результат void

HandleCommand() защищенный Метод

Invoked to handle context command.

It is important to set the value of GUI.changed to true if any changes are made by command handler.

Default command handling functionality can be inherited:

protected HandleCommand ( string commandName, int itemIndex, IReorderableListAdaptor adaptor ) : bool
commandName string Name of command. This is the text shown in the context menu.
itemIndex int Zero-based index of item which was right-clicked.
adaptor IReorderableListAdaptor Reorderable list adaptor.
Результат bool

InsertItem() защищенный Метод

Insert item at specified index and raises the event ItemInserted.
protected InsertItem ( IReorderableListAdaptor adaptor, int itemIndex ) : void
adaptor IReorderableListAdaptor Reorderable list adaptor.
itemIndex int Zero-based index of item.
Результат void

MoveItem() защищенный Метод

Move item from source index to destination index.
protected MoveItem ( IReorderableListAdaptor adaptor, int sourceIndex, int destIndex ) : void
adaptor IReorderableListAdaptor Reorderable list adaptor.
sourceIndex int Zero-based index of source item.
destIndex int Zero-based index of destination index.
Результат void

OnAddMenuClicked() защищенный Метод

Raises event when add menu button is clicked.
protected OnAddMenuClicked ( AddMenuClickedEventArgs args ) : void
args AddMenuClickedEventArgs Event arguments.
Результат void

OnItemInserted() защищенный Метод

Raises event after list item is inserted or duplicated.
protected OnItemInserted ( ItemInsertedEventArgs args ) : void
args ItemInsertedEventArgs Event arguments.
Результат void

OnItemMoved() защищенный Метод

Raises event after list item has been moved.
protected OnItemMoved ( ItemMovedEventArgs args ) : void
args ItemMovedEventArgs Event arguments.
Результат void

OnItemMoving() защищенный Метод

Raises event immediately before list item is moved and provides oppertunity to cancel.
protected OnItemMoving ( ItemMovingEventArgs args ) : void
args ItemMovingEventArgs Event arguments.
Результат void

OnItemRemoving() защищенный Метод

Raises event before list item is removed and provides oppertunity to cancel.
protected OnItemRemoving ( ItemRemovingEventArgs args ) : void
args ItemRemovingEventArgs Event arguments.
Результат void

RemoveItem() защищенный Метод

Remove specified item.

The event ItemRemoving is raised prior to removing item and allows removal to be cancelled.

protected RemoveItem ( IReorderableListAdaptor adaptor, int itemIndex ) : bool
adaptor IReorderableListAdaptor Reorderable list adaptor.
itemIndex int Zero-based index of item.
Результат bool

ReorderableListControl() публичный Метод

Initializes a new instance of ReorderableListControl.
public ReorderableListControl ( ReorderableListFlags flags ) : System.Collections.Generic
flags ReorderableListFlags Optional flags which affect behavior of control.
Результат System.Collections.Generic

Описание свойств

AnchorBackgroundColor публичное статическое свойство

Background color of anchor list item.
public static Color,UnityEngine AnchorBackgroundColor
Результат UnityEngine.Color

CommandClearAll защищенное статическое свойство

Content for "Clear All" command.
protected static GUIContent,UnityEngine CommandClearAll
Результат UnityEngine.GUIContent

CommandDuplicate защищенное статическое свойство

Content for "Duplicate" command.
protected static GUIContent,UnityEngine CommandDuplicate
Результат UnityEngine.GUIContent

CommandInsertAbove защищенное статическое свойство

Content for "Insert Above" command.
protected static GUIContent,UnityEngine CommandInsertAbove
Результат UnityEngine.GUIContent

CommandInsertBelow защищенное статическое свойство

Content for "Insert Below" command.
protected static GUIContent,UnityEngine CommandInsertBelow
Результат UnityEngine.GUIContent

CommandMoveToBottom защищенное статическое свойство

Content for "Move to Bottom" command.
protected static GUIContent,UnityEngine CommandMoveToBottom
Результат UnityEngine.GUIContent

CommandMoveToTop защищенное статическое свойство

Content for "Move to Top" command.
protected static GUIContent,UnityEngine CommandMoveToTop
Результат UnityEngine.GUIContent

CommandRemove защищенное статическое свойство

Content for "Remove" command.
protected static GUIContent,UnityEngine CommandRemove
Результат UnityEngine.GUIContent

DefaultContextHandler защищенное статическое свойство

Default functionality to handle context command.
protected static GenericMenu.MenuFunction2 DefaultContextHandler
Результат GenericMenu.MenuFunction2

TargetBackgroundColor публичное статическое свойство

Background color of target slot when dragging list item.
public static Color,UnityEngine TargetBackgroundColor
Результат UnityEngine.Color