Exemple #1
0
        /// <summary>
        /// Equals override
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            ToggleLayout layout = (ToggleLayout)obj;

            return(base.Equals(obj) &&
                   layout.Color.Equals(this.Color));
        }
Exemple #2
0
        /// <summary>
        /// Applies the provided keyframe to the control,
        /// overriding all needed properties
        /// </summary>
        /// <param name="frame"></param>
        public override void ApplyKeyFrame(KeyFrame startFrame, KeyFrame endFrame, float factor)
        {
            base.ApplyKeyFrame(startFrame, endFrame, factor);

            ToggleLayout startLayout = startFrame != null ? startFrame.Layout as ToggleLayout : null;
            ToggleLayout endLayout   = endFrame != null ? endFrame.Layout as ToggleLayout : null;

            if (startLayout == null && endLayout == null)
            {
                return;
            }

            int r, g, b, a;

            if (endLayout == null)
            {
                r = startLayout.Color.R;
                g = startLayout.Color.G;
                b = startLayout.Color.B;
                a = startLayout.Color.A;
            }
            else
            {
                r = (int)((float)startLayout.Color.R * (1.0f - factor) + (float)endLayout.Color.R * factor);
                g = (int)((float)startLayout.Color.G * (1.0f - factor) + (float)endLayout.Color.G * factor);
                b = (int)((float)startLayout.Color.B * (1.0f - factor) + (float)endLayout.Color.B * factor);
                a = (int)((float)startLayout.Color.A * (1.0f - factor) + (float)endLayout.Color.A * factor);
            }

            this.Color = Color.FromArgb(a, r, g, b);
        }
Exemple #3
0
        /// <summary>
        /// Clones the layout
        /// </summary>
        /// <returns></returns>
        public override object Clone()
        {
            ToggleLayout layout = new ToggleLayout();

            layout.SetFrom(this);

            layout.Color = this.Color;

            return(layout);
        }
Exemple #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 public GUIToggle()
 {
     Name   = "Toggle";
     Layout = new ToggleLayout();
 }
Exemple #5
0
 /// <summary>
 /// Constructor
 /// </summary>
 public GUIToggle()
 {
     Name = "Toggle";
     Layout = new ToggleLayout();
 }
Exemple #6
0
        /// <summary>
        /// Clones the layout
        /// </summary>
        /// <returns></returns>
        public override object Clone()
        {
            ToggleLayout layout = new ToggleLayout();
            layout.SetFrom(this);

            layout.Color = this.Color;

            return layout;
        }