protected void MoveItem(IReorderableListAdaptor adaptor, int sourceIndex, int destIndex)
{
// Raise event before moving item so that the operation can be cancelled.
var movingEventArgs = new ItemMovingEventArgs(adaptor, sourceIndex, destIndex);
OnItemMoving(movingEventArgs);
if (!movingEventArgs.Cancel) {
adaptor.Move(sourceIndex, destIndex);
// Item was actually moved!
int newIndex = destIndex;
if (newIndex > sourceIndex)
--newIndex;
OnItemMoved(new ItemMovedEventArgs(adaptor, sourceIndex, newIndex));
GUI.changed = true;
}
ReorderableListGUI.IndexOfChangedItem = -1;
}