public virtual void SetTraget(ItemContainer item) { gameObject.SetActive(item != null); m_item = item; if(m_item == null) { Action = ItemDropAction.None; } }
public override void SetTraget(ItemContainer item) { base.SetTraget(item); if(item == null) { return; } TreeViewItem tvItem = (TreeViewItem)item; if(tvItem != null) { m_siblingGraphicsRectTransform.offsetMin = new Vector2(tvItem.Indent, m_siblingGraphicsRectTransform.offsetMin.y); } else { m_siblingGraphicsRectTransform.offsetMin = new Vector2(0, m_siblingGraphicsRectTransform.offsetMin.y); } }
protected override void Drop( ItemContainer[] dragItems, ItemContainer dropTarget, ItemDropAction action) { TreeViewItem treeViewItem = (TreeViewItem)dropTarget; switch (action) { case ItemDropAction.SetLastChild: for (int index = 0; index < dragItems.Length; ++index) { TreeViewItem dragItem = (TreeViewItem)dragItems[index]; if (Object.op_Inequality((Object)treeViewItem, (Object)dragItem)) { dragItem.Parent = treeViewItem; } } break; case ItemDropAction.SetPrevSibling: for (int index = 0; index < dragItems.Length; ++index) { this.SetPrevSibling((ItemContainer)treeViewItem, dragItems[index]); } break; case ItemDropAction.SetNextSibling: for (int index = dragItems.Length - 1; index >= 0; --index) { this.SetNextSibling((ItemContainer)treeViewItem, dragItems[index]); } break; } this.UpdateSelectedItemIndex(); }
public void ChangeParent(object parent, object item) { if (this.IsDropInProgress) { return; } ItemContainer itemContainer1 = this.GetItemContainer(item); if (Object.op_Equality((Object)itemContainer1, (Object)null)) { return; } ItemContainer itemContainer2 = this.GetItemContainer(parent); ItemContainer[] dragItems = new ItemContainer[1] { itemContainer1 }; if (!this.CanDrop(dragItems, itemContainer2)) { return; } this.Drop(dragItems, itemContainer2, ItemDropAction.SetLastChild); }