/// <summary>
        /// Initialize a new instance of the PaletteTrackBarPositionStatesOverride class.
        /// </summary>
        /// <param name="normalStates">Normal state values.</param>
        /// <param name="overrideStates">Override state values.</param>
        /// <param name="overrideState">State to override.</param>
        public PaletteTrackBarPositionStatesOverride(PaletteTrackBarRedirect normalStates,
                                                     PaletteTrackBarPositionStates 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 override instance
            _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.º 2
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);
        }
 /// <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.º 4
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);
 }
 /// <summary>
 /// Initialize a new instance of the PaletteTrackBarStates class.
 /// </summary>
 /// <param name="redirect">Source for inheriting values.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteTrackBarStates(PaletteTrackBarRedirect redirect,
                              NeedPaintHandler needPaint)
     : this(redirect.Tick, redirect.Track, redirect.Position, needPaint)
 {
 }