Exemplo n.º 1
0
 /// <summary>
 /// Adds a child DisplayObject to this DisplayObjectContainer.
 /// </summary>
 /// <param name="child">DisplayObject to add.</param>
 public void AddChild(DisplayObject child)
 {
     AddChildAt(-1, child);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a child DisplayObject to this DisplayObjectContainer at a specific index.
        /// </summary>
        /// <param name="index"></param>
        /// <param name="child"></param>
        public void AddChildAt(int index, DisplayObject child)
        {
            if (child.Name == null)
                child.Name = "instance" + _displayList.Count;

            if (!_displayList.Contains(child))
            {
                child.Parent = this;

                if (AutoHeight)
                {
                    int maxY = child.Y + child.Height;
                    if (maxY > Height)
                        Height = maxY;
                }

                // Pass the reference to child display object containers
                if (child is DisplayObjectContainer)
                    ((DisplayObjectContainer)child).Graphics = Graphics;

                if (index == -1 || index > _displayList.Count - 1)
                    _displayList.Add(child);
                else
                    _displayList.Insert(index, child);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Removes the specified child DisplayObject from this DisplayObjectContainer.
 /// </summary>
 /// <param name="child">DisplayObject to remove.</param>
 public void RemoveChild(DisplayObject child)
 {
     if (_displayList.Contains(child))
         _displayList.Remove(child);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Returns whether this container contains a child DisplayObject.
 /// </summary>
 /// <param name="child">DisplayObject to find.</param>
 /// <returns></returns>
 public bool Contains(DisplayObject child)
 {
     return _displayList.Contains(child);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Flushes the rectangular area the DisplayObject occupies to the screen.
 /// </summary>
 /// <param name="displayObject">DisplayObject</param>
 public static void Flush(DisplayObject displayObject)
 {
     Flush(displayObject.Parent.X + displayObject.X, displayObject.Parent.Y + displayObject.Y, displayObject.Width, displayObject.Height);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Adds a child DisplayObject to this DisplayObjectContainer.
 /// </summary>
 /// <param name="child">DisplayObject to add.</param>
 public void AddChild(DisplayObject child)
 {
     AddChildAt(-1, child);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Returns whether this container contains a child DisplayObject.
 /// </summary>
 /// <param name="child">DisplayObject to find.</param>
 /// <returns></returns>
 public bool Contains(DisplayObject child)
 {
     return(_displayList.Contains(child));
 }