Implement storage for a track bar state.
Inheritance: Storage
Ejemplo n.º 1
0
        /// <summary>
        /// Initialize a new instance of the KryptonTrackBar class.
        /// </summary>
        public KryptonTrackBar()
        {
            // Default values
            _autoSize     = true;
            _requestedDim = 0;

            // Create the palette storage
            StateCommon   = new PaletteTrackBarRedirect(Redirector, NeedPaintDelegate);
            OverrideFocus = new PaletteTrackBarRedirect(Redirector, NeedPaintDelegate);
            StateDisabled = new PaletteTrackBarStates(StateCommon, NeedPaintDelegate);
            StateNormal   = new PaletteTrackBarStates(StateCommon, NeedPaintDelegate);
            StateTracking = new PaletteTrackBarPositionStates(StateCommon, NeedPaintDelegate);
            StatePressed  = new PaletteTrackBarPositionStates(StateCommon, NeedPaintDelegate);

            // Create the override handling classes
            _overrideNormal   = new PaletteTrackBarStatesOverride(OverrideFocus, StateNormal, PaletteState.FocusOverride);
            _overrideTracking = new PaletteTrackBarPositionStatesOverride(OverrideFocus, StateTracking, PaletteState.FocusOverride);
            _overridePressed  = new PaletteTrackBarPositionStatesOverride(OverrideFocus, StatePressed, PaletteState.FocusOverride);

            // Create the view manager instance
            _drawTrackBar = new ViewDrawTrackBar(_overrideNormal, StateDisabled, _overrideTracking, _overridePressed, NeedPaintDelegate);
            _drawTrackBar.ValueChanged += OnDrawValueChanged;
            _drawTrackBar.Scroll       += OnDrawScroll;
            _drawTrackBar.RightToLeft   = RightToLeft;
            ViewManager = new ViewManager(this, _drawTrackBar);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Update the the normal and override palettes.
 /// </summary>
 /// <param name="normalStates">New normal palette.</param>
 /// <param name="overrideStates">New override palette.</param>
 public void SetPalettes(PaletteTrackBarRedirect normalStates,
                         PaletteTrackBarStates overrideStates)
 {
     _overrideTickState.SetPalettes(normalStates.Tick, overrideStates.Tick);
     _overrideTrackState.SetPalettes(normalStates.Track, overrideStates.Track);
     _overridePositionState.SetPalettes(normalStates.Position, overrideStates.Position);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Update the the normal and override palettes.
 /// </summary>
 /// <param name="normalStates">New normal palette.</param>
 /// <param name="overrideStates">New override palette.</param>
 public void SetPalettes(PaletteTrackBarRedirect normalStates,
                         PaletteTrackBarStates overrideStates)
 {
     Tick.SetPalettes(normalStates.Tick, overrideStates.Tick);
     Track.SetPalettes(normalStates.Track, overrideStates.Track);
     Position.SetPalettes(normalStates.Position, overrideStates.Position);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Initialize a new instance of the PaletteTrackBarStatesOverride class.
        /// </summary>
        /// <param name="normalStates">Normal state values.</param>
        /// <param name="overrideStates">Override state values.</param>
        /// <param name="overrideState">State to override.</param>
        public PaletteTrackBarStatesOverride(PaletteTrackBarRedirect normalStates,
                                             PaletteTrackBarStates overrideStates,
                                             PaletteState overrideState)
        {
            Debug.Assert(normalStates != null);
            Debug.Assert(overrideStates != null);

            // Validate incoming references
            if (normalStates == null)
            {
                throw new ArgumentNullException("normalStates");
            }
            if (overrideStates == null)
            {
                throw new ArgumentNullException("overrideStates");
            }

            // Create the triple override instances
            _back = normalStates.Back;
            _overrideTickState     = new PaletteElementColorInheritOverride(normalStates.Tick, overrideStates.Tick);
            _overrideTrackState    = new PaletteElementColorInheritOverride(normalStates.Track, overrideStates.Track);
            _overridePositionState = new PaletteElementColorInheritOverride(normalStates.Position, overrideStates.Position);

            // Do not apply an override by default
            Apply = false;

            // Always override the state
            Override      = true;
            OverrideState = overrideState;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initialize a new instance of the KryptonTrackBar class.
        /// </summary>
        public KryptonTrackBar()
        {
            // Default values
            _autoSize = true;
            _requestedDim = 0;

            // Create the palette storage
            _stateCommon = new PaletteTrackBarRedirect(Redirector, NeedPaintDelegate);
            _stateFocus = new PaletteTrackBarRedirect(Redirector, NeedPaintDelegate);
            _stateDisabled = new PaletteTrackBarStates(_stateCommon, NeedPaintDelegate);
            _stateNormal = new PaletteTrackBarStates(_stateCommon, NeedPaintDelegate);
            _stateTracking = new PaletteTrackBarPositionStates(_stateCommon, NeedPaintDelegate);
            _statePressed = new PaletteTrackBarPositionStates(_stateCommon, NeedPaintDelegate);

            // Create the override handling classes
            _overrideNormal = new PaletteTrackBarStatesOverride(_stateFocus, _stateNormal, PaletteState.FocusOverride);
            _overrideTracking = new PaletteTrackBarPositionStatesOverride(_stateFocus, _stateTracking, PaletteState.FocusOverride);
            _overridePressed = new PaletteTrackBarPositionStatesOverride(_stateFocus, _statePressed, PaletteState.FocusOverride);

            // Create the view manager instance
            _drawTrackBar = new ViewDrawTrackBar(_overrideNormal, _stateDisabled, _overrideTracking, _overridePressed, NeedPaintDelegate);
            _drawTrackBar.ValueChanged += new EventHandler(OnDrawValueChanged);
            _drawTrackBar.Scroll += new EventHandler(OnDrawScroll);
            _drawTrackBar.RightToLeft = RightToLeft;
            ViewManager = new ViewManager(this, _drawTrackBar);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Initialize a new instance of the KryptonPaletteTrackbar class.
 /// </summary>
 /// <param name="redirect">Redirector to inherit values from.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public KryptonPaletteTrackBar(PaletteRedirect redirect,
                               NeedPaintHandler needPaint)
 {
     // Create the storage objects
     StateCommon   = new PaletteTrackBarRedirect(redirect, needPaint);
     OverrideFocus = new PaletteTrackBarRedirect(redirect, needPaint);
     StateDisabled = new PaletteTrackBarStates(StateCommon, needPaint);
     StateNormal   = new PaletteTrackBarStates(StateCommon, needPaint);
     StateTracking = new PaletteTrackBarPositionStates(StateCommon, needPaint);
     StatePressed  = new PaletteTrackBarPositionStates(StateCommon, needPaint);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Initialize a new instance of the KryptonPaletteTrackbar class.
 /// </summary>
 /// <param name="redirect">Redirector to inherit values from.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public KryptonPaletteTrackBar(PaletteRedirect redirect,
                               NeedPaintHandler needPaint)
 {
     // Create the storage objects
     _stateCommon = new PaletteTrackBarRedirect(redirect, needPaint);
     _stateFocus = new PaletteTrackBarRedirect(redirect, needPaint);
     _stateDisabled = new PaletteTrackBarStates(_stateCommon, needPaint);
     _stateNormal = new PaletteTrackBarStates(_stateCommon, needPaint);
     _stateTracking = new PaletteTrackBarPositionStates(_stateCommon, needPaint);
     _statePressed = new PaletteTrackBarPositionStates(_stateCommon, needPaint);
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawTrackBar class.
        /// </summary>
        /// <param name="stateNormal">Referenece to normal state values.</param>
        /// <param name="stateDisabled">Referenece to disabled state values.</param>
        /// <param name="stateTracking">Referenece to tracking state values.</param>
        /// <param name="statePressed">Referenece to pressed state values.</param>
        /// <param name="needPaint">Delegate used to request repainting.</param>
        public ViewDrawTrackBar(PaletteTrackBarStatesOverride stateNormal,
                                PaletteTrackBarStates stateDisabled,
                                PaletteTrackBarPositionStatesOverride stateTracking,
                                PaletteTrackBarPositionStatesOverride statePressed,
                                NeedPaintHandler needPaint)
            : base(stateNormal.Back)
        {
            // Default state
            StateNormal   = stateNormal;
            StateDisabled = stateDisabled;
            StateTracking = stateTracking;
            StatePressed  = statePressed;
            Padding       = Padding.Empty;
            _orientation  = Orientation.Horizontal;
            _value        = 0;
            _minimum      = 0;
            _maximum      = 10;
            _smallChange  = 1;
            _largeChange  = 5;
            _tickFreq     = 1;
            _tickStyle    = TickStyle.BottomRight;
            TrackBarSize  = PaletteTrackBarSize.Medium;
            VolumeControl = false;
            _needPaint    = needPaint;

            // Create drawing/layout elements
            TrackPosition        = new ViewDrawTP(this);
            _ticksTop            = new ViewDrawTrackTicks(this, true);
            _ticksBottom         = new ViewDrawTrackTicks(this, false);
            _ticksTop.Visible    = false;
            _ticksBottom.Visible = true;

            // Connect up layout structure
            _layoutTop = new ViewLayoutDocker
            {
                { _ticksTop, ViewDockStyle.Top },
                { TrackPosition, ViewDockStyle.Top },
                { _ticksBottom, ViewDockStyle.Top }
            };
            _layoutTop.Padding = Padding;
            Add(_layoutTop);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawTrackBar class.
        /// </summary>
        /// <param name="stateNormal">Referenece to normal state values.</param>
        /// <param name="stateDisabled">Referenece to disabled state values.</param>
        /// <param name="stateTracking">Referenece to tracking state values.</param>
        /// <param name="statePressed">Referenece to pressed state values.</param>
        /// <param name="needPaint">Delegate used to request repainting.</param>
        public ViewDrawTrackBar(PaletteTrackBarStatesOverride stateNormal,
                                PaletteTrackBarStates stateDisabled,
                                PaletteTrackBarPositionStatesOverride stateTracking,
                                PaletteTrackBarPositionStatesOverride statePressed,
                                NeedPaintHandler needPaint)
            : base(stateNormal.Back)
        {
            // Default state
            _stateNormal = stateNormal;
            _stateDisabled = stateDisabled;
            _stateTracking = stateTracking;
            _statePressed = statePressed;
            _padding = Padding.Empty;
            _orientation = Orientation.Horizontal;
            _value = 0;
            _minimum = 0;
            _maximum = 10;
            _smallChange = 1;
            _largeChange = 5;
            _tickFreq = 1;
            _tickStyle = TickStyle.BottomRight;
            _trackBarSize = PaletteTrackBarSize.Medium;
            _volumeControl = false;
            _needPaint = needPaint;

            // Create drawing/layout elements
            _trackPosition = new ViewDrawTP(this);
            _ticksTop = new ViewDrawTrackTicks(this, true);
            _ticksBottom = new ViewDrawTrackTicks(this, false);
            _ticksTop.Visible = false;
            _ticksBottom.Visible = true;

            // Connect up layout structure
            _layoutTop = new ViewLayoutDocker();
            _layoutTop.Add(_ticksTop, ViewDockStyle.Top);
            _layoutTop.Add(_trackPosition, ViewDockStyle.Top);
            _layoutTop.Add(_ticksBottom, ViewDockStyle.Top);
            _layoutTop.Padding = Padding;
            Add(_layoutTop);
        }
        /// <summary>
        /// Initialize a new instance of the PaletteTrackBarStatesOverride class.
        /// </summary>
        /// <param name="normalStates">Normal state values.</param>
        /// <param name="overrideStates">Override state values.</param>
        /// <param name="overrideState">State to override.</param>
        public PaletteTrackBarStatesOverride(PaletteTrackBarRedirect normalStates,
                                             PaletteTrackBarStates overrideStates,
                                             PaletteState overrideState)
        {
            Debug.Assert(normalStates != null);
            Debug.Assert(overrideStates != null);

            // Validate incoming references
            if (normalStates == null) throw new ArgumentNullException("normalStates");
            if (overrideStates == null) throw new ArgumentNullException("overrideStates");

            // Create the triple override instances
            _back = normalStates.Back;
            _overrideTickState = new PaletteElementColorInheritOverride(normalStates.Tick, overrideStates.Tick);
            _overrideTrackState = new PaletteElementColorInheritOverride(normalStates.Track, overrideStates.Track);
            _overridePositionState = new PaletteElementColorInheritOverride(normalStates.Position, overrideStates.Position);

            // Do not apply an override by default
            Apply = false;

            // Always override the state
            Override = true;
            OverrideState = overrideState;
        }
 /// <summary>
 /// Update the the normal and override palettes.
 /// </summary>
 /// <param name="normalStates">New normal palette.</param>
 /// <param name="overrideStates">New override palette.</param>
 public void SetPalettes(PaletteTrackBarRedirect normalStates,
                         PaletteTrackBarStates overrideStates)
 {
     _overrideTickState.SetPalettes(normalStates.Tick, overrideStates.Tick);
     _overrideTrackState.SetPalettes(normalStates.Track, overrideStates.Track);
     _overridePositionState.SetPalettes(normalStates.Position, overrideStates.Position);
 }