NotifyParent() public method

Internal method for notifying the gui element of it's parent and ultimate overlay.
public NotifyParent ( OverlayElementContainer parent, Overlay overlay ) : void
parent OverlayElementContainer Parent of this element.
overlay Overlay Overlay this element belongs to.
return void
        /// <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);
        }
Ejemplo n.º 3
0
		/// <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();
		}