public void RaiseCustomEvent(CustomEvent customEvent, System.Object param) { if (RootTreeView.OnItemCustomEvent != null) { RootTreeView.OnItemCustomEvent(this, customEvent, param); } }
void OnCollapseing() { if (RootTreeView.OnItemCollapsing != null) { RootTreeView.OnItemCollapsing(this); } }
void OnExpanding() { if (RootTreeView.OnItemExpanding != null) { RootTreeView.OnItemExpanding(this); } }
// This method is used to insert a new item to a TreeList at itemIndex Pos. //All the child items of a TreeList are indexed from top to bottom starting at 0. //That is to say the top most item of a TreeList is indexed 0 and the right below item is indexed 1. public TreeViewItem InsertItem(int itemIndex, string prefabName = "", System.Object userData = null) { if (itemIndex < 0 || itemIndex > mTreeItemList.Count) { return(null); } if (string.IsNullOrEmpty(prefabName)) { prefabName = DefaultItemPrefabName; } TreeViewItem tViewItem = mRootTreeView.NewTreeItem(prefabName); InitTreeViewItem(tViewItem); tViewItem.Init(); tViewItem.UserData = userData; mTreeItemList.Insert(itemIndex, tViewItem); ResetAllItemIndex(); tViewItem.OnActived(); UpdateAllItemSiblingIndex(); mNeedReposition = true; if (IsRootTree) { RootTreeView.NeedRepositionView = true; } if (RootTreeView.OnTreeListAddOneItem != null) { RootTreeView.OnTreeListAddOneItem(this); } return(tViewItem); }
//This method is used to append a new item to a TreeList (TreeView is also a TreeList). //prefabName is the name of the item prefab gameobject, and should be one element of the ItemPrefabList in the TreeView. //userData is the custom data of the new created TreeViewItem, and you can get the useData by call TreeViewItem.UserData. public TreeViewItem AppendItem(string prefabName = "", System.Object userData = null) { if (string.IsNullOrEmpty(prefabName)) { prefabName = DefaultItemPrefabName; } TreeViewItem tViewItem = mRootTreeView.NewTreeItem(prefabName); if (tViewItem == null) { Debug.LogError("AppendItem return null "); return(null); } InitTreeViewItem(tViewItem); tViewItem.Init(); tViewItem.UserData = userData; tViewItem.ItemIndex = mTreeItemList.Count; mTreeItemList.Add(tViewItem); tViewItem.OnActived(); UpdateAllItemSiblingIndex(); mNeedReposition = true; if (IsRootTree) { RootTreeView.NeedRepositionView = true; } if (RootTreeView.OnTreeListAddOneItem != null) { RootTreeView.OnTreeListAddOneItem(this); } return(tViewItem); }
void OnCollapseEnd() { SetClipMaskEnable(false); if (RootTreeView.OnItemCollapseEnd != null) { RootTreeView.OnItemCollapseEnd(this); } }
void OnCollapseBegin() { SetClipMaskEnable(true); if (RootTreeView.OnItemCollapseBegin != null) { RootTreeView.OnItemCollapseBegin(this); } }
void OnExpandEnd() { SetClipMaskEnable(false); if (RootTreeView.OnItemExpandEnd != null) { RootTreeView.OnItemExpandEnd(this); } }
void OnExpandBegin() { SetClipMaskEnable(true); if (RootTreeView.OnItemExpandBegin != null) { RootTreeView.OnItemExpandBegin(this); } }
public void DeleteItemByIndex(int itemIndex) { TreeViewItem tItem = GetItemByIndex(itemIndex); if (tItem == null) { return; } mTreeItemList.RemoveAt(itemIndex); ResetAllItemIndex(); tItem.Clear(); mRootTreeView.RecycleTreeItem(tItem); mNeedReposition = true; UpdateAllItemSiblingIndex(); if (IsRootTree) { RootTreeView.NeedRepositionView = true; } if (RootTreeView.OnTreeListDeleteOneItem != null) { RootTreeView.OnTreeListDeleteOneItem(this); } }