/// <summary> /// Adds a 2d element to this overlay. /// </summary> /// <remarks> /// Containers are created and managed using the GuiManager. A container /// could be as simple as a square panel, or something more complex like /// a grid or tree view. Containers group collections of other elements, /// giving them a relative coordinate space and a common z-order. /// If you want to attach a gui widget to an overlay, you have to do it via /// a container. /// </remarks> /// <param name="element"></param> public void AddElement(OverlayElementContainer element) { elementList.Add(element); elementLookup.Add(element.Name, element); // notify the parent element.NotifyParent(null, this); // Set Z order, scaled to separate overlays // max 100 container levels per overlay, should be plenty element.NotifyZOrder(zOrder * 100); }
/// <summary> /// Removes a 2D container from the overlay. /// </summary> /// <remarks> /// Consider using <see>Hide</see>. /// </remarks> /// <param name="element"></param> public void RemoveElement(OverlayElementContainer element) { if (this.elementList.Contains(element)) { this.elementList.Remove(element); } if (this.elementLookup.ContainsKey(element.Name)) { this.elementLookup.Remove(element.Name); } AssignZOrders(); element.NotifyParent(null, null); }
/// <summary> /// Adds a 2d element to this overlay. /// </summary> /// <remarks> /// Containers are created and managed using the OverlayManager. A container /// could be as simple as a square panel, or something more complex like /// a grid or tree view. Containers group collections of other elements, /// giving them a relative coordinate space and a common z-order. /// If you want to attach a gui widget to an overlay, you have to do it via /// a container. /// </remarks> /// <param name="element"></param> public void AddElement(OverlayElementContainer element) { this.elementList.Add(element); this.elementLookup.Add(element.Name, element); // notify the parent element.NotifyParent(null, this); AssignZOrders(); GetWorldTransforms(this.xform); element.NotifyWorldTransforms(this.xform); element.NotifyViewport(); }
/// <summary> /// Removes a 2D container from the overlay. /// </summary> /// <remarks> /// Consider using <see>Hide</see>. /// </remarks> /// <param name="element"></param> public void RemoveElement( OverlayElementContainer element ) { if ( this.elementList.Contains( element ) ) { this.elementList.Remove( element ); } if ( this.elementLookup.ContainsKey( element.Name ) ) { this.elementLookup.Remove( element.Name ); } AssignZOrders(); element.NotifyParent( null, null ); }
/// <summary> /// Adds a 2d element to this overlay. /// </summary> /// <remarks> /// Containers are created and managed using the OverlayManager. A container /// could be as simple as a square panel, or something more complex like /// a grid or tree view. Containers group collections of other elements, /// giving them a relative coordinate space and a common z-order. /// If you want to attach a gui widget to an overlay, you have to do it via /// a container. /// </remarks> /// <param name="element"></param> public void AddElement( OverlayElementContainer element ) { this.elementList.Add( element ); this.elementLookup.Add( element.Name, element ); // notify the parent element.NotifyParent( null, this ); AssignZOrders(); GetWorldTransforms( this.xform ); element.NotifyWorldTransforms( this.xform ); element.NotifyViewport(); }