/// <summary> /// Add a child component to this panel /// </summary> /// <param name="comp"></param> public virtual void Add(G3DComponent comp) { if (comp != null && !children.Contains(comp)) { comp.Parent = this; comp.Transparency = alpha; children.Add(comp); G3DPanel root = (G3DPanel)comp.RootParent; //InvokeComponentAddedEvent(this, comp); } }
/// <summary> /// Remove a child component from this panel if already added /// </summary> /// <param name="comp"></param> /// <returns></returns> public virtual bool Remove(G3DComponent comp) { bool removed = children.Remove(comp); if (removed) { comp.Parent = null; //InvokeComponentRemovedEvent(this, comp); } return(removed); }
/// <summary> /// Get the parent right before reaching the root /// </summary> /// <param name="comp"></param> /// <returns></returns> protected virtual G3DPanel GetPreRootParent(G3DComponent comp) { if (comp.HasParent && ((G3DPanel)comp.Parent).HasParent) { return(GetPreRootParent((G3DComponent)comp.Parent)); } else { if (comp is G3DPanel) { return((G3DPanel)comp); } else { return(null); } } }
/// <summary> /// Removes a 3D UI component from the rendering process. /// </summary> /// <param name="comp3d"></param> internal void Remove3DComponent(G3DComponent comp3d) { comp3Ds.Remove(comp3d); }
/// <summary> /// Adds a 3D UI component to be rendered in the scene. /// </summary> /// <remarks>You should only add top-level components that do not have a parent component.</remarks> /// <param name="comp3d">A top-level G3DComponent object</param> internal void Add3DComponent(G3DComponent comp3d) { if (!comp3Ds.Contains(comp3d)) comp3Ds.Add(comp3d); }
/// <summary> /// Get the parent right before reaching the root /// </summary> /// <param name="comp"></param> /// <returns></returns> protected virtual G3DPanel GetPreRootParent(G3DComponent comp) { if (comp.HasParent && ((G3DPanel)comp.Parent).HasParent) return GetPreRootParent((G3DComponent)comp.Parent); else { if (comp is G3DPanel) return (G3DPanel)comp; else return null; } }
/// <summary> /// Remove a child component from this panel if already added /// </summary> /// <param name="comp"></param> /// <returns></returns> public virtual bool Remove(G3DComponent comp) { bool removed = children.Remove(comp); if (removed) { comp.Parent = null; //InvokeComponentRemovedEvent(this, comp); } return removed; }