//**************************************************************************************************** // //**************************************************************************************************** private void Expand(RECURSE recurse, int paramDepth = -1) { if ((parent != null) && (expanded == false)) { expanded = true; ExpandOverride(); if (itemList != null) { itemList.SetUpdateHierarchy(); } } if (paramDepth < 0) { for (UIListItemData cur = parent; (cur != null) && (cur.parent != null); cur = cur.parent) { parent.Expand(RECURSE.NO, 0); } } if (recurse == RECURSE.YES) { for (int child = 0; child < childs.Count; ++child) { childs[child].Expand(recurse, paramDepth + 1); } } }
//**************************************************************************************************** // //**************************************************************************************************** static public int CompareDescending(UIListItemData a, UIListItemData b) { object A = (a != null) ? a.userDatas : null; object B = (b != null) ? b.userDatas : null; if ((A == null) && (B == null)) { return(0); } if ((A == null) || (B == null)) { return((A != null) ? -1 : 1); } if ((A is Site) ^ (B is Site)) { return((A is Site) ? -1 : 1); } Localizable LocA = A as Localizable; Localizable LocB = B as Localizable; return(LocB.name.CompareTo(LocA.name)); }
//**************************************************************************************************** // //**************************************************************************************************** public Localizable() { Register(this); m_name = defaultName; m_ListItemDatas = new UIListItemData(null, this); }
//**************************************************************************************************** // //**************************************************************************************************** private void SelectItem(int index) { UIListItem item = (index >= 0) ? this[index] : null; UIListItemData data = (item != null) ? item.datas : null; if (data != null) { SelectItemUserDatas(data.userDatas); } }
//**************************************************************************************************** // //**************************************************************************************************** public void SetItemsDatas(UIListItemData root) { Clear(); if ((datasRoot = root) != null) { for (int data = 0; data < root.childs.Count; ++data) { AddItemData(root.childs[data]); } } }
//**************************************************************************************************** // //**************************************************************************************************** public FileSystemEntry(UIListItemData parent, FSFilter paramFilter = null) : base(parent, null) { userDatas = this; dir = false; listDirs = false; listFiles = false; name = string.Empty; path = string.Empty; displayFilter = paramFilter; }
//**************************************************************************************************** // //**************************************************************************************************** private void AddItemData(UIListItemData itemData) { if (itemData != null) { datas.Add(itemData); itemData.itemList = this; if (itemData.expanded) { for (int data = 0; data < itemData.childs.Count; ++data) { AddItemData(itemData.childs[data]); } } } }
//**************************************************************************************************** // //**************************************************************************************************** public void RemoveChild(UIListItemData child) { if (child == null) { return; } if (child.parent != this) { return; } childs.Remove(child); child.parent = null; child.depth = -1; }
//**************************************************************************************************** // //**************************************************************************************************** public void AddChild(UIListItemData child) { if (child == null) { return; } if (child.parent != null) { return; } childs.Add(child); child.parent = this; child.depth = depth + 1; }
//**************************************************************************************************** // //**************************************************************************************************** public UIListItemData(UIListItemData paramParent, object paramUserDatas) { itemList = null; depth = -1; expanded = false; userDatas = paramUserDatas; parent = null; childs = new List <UIListItemData>(); if (paramParent != null) { paramParent.AddChild(this); } }