public void SetParent(HItem item) { if (item != null) { // Return if the parent already has this as a child if (item.childs.Contains(this)) { return; } item.AddChild(this); parent = item; } else { // Return if we already have no other parent if (parent == null) { return; } parent.RemoveChild(this); parent = null; } }
public void RemoveChild(HItem item) { childs.Remove(item); }
public void AddChild(HItem item) { childs.Add(item); }