Beispiel #1
0
        protected internal override void OnThemeChange()
        {
            // Update base theme
            base.OnThemeChange();

            // Recalculate checkbox control position
            ControlHandle.AlignOffset = new Vector2(0, ((DefaultHeight - ControlHandle.Size.Y) / 2) + (DrawHeader ? HeaderHeight : 0));

            // Recalculate text position
            TextHandle.Padding = new Vector2(ControlHandle.Size.Y, (DefaultHeight - TextHandle.Bounding.Height) / -2f);
            TextHandle.Width   =
                (int)(DefaultWidth - DefaultWidth * KeyButtonHandle.WidthMultiplier * 2 - ControlHandle.Size.Y);
            TextHandle.ApplyToControlPosition(this);

            // Header positions
            if (DrawHeader)
            {
                HeaderText.Item1.Padding =
                    new Vector2(
                        Width - DefaultWidth * KeyButtonHandle.WidthMultiplier * 2 +
                        (DefaultWidth * KeyButtonHandle.WidthMultiplier - HeaderText.Item1.Bounding.Width) / 2,
                        (HeaderHeight - HeaderText.Item1.Bounding.Height) / 2f);
                HeaderText.Item2.Padding =
                    new Vector2(
                        Width - DefaultWidth * KeyButtonHandle.WidthMultiplier +
                        (DefaultWidth * KeyButtonHandle.WidthMultiplier - HeaderText.Item1.Bounding.Width) / 2,
                        (HeaderHeight - HeaderText.Item1.Bounding.Height) / 2f);

                // Apply to this container
                HeaderText.Item1.ApplyToControlPosition(this);
                HeaderText.Item2.ApplyToControlPosition(this);
            }
        }
        protected internal override sealed void OnThemeChange()
        {
            // Apply base theme
            base.OnThemeChange();

            // Update text position
            TextHandle.Width = (int)(DefaultWidth * TextWidthMultiplier);
            TextHandle.ApplyToControlPosition(this);
        }
        protected internal override void OnThemeChange()
        {
            // Apply base theme
            base.OnThemeChange();

            // Update check box handle
            //ControlHandle.AlignOffset = new Vector2(Size.X - ControlHandle.Size.X, Size.Y / 2 - ControlHandle.Size.Y / 2); // Right align
            ControlHandle.AlignOffset = new Vector2(0, (Size.Y - ControlHandle.Size.Y) / 2); // Left align

            // Update text position offset
            TextHandle.Padding = new Vector2(ControlHandle.Size.X, 0);
            TextHandle.ApplyToControlPosition(this);
        }
Beispiel #4
0
            protected internal override void OnThemeChange()
            {
                // Don't update base
                //base.OnThemeChange();

                // Update fake sizes
                _rectangle       = new Rectangle(0, 0, Width, DefaultHeight);
                DynamicRectangle = new Theme.DynamicRectangle
                {
                    Offset = new Vector2(DefaultWidth - (Width * (IsFirstButton ? 2 : 1)), ParentHandle.Height - DefaultHeight)
                };
                Size          = new Vector2(Rectangle.Width, Rectangle.Height);
                SizeRectangle = new Rectangle(0, 0, Rectangle.Width, Rectangle.Height);
                UpdateCropRectangle();

                // Update text handle position
                TextHandle.ApplyToControlPosition(this);
            }
Beispiel #5
0
        protected internal override void OnThemeChange()
        {
            // Apply base theme
            base.OnThemeChange();

            // Update height
            Height = DefaultHeight + (int)Background.Size.Y;

            // Update text offset
            TextHandle.Padding = new Vector2((Width - Background.Size.X) / 4, (DefaultHeight - TextHandle.Bounding.Height) / 2f);
            TextHandle.ApplyToControlPosition(this);
            ValueDisplayHandle.Padding = new Vector2(-TextHandle.Padding.X, TextHandle.Padding.Y);
            ValueDisplayHandle.ApplyToControlPosition(this);

            // Update aligns
            Background.AlignOffset = new Vector2(Size.X / 2 - Background.Size.X / 2, Size.Y - Background.Size.Y);
            RecalculateSliderPosition();
        }
Beispiel #6
0
 internal void SetText(string text, Text.Align align, int xOffset = 0, int yOffset = 0)
 {
     TextValue = text;
     if (TextHandle == null)
     {
         if (TextDictionary.ContainsKey(CurrentButtonType))
         {
             TextHandle       = TextDictionary[CurrentButtonType](CurrentButtonType == ButtonType.Addon ? text.ToUpper() : text);
             TextHandle.Color = CurrentColorModificationValue.Combine(DefaultColorValues[CurrentButtonType]);
             TextObjects.Add(TextHandle);
         }
         else
         {
             return;
         }
     }
     else
     {
         TextHandle.TextValue = CurrentButtonType == ButtonType.Addon ? text.ToUpper() : text;
     }
     TextHandle.TextAlign = align;
     TextHandle.Padding   = new Vector2(xOffset, yOffset);
     TextHandle.ApplyToControlPosition(this);
 }