/// <summary> /// Rmeturns the background brush for the key. /// </summary> /// <param name="subStyle">The substyle to use for rendering the key.</param> /// <param name="pressed">Whether the is pressed.</param> /// <returns>A brush to use when rendering the background for the key.</returns> protected Brush GetBackgroundBrush(KeySubStyle subStyle, bool pressed) { if (this.backgroundBrushes == null) { this.backgroundBrushes = new Dictionary <bool, Brush>(); } if (this.StyleVersion != GlobalSettings.StyleDependencyCounter) { this.backgroundBrushes.Clear(); this.StyleVersion = GlobalSettings.StyleDependencyCounter; } if (this.backgroundBrushes.ContainsKey(pressed)) { return(this.backgroundBrushes[pressed]); } var brush = subStyle.GetBackgroundBrush(this.GetBoundingBox()); this.backgroundBrushes.Add(pressed, brush); return(brush); }
/// <summary> /// Returns the background brush for the key. /// </summary> /// <param name="subStyle">The substyle to use for rendering the key.</param> /// <param name="pressed">Whether the is pressed.</param> /// <returns>A brush to use when rendering the background for the key.</returns> protected Pen GetBackgroundPen(KeySubStyle subStyle, bool pressed) { if (this.backgroundPens == null) { this.backgroundPens = new Dictionary <bool, Pen>(); } if (this.StyleVersion != GlobalSettings.StyleDependencyCounter) { this.backgroundPens.Clear(); this.StyleVersion = GlobalSettings.StyleDependencyCounter; } if (this.backgroundPens.ContainsKey(pressed)) { return(this.backgroundPens[pressed]); } var pen = subStyle.GetBackgroundPen(this.GetBoundingBox()); this.backgroundPens.Add(pressed, pen); return(pen); }
/// <summary> /// Handles change of the pressed style, sets the new style and invokes the changed event. /// </summary> /// <param name="style">The new style.</param> private void style_SubStyleChanged(KeySubStyle style) { this.currentStyle.SubStyle = style; this.StyleChanged?.Invoke(this.currentStyle); }
/// <summary> /// Handles change of the loose style, sets the new style and invokes the changed event. /// </summary> /// <param name="style">The new style.</param> private void looseKeys_SubStyleChanged(KeySubStyle style) { this.currentStyle.Loose = style; this.StyleChanged?.Invoke(this.currentStyle); this.UpdateOutlineWarning(); }
/// <summary> /// Rmeturns the background brush for the key. /// </summary> /// <param name="subStyle">The substyle to use for rendering the key.</param> /// <param name="pressed">Whether the is pressed.</param> /// <returns>A brush to use when rendering the background for the key.</returns> protected Brush GetBackgroundBrush(KeySubStyle subStyle, bool pressed) { if (this.backgroundBrushes == null) this.backgroundBrushes = new Dictionary<bool, Brush>(); if (this.StyleVersion != GlobalSettings.StyleDependencyCounter) { this.backgroundBrushes.Clear(); this.StyleVersion = GlobalSettings.StyleDependencyCounter; } if (this.backgroundBrushes.ContainsKey(pressed)) return this.backgroundBrushes[pressed]; var brush = subStyle.GetBackgroundBrush(this.GetBoundingBox()); this.backgroundBrushes.Add(pressed, brush); return brush; }