Exemplo n.º 1
0
        /// <summary>
        /// Adds a control as the child of another.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="control"></param>
        /// <param name="atIndex"></param>
        public void AddControl(GUIControl parent, GUIControl control, int atIndex)
        {
            GUIControlCollection collection = (parent != null ? parent.Controls : this.Controls);

            if (!collection.Contains(control, true))
            {
                // We need create a keyframe for this control on the "OnActivate" channel
                GUIAnimation onActivate = Animations["OnActivate"];
                if (onActivate != null)
                {
                    onActivate.CreateKeyFrame(control, 0);
                }

                control.Parent = (parent != null) ? parent : this;

                if (atIndex >= 0)
                {
                    collection.Insert(atIndex, control);
                }
                else
                {
                    collection.Add(control);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Recursively create keyframes
        /// </summary>
        /// <param name="animation"></param>
        /// <param name="control"></param>
        private void CreateKeyframes(GUIAnimation animation, GUIControl control)
        {
            animation.CreateKeyFrame(control, 0);

            foreach (GUIControl child in control.Controls)
            {
                CreateKeyframes(animation, child);
            }
        }