/// <summary> /// Initialize a new instance of the ViewDrawSeparator class. /// </summary> /// <param name="paletteDisabled">Palette source for the disabled state.</param> /// <param name="paletteNormal">Palette source for the normal state.</param> /// <param name="paletteTracking">Palette source for the tracking state.</param> /// <param name="palettePressed">Palette source for the pressed state.</param> /// <param name="metricDisabled">Palette source for disabled metric values.</param> /// <param name="metricNormal">Palette source for normal metric values.</param> /// <param name="metricTracking">Palette source for tracking metric values.</param> /// <param name="metricPressed">Palette source for pressed metric values.</param> /// <param name="metricPadding">Metric used to get padding values.</param> /// <param name="orientation">Visual orientation of the content.</param> public ViewDrawSeparator(IPaletteDouble paletteDisabled, IPaletteDouble paletteNormal, IPaletteDouble paletteTracking, IPaletteDouble palettePressed, IPaletteMetric metricDisabled, IPaletteMetric metricNormal, IPaletteMetric metricTracking, IPaletteMetric metricPressed, PaletteMetricPadding metricPadding, Orientation orientation) { Debug.Assert(paletteDisabled != null); Debug.Assert(paletteNormal != null); Debug.Assert(paletteTracking != null); Debug.Assert(palettePressed != null); Debug.Assert(metricDisabled != null); Debug.Assert(metricNormal != null); Debug.Assert(metricTracking != null); Debug.Assert(metricPressed != null); // Remember the source information _paletteDisabled = paletteDisabled; _paletteNormal = paletteNormal; _paletteTracking = paletteTracking; _palettePressed = palettePressed; _metricDisabled = metricDisabled; _metricNormal = metricNormal; _metricTracking = metricTracking; _metricPressed = metricPressed; _metricPadding = metricPadding; _orientation = orientation; // Default other state _length = 0; }
/// <summary> /// Initialize a new instance of the PaletteRedirectDouble class. /// </summary> /// <param name="target">Initial palette target for redirection.</param> /// <param name="disabled">Redirection for disabled state requests.</param> /// <param name="normal">Redirection for normal state requests.</param> /// <param name="pressed">Redirection for pressed state requests.</param> /// <param name="tracking">Redirection for tracking state requests.</param> public PaletteRedirectDouble(IPalette target, IPaletteDouble disabled, IPaletteDouble normal, IPaletteDouble pressed, IPaletteDouble tracking) : this(target, disabled, normal, pressed, tracking, null, null, null, null, null) { }
/// <summary> /// Initialize a new instance of the PaletteRedirectDoubleMetric class. /// </summary> /// <param name="target">Initial palette target for redirection.</param> /// <param name="disabled">Redirection for disabled state requests.</param> /// <param name="disableMetric">Redirection for disabled metric requests.</param> /// <param name="normal">Redirection for normal state requests.</param> /// <param name="normalMetric">Redirection for normal metric requests.</param> public PaletteRedirectDoubleMetric(IPalette target, IPaletteDouble disabled, IPaletteMetric disableMetric, IPaletteDouble normal, IPaletteMetric normalMetric) : base(target, disabled, normal) { // Remember state specific inheritance _disabled = disableMetric; _normal = normalMetric; }
/// <summary> /// Initialize a new instance of the PaletteSplitContainer class. /// </summary> /// <param name="inheritSplitContainer">Source for inheriting back/border defaulted values.</param> /// <param name="inheritSeparator">Source for inheriting separator defaulted values.</param> /// <param name="inheritMetric">Source for inheriting separator metric values.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteSplitContainer(IPaletteDouble inheritSplitContainer, IPaletteDouble inheritSeparator, IPaletteMetric inheritMetric, NeedPaintHandler needPaint) : base(inheritSplitContainer, needPaint) { // Create the embedded separator palette information _separator = new PaletteSeparatorPadding(inheritSeparator, inheritMetric, needPaint); }
/// <summary> /// Initialize a new instance of the PaletteDouble class. /// </summary> /// <param name="inherit">Source for inheriting values.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteDouble(IPaletteDouble inherit, NeedPaintHandler needPaint) { // Store the provided paint notification delegate NeedPaint = needPaint; // Create storage that maps onto the inherit instances _back = new PaletteBack(inherit.PaletteBack, needPaint); _border = new PaletteBorder(inherit.PaletteBorder, needPaint); }
/// <summary> /// Initialize a new instance of the PaletteDouble class. /// </summary> /// <param name="inherit">Source for inheriting values.</param> /// <param name="back">Reference to back storage.</param> /// <param name="border">Reference to border storage.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteDouble(IPaletteDouble inherit, PaletteBack back, PaletteBorder border, NeedPaintHandler needPaint) { // Store the provided references NeedPaint = needPaint; _back = back; _border = border; }
/// <summary> /// Gets the color border alignment. /// </summary> /// <param name="style">Border style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color alignment style.</returns> public override PaletteRectangleAlign GetBorderColorAlign(PaletteBorderStyle style, PaletteState state) { IPaletteDouble inherit = GetInherit(state); if (inherit != null) { return(inherit.PaletteBorder.GetBorderColorAlign(state)); } else { return(Target.GetBorderColorAlign(style, state)); } }
/// <summary> /// Gets the border corner rounding. /// </summary> /// <param name="style">Border style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Integer rounding.</returns> public override int GetBorderRounding(PaletteBorderStyle style, PaletteState state) { IPaletteDouble inherit = GetInherit(state); if (inherit != null) { return(inherit.PaletteBorder.GetBorderRounding(state)); } else { return(Target.GetBorderRounding(style, state)); } }
/// <summary> /// Gets the border image style. /// </summary> /// <param name="style">Border style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Image style value.</returns> public override PaletteImageStyle GetBorderImageStyle(PaletteBorderStyle style, PaletteState state) { IPaletteDouble inherit = GetInherit(state); if (inherit != null) { return(inherit.PaletteBorder.GetBorderImageStyle(state)); } else { return(Target.GetBorderImageStyle(style, state)); } }
/// <summary> /// Gets a background image. /// </summary> /// <param name="style">Background style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Image instance.</returns> public override Image GetBackImage(PaletteBackStyle style, PaletteState state) { IPaletteDouble inherit = GetInherit(state); if (inherit != null) { return(inherit.PaletteBack.GetBackImage(state)); } else { return(Target.GetBackImage(style, state)); } }
/// <summary> /// Gets the graphics drawing hint for the background. /// </summary> /// <param name="style">Border style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>PaletteGraphicsHint value.</returns> public override PaletteGraphicsHint GetBackGraphicsHint(PaletteBackStyle style, PaletteState state) { IPaletteDouble inherit = GetInherit(state); if (inherit != null) { return(inherit.PaletteBack.GetBackGraphicsHint(state)); } else { return(Target.GetBackGraphicsHint(style, state)); } }
/// <summary> /// Initialize a new instance of the PaletteSeparatorPadding class. /// </summary> /// <param name="inheritDouble">Source for inheriting border and background values.</param> /// <param name="inheritMetric">Source for inheriting metric values.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteSeparatorPadding(IPaletteDouble inheritDouble, IPaletteMetric inheritMetric, NeedPaintHandler needPaint) : base(inheritDouble, needPaint) { Debug.Assert(inheritDouble != null); Debug.Assert(inheritMetric != null); // Remember the inheritance _inherit = inheritMetric; // Set default value for padding property _separatorPadding = CommonHelper.InheritPadding; }
/// <summary> /// Set the redirection states. /// </summary> /// <param name="disabled">Redirection for disabled state requests.</param> /// <param name="disableMetric">Redirection for disabled metric requests.</param> /// <param name="normal">Redirection for normal state requests.</param> /// <param name="normalMetric">Redirection for normal metric requests.</param> /// <param name="pressed">Redirection for pressed state requests.</param> /// <param name="pressedMetric">Redirection for pressed metric requests.</param> /// <param name="tracking">Redirection for tracking state requests.</param> /// <param name="trackingMetric">Redirection for tracking metric requests.</param> public void SetRedirectStates(IPaletteDouble disabled, IPaletteMetric disableMetric, IPaletteDouble normal, IPaletteMetric normalMetric, IPaletteDouble pressed, IPaletteMetric pressedMetric, IPaletteDouble tracking, IPaletteMetric trackingMetric) { base.SetRedirectStates(disabled, normal, pressed, tracking); _disabled = disableMetric; _normal = normalMetric; _pressed = pressedMetric; _tracking = trackingMetric; }
/// <summary> /// Initialize a new instance of the PaletteDoubleOverride class. /// </summary> /// <param name="normalTriple">Normal palette to use.</param> /// <param name="overrideTriple">Override palette to use.</param> /// <param name="overrideState">State used by the override.</param> public PaletteDoubleOverride(IPaletteDouble normalTriple, IPaletteDouble overrideTriple, PaletteState overrideState) { Debug.Assert(normalTriple != null); Debug.Assert(overrideTriple != null); if (normalTriple == null) throw new ArgumentNullException("normalTriple"); if (overrideTriple == null) throw new ArgumentNullException("overrideTriple"); // Create the triple override instances _overrideBack = new PaletteBackInheritOverride(normalTriple.PaletteBack, overrideTriple.PaletteBack); _overrideBorder = new PaletteBorderInheritOverride(normalTriple.PaletteBorder, overrideTriple.PaletteBorder); // Do not apply an override by default Apply = false; // Always override the state Override = true; OverrideState = overrideState; }
/// <summary> /// Initialize a new instance of the PaletteRedirectDouble class. /// </summary> /// <param name="target">Initial palette target for redirection.</param> /// <param name="disabled">Redirection for disabled state requests.</param> /// <param name="normal">Redirection for normal state requests.</param> /// <param name="pressed">Redirection for pressed state requests.</param> /// <param name="tracking">Redirection for tracking state requests.</param> /// <param name="checkedNormal">Redirection for checked normal state requests.</param> /// <param name="checkedPressed">Redirection for checked pressed state requests.</param> /// <param name="checkedTracking">Redirection for checked tracking state requests.</param> /// <param name="focusOverride">Redirection for focus override state requests.</param> /// <param name="normalDefaultOverride">Redirection for normal default override state requests.</param> public PaletteRedirectDouble(IPalette target, IPaletteDouble disabled, IPaletteDouble normal, IPaletteDouble pressed, IPaletteDouble tracking, IPaletteDouble checkedNormal, IPaletteDouble checkedPressed, IPaletteDouble checkedTracking, IPaletteDouble focusOverride, IPaletteDouble normalDefaultOverride) : base(target) { // Remember state specific inheritance _disabled = disabled; _normal = normal; _pressed = pressed; _tracking = tracking; _checkedNormal = checkedNormal; _checkedPressed = checkedPressed; _checkedTracking = checkedTracking; _focusOverride = focusOverride; _normalDefaultOverride = normalDefaultOverride; }
/// <summary> /// Gets the color alignment. /// </summary> /// <param name="style">Background style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color alignment style.</returns> public override PaletteRectangleAlign GetBackColorAlign(PaletteBackStyle style, PaletteState state) { IPaletteDouble inherit = GetInherit(state); return(inherit != null?inherit.PaletteBack.GetBackColorAlign(state) : Target.GetBackColorAlign(style, state)); }
/// <summary> /// Gets the color background angle. /// </summary> /// <param name="style">Background style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Angle used for color drawing.</returns> public override float GetBackColorAngle(PaletteBackStyle style, PaletteState state) { IPaletteDouble inherit = GetInherit(state); return(inherit != null?inherit.PaletteBack.GetBackColorAngle(state) : Target.GetBackColorAngle(style, state)); }
/// <summary> /// Gets a border image. /// </summary> /// <param name="style">Border style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Image instance.</returns> public override Image GetBorderImage(PaletteBorderStyle style, PaletteState state) { IPaletteDouble inherit = GetInherit(state); return(inherit != null?inherit.PaletteBorder.GetBorderImage(state) : Target.GetBorderImage(style, state)); }
/// <summary> /// Set the redirection states. /// </summary> /// <param name="disabled">Redirection for disabled state requests.</param> /// <param name="disableMetric">Redirection for disabled metric requests.</param> /// <param name="normal">Redirection for normal state requests.</param> /// <param name="normalMetric">Redirection for normal metric requests.</param> public void SetRedirectStates(IPaletteDouble disabled, IPaletteMetric disableMetric, IPaletteDouble normal, IPaletteMetric normalMetric) { base.SetRedirectStates(disabled, normal); _disabled = disableMetric; _normal = normalMetric; _pressed = null; _tracking = null; }
/// <summary> /// Sets the inheritence parent. /// </summary> public void SetInherit(IPaletteDouble inherit) { _back.SetInherit(inherit.PaletteBack); _border.SetInherit(inherit.PaletteBorder); }
/// <summary> /// Gets the graphics drawing hint for the border. /// </summary> /// <param name="style">Border style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>PaletteGraphicsHint value.</returns> public override PaletteGraphicsHint GetBorderGraphicsHint(PaletteBorderStyle style, PaletteState state) { IPaletteDouble inherit = GetInherit(state); return(inherit != null?inherit.PaletteBorder.GetBorderGraphicsHint(state) : Target.GetBorderGraphicsHint(style, state)); }
/// <summary> /// Update the source palettes for drawing. /// </summary> /// <param name="paletteDisabled">Palette source for the disabled state.</param> /// <param name="paletteNormal">Palette source for the normal state.</param> /// <param name="paletteTracking">Palette source for the tracking state.</param> /// <param name="palettePressed">Palette source for the pressed state.</param> /// <param name="metricDisabled">Palette source for disabled metric values.</param> /// <param name="metricNormal">Palette source for normal metric values.</param> /// <param name="metricTracking">Palette source for tracking metric values.</param> /// <param name="metricPressed">Palette source for pressed metric values.</param> public void SetPalettes(IPaletteDouble paletteDisabled, IPaletteDouble paletteNormal, IPaletteDouble paletteTracking, IPaletteDouble palettePressed, IPaletteMetric metricDisabled, IPaletteMetric metricNormal, IPaletteMetric metricTracking, IPaletteMetric metricPressed) { Debug.Assert(paletteDisabled != null); Debug.Assert(paletteNormal != null); Debug.Assert(paletteTracking != null); Debug.Assert(palettePressed != null); Debug.Assert(metricDisabled != null); Debug.Assert(metricNormal != null); Debug.Assert(metricTracking != null); Debug.Assert(metricPressed != null); // Use newly provided palettes _paletteDisabled = paletteDisabled; _paletteNormal = paletteNormal; _paletteTracking = paletteTracking; _palettePressed = palettePressed; _metricDisabled = metricDisabled; _metricNormal = metricNormal; _metricTracking = metricTracking; _metricPressed = metricPressed; }
/// <summary> /// Set the redirection states. /// </summary> /// <param name="disabled">Redirection for disabled state requests.</param> /// <param name="normal">Redirection for normal state requests.</param> /// <param name="pressed">Redirection for pressed state requests.</param> /// <param name="tracking">Redirection for tracking state requests.</param> public virtual void SetRedirectStates(IPaletteDouble disabled, IPaletteDouble normal, IPaletteDouble pressed, IPaletteDouble tracking) { _disabled = disabled; _normal = normal; _pressed = pressed; _tracking = tracking; }
/// <summary> /// Initialize a new instance of the PaletteRedirectDouble class. /// </summary> /// <param name="target">Initial palette target for redirection.</param> /// <param name="disabled">Redirection for disabled state requests.</param> /// <param name="normal">Redirection for normal state requests.</param> public PaletteRedirectDouble(IPalette target, IPaletteDouble disabled, IPaletteDouble normal) : this(target, disabled, normal, null, null, null, null, null, null, null) { }
/// <summary> /// Gets a value indicating if background should be drawn. /// </summary> /// <param name="style">Background style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>InheritBool value.</returns> public override InheritBool GetBackDraw(PaletteBackStyle style, PaletteState state) { IPaletteDouble inherit = GetInherit(state); return(inherit != null?inherit.PaletteBack.GetBackDraw(state) : Target.GetBackDraw(style, state)); }
/// <summary> /// Initialize a new instance of the PaletteDouble class. /// </summary> /// <param name="inherit">Source for inheriting values.</param> public PaletteDouble(IPaletteDouble inherit) : this(inherit, null) { }
/// <summary> /// Gets the border corner rounding. /// </summary> /// <param name="style">Border style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Float rounding.</returns> public override float GetBorderRounding(PaletteBorderStyle style, PaletteState state) { IPaletteDouble inherit = GetInherit(state); return(inherit != null?inherit.PaletteBorder.GetBorderRounding(state) : Target.GetBorderRounding(style, state)); }
private void CheckPaletteState() { PaletteState state = (IsFixed ? FixedState : State); // Set the current palette based on the element state switch (state) { case PaletteState.Disabled: _palette = _paletteDisabled; _metric = _metricDisabled; break; case PaletteState.Normal: _palette = _paletteNormal; _metric = _metricNormal; break; case PaletteState.Pressed: _palette = _palettePressed; _metric = _metricPressed; break; case PaletteState.Tracking: _palette = _paletteTracking; _metric = _metricTracking; break; default: // Should never happen! Debug.Assert(false); break; } }
/// <summary> /// Gets the background image style. /// </summary> /// <param name="style">Background style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Image style value.</returns> public override PaletteImageStyle GetBackImageStyle(PaletteBackStyle style, PaletteState state) { IPaletteDouble inherit = GetInherit(state); return(inherit != null?inherit.PaletteBack.GetBackImageStyle(state) : Target.GetBackImageStyle(style, state)); }
/// <summary> /// Initialize a new instance of the PalettePage class. /// </summary> /// <param name="inherit">Source for inheriting values.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PalettePage(IPaletteDouble inherit, NeedPaintHandler needPaint) : base(inherit, needPaint) { }
/// <summary> /// Reset the redirection states to null. /// </summary> public virtual void ResetRedirectStates() { _disabled = null; _normal = null; _pressed = null; _tracking = null; _checkedNormal = null; _checkedPressed = null; _checkedTracking = null; _focusOverride = null; _normalDefaultOverride = null; }
/// <summary> /// Gets the image border alignment. /// </summary> /// <param name="style">Border style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Image alignment style.</returns> public override PaletteRectangleAlign GetBorderImageAlign(PaletteBorderStyle style, PaletteState state) { IPaletteDouble inherit = GetInherit(state); return(inherit != null?inherit.PaletteBorder.GetBorderImageAlign(state) : Target.GetBorderImageAlign(style, state)); }
/// <summary> /// Initialize a new instance of the PaletteSplitContainer class. /// </summary> /// <param name="inheritSplitContainer">Source for inheriting back/border defaulted values.</param> /// <param name="inheritSeparator">Source for inheriting separator defaulted values.</param> /// <param name="inheritMetric">Source for inheriting separator metric values.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteSplitContainer(IPaletteDouble inheritSplitContainer, IPaletteDouble inheritSeparator, IPaletteMetric inheritMetric, NeedPaintHandler needPaint) : base(inheritSplitContainer, needPaint) =>