/// <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);
 }
        /// <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>
        /// <exception cref="ArgumentNullException"></exception>
        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(nameof(normalStates));
            }

            if (overrideStates == null)
            {
                throw new ArgumentNullException(nameof(overrideStates));
            }

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

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

            // Always override the state
            Override      = true;
            OverrideState = overrideState;
        }
예제 #3
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);
        }
 /// <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);
 }
예제 #5
0
 /// <summary>
 /// Initialize a new instance of the PaletteTrackBarPositionStates class.
 /// </summary>
 /// <param name="redirect">Source for inheriting values.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteTrackBarPositionStates(PaletteTrackBarRedirect redirect,
                                      NeedPaintHandler needPaint)
     : this(redirect.Position, needPaint)
 {
 }
예제 #6
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,
                         PaletteTrackBarPositionStates overrideStates)
 {
     Position.SetPalettes(normalStates.Position, overrideStates.Position);
 }