/// <summary> /// Adds the child. /// </summary> /// <param name="element">The element.</param> public virtual void AddChild(UPMElement element) { if (element != null) { element.Parent = this; this.Children.Add(element); } this.GUIContainer?.ChildrenAdded(element); }
/// <summary> /// Adds the child. /// </summary> /// <param name="element">The element.</param> public virtual void RemoveChild(UPMElement element) { if (element != null) { if (this.Children.Contains(element)) { this.Children.Remove(element); } } this.GUIContainer?.ChildrenRemoved(element); }
/// <summary> /// Inserts the index of the child at. /// </summary> /// <param name="element">The element.</param> /// <param name="index">The index.</param> public void InsertChildAtIndex(UPMElement element, int index) { if (element == null) { return; } this.Children?.Insert(index, element); // element.Parent = this; this.GUIContainer?.ChildrenAddedAtIndex(element, index); }
/// <summary> /// Indexes the of child. /// </summary> /// <param name="element">The element.</param> /// <returns></returns> public int IndexOfChild(UPMElement element) => this.Children?.IndexOf(element) ?? -1;