NotifyZOrder() public method

Internal method to notify the element when Zorder of parent overlay has changed.
Overlays have explicit Z orders. OverlayElements do not, they inherit the ZOrder of the overlay, and the Zorder is incremented for every container nested within this to ensure that containers are displayed behind contained items. This method is used internally to notify the element of a change in final zorder which is used to render the element.
public NotifyZOrder ( int zOrder ) : int
zOrder int The z order.
return int
        /// <summary>
        ///    Adds another OverlayElement to this container.
        /// </summary>
        /// <param name="element"></param>
        public virtual void AddChildImpl(OverlayElement element)
        {
            Debug.Assert(!children.ContainsKey(element.Name), string.Format("Child with name '{0}' already defined.", element.Name));

            // add to lookup table and list
            children.Add(element.Name, element);
            childList.Add(element);

            // inform this child about his/her parent and zorder
            element.NotifyParent(this, overlay);
            element.NotifyZOrder(zOrder + 1);
        }
        /// <summary>
        ///    Add a nested container to this container.
        /// </summary>
        /// <param name="container"></param>
        public virtual void AddChildImpl(OverlayElementContainer container)
        {
            // add this container to the main child list first
            OverlayElement element = container;

            AddChildImpl(element);
            element.NotifyParent(this, overlay);
            element.NotifyZOrder(zOrder + 1);

            // inform container children of the current overlay
            // *gasp* it's a foreach!  this isn't a time critical method anyway
            foreach (OverlayElement child in container.children)
            {
                child.NotifyParent(container, overlay);
                child.NotifyZOrder(container.ZOrder + 1);
            }

            // now add the container to the container collection
            childContainers.Add(container.Name, container);
        }
		/// <summary>
		///    Adds another OverlayElement to this container.
		/// </summary>
		/// <param name="element"></param>
		public virtual void AddChildElement( OverlayElement element )
		{
			Debug.Assert( !this.children.ContainsKey( element.Name ),
			              string.Format( "Child with name '{0}' already defined.", element.Name ) );

			// add to lookup table and list
			this.children.Add( element.Name, element );

			// inform this child about his/her parent and zorder
			element.NotifyParent( this, overlay );
			element.NotifyZOrder( zOrder + 1 );
			element.NotifyWorldTransforms( xform );
			element.NotifyViewport();
		}