public MyGuiControlSlider(
            Vector2? position = null,
            float minValue = 0f,
            float maxValue = 1f,
            float width = 464f/1600f,
            float? defaultValue = null,
            Vector4? color = null,
            String labelText = null,
            int labelDecimalPlaces = 1,
            float labelScale = MyGuiConstants.DEFAULT_TEXT_SCALE,
            float labelSpaceWidth = 0f,
            string labelFont = MyFontEnum.White,
            String toolTip = null,
            MyGuiControlSliderStyleEnum visualStyle = MyGuiControlSliderStyleEnum.Default,
            MyGuiDrawAlignEnum originAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
            bool intValue = false)
            : base(
                position: position,
                width: width,
                color: color,
                labelScale: labelScale,
                labelSpaceWidth: labelSpaceWidth,
                labelFont: labelFont,
                toolTip: toolTip,
                visualStyle: visualStyle,
                originAlign: originAlign
            )
        {
            m_minValue = minValue;
            m_maxValue = maxValue;
            m_range = m_maxValue - m_minValue;

            MyDebug.AssertDebug(m_maxValue > m_minValue && m_maxValue != m_minValue);

            Propeties = new MyGuiSliderProperties()
            {
                FormatLabel = FormatValue,
                RatioFilter = FilterRatio,
                RatioToValue = RatioToValue,
                ValueToRatio = ValueToRatio
            };

            DefaultRatio = defaultValue.HasValue ? ValueToRatio(defaultValue.Value) : default(float?);
            Ratio = DefaultRatio ?? minValue;
            m_intValue = intValue;

            LabelDecimalPlaces = labelDecimalPlaces;
            
            m_labelFormat = labelText;
        }
 public static StyleDefinition GetVisualStyle(MyGuiControlSliderStyleEnum style)
 {
     return m_styles[(int)style];
 }
        public MyGuiControlSliderBase(
            Vector2? position                       = null,
            float width                             = 464f/1600f,
            MyGuiSliderProperties props                  = null,
            float? defaultRatio                     = null,
            Vector4? color                          = null,
            float labelScale                        = MyGuiConstants.DEFAULT_TEXT_SCALE,
            float labelSpaceWidth                   = 0f,
            MyFontEnum labelFont                    = MyFontEnum.White,
            String toolTip                   = null,
            MyGuiControlSliderStyleEnum visualStyle = MyGuiControlSliderStyleEnum.Default,
            MyGuiDrawAlignEnum originAlign          = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER)
            : base(
                 position: position,
                 toolTip: toolTip,
                 isActiveControl: true,
                 originAlign: originAlign,
                 canHaveFocus: true)
        {
            // Make sure the default value makes sense
            if (defaultRatio.HasValue)
            {
                Debug.Assert(defaultRatio.Value >= 0 && defaultRatio.Value <= 1);
                defaultRatio = MathHelper.Clamp(defaultRatio.Value, 0, 1);
            }

            if (props == null)
                props = MyGuiSliderProperties.Default;
            m_props = props;

            DefaultRatio = defaultRatio;
            m_ratio = defaultRatio.HasValue ? defaultRatio.Value : 0;
            m_labelSpaceWidth = labelSpaceWidth;

            m_label = new MyGuiControlLabel(
                text: String.Empty,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER,
                textScale: labelScale,
                font: labelFont);
            Elements.Add(m_label);

            VisualStyle = visualStyle;
            Size = new Vector2(width, Size.Y);
            
            UpdateLabel();
        }
        public MyGuiControlSlider(
            Vector2? position                       = null,
            float minValue                          = 0f,
            float maxValue                          = 1f,
            float width                             = 464f/1600f,
            float? defaultValue                     = null,
            Vector4? color                          = null,
            String labelText                 = null,
            int labelDecimalPlaces                  = 1,
            float labelScale                        = MyGuiConstants.DEFAULT_TEXT_SCALE,
            float labelSpaceWidth                   = 0f,
            MyFontEnum labelFont                    = MyFontEnum.White,
            String toolTip                   = null,
            MyGuiControlSliderStyleEnum visualStyle = MyGuiControlSliderStyleEnum.Default,
            MyGuiDrawAlignEnum originAlign          = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
            bool intValue                           = false)
            : base(
                 position: position,
                 toolTip: toolTip,
                 isActiveControl: true,
                 originAlign: originAlign,
                 canHaveFocus: true)
        {
            m_minValue = minValue;
            m_maxValue = maxValue;
            DefaultValue = defaultValue;
            m_value = defaultValue.HasValue ? defaultValue.Value : minValue;
            m_labelSpaceWidth = labelSpaceWidth;
            m_intValue = intValue;

            MyDebug.AssertDebug(m_maxValue > m_minValue && m_maxValue != m_minValue);
            m_label = new MyGuiControlLabel(
                text: labelText ?? String.Empty,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER,
                textScale: labelScale,
                font: labelFont);
            Elements.Add(m_label);

            LabelDecimalPlaces = labelDecimalPlaces;
            VisualStyle = visualStyle;
            Size = new Vector2(width, Size.Y);
            UpdateNormalizedValue();
            UpdateLabel();
        }