|
@@ -310,19 +310,18 @@ public partial class View // Drawing APIs
|
|
|
/// If set to <see langword="true"/> this uses the focused colors from the color scheme, otherwise
|
|
|
/// the regular ones.
|
|
|
/// </param>
|
|
|
- /// <param name="scheme">The color scheme to use.</param>
|
|
|
- public void DrawHotString (string text, bool focused, ColorScheme scheme)
|
|
|
+ public void DrawHotString (string text, bool focused)
|
|
|
{
|
|
|
if (focused)
|
|
|
{
|
|
|
- DrawHotString (text, scheme.HotFocus, scheme.Focus);
|
|
|
+ DrawHotString (text, GetHotFocusColor (), GetFocusColor ());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
DrawHotString (
|
|
|
text,
|
|
|
- Enabled ? scheme.HotNormal : scheme.Disabled,
|
|
|
- Enabled ? scheme.Normal : scheme.Disabled
|
|
|
+ Enabled ? GetHotNormalColor () : ColorScheme.Disabled,
|
|
|
+ Enabled ? GetNormalColor () : ColorScheme.Disabled
|
|
|
);
|
|
|
}
|
|
|
}
|
|
@@ -336,12 +335,31 @@ public partial class View // Drawing APIs
|
|
|
public virtual Attribute GetFocusColor ()
|
|
|
{
|
|
|
ColorScheme cs = ColorScheme;
|
|
|
+
|
|
|
+ if (cs is null)
|
|
|
+ {
|
|
|
+ cs = new ();
|
|
|
+ }
|
|
|
+
|
|
|
+ return Enabled ? GetColor (cs.Focus) : cs.Disabled;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>Determines the current <see cref="ColorScheme"/> based on the <see cref="Enabled"/> value.</summary>
|
|
|
+ /// <returns>
|
|
|
+ /// <see cref="ColorScheme.Focus"/> if <see cref="Enabled"/> is <see langword="true"/> or
|
|
|
+ /// <see cref="ColorScheme.Disabled"/> if <see cref="Enabled"/> is <see langword="false"/>. If it's
|
|
|
+ /// overridden can return other values.
|
|
|
+ /// </returns>
|
|
|
+ public virtual Attribute GetHotFocusColor ()
|
|
|
+ {
|
|
|
+ ColorScheme cs = ColorScheme;
|
|
|
+
|
|
|
if (cs is null)
|
|
|
{
|
|
|
cs = new ();
|
|
|
}
|
|
|
|
|
|
- return Enabled ? cs.Focus : cs.Disabled;
|
|
|
+ return Enabled ? GetColor (cs.HotFocus) : cs.Disabled;
|
|
|
}
|
|
|
|
|
|
/// <summary>Determines the current <see cref="ColorScheme"/> based on the <see cref="Enabled"/> value.</summary>
|
|
@@ -359,7 +377,7 @@ public partial class View // Drawing APIs
|
|
|
cs = new ();
|
|
|
}
|
|
|
|
|
|
- return Enabled ? cs.HotNormal : cs.Disabled;
|
|
|
+ return Enabled ? GetColor (cs.HotNormal) : cs.Disabled;
|
|
|
}
|
|
|
|
|
|
/// <summary>Determines the current <see cref="ColorScheme"/> based on the <see cref="Enabled"/> value.</summary>
|
|
@@ -377,16 +395,23 @@ public partial class View // Drawing APIs
|
|
|
cs = new ();
|
|
|
}
|
|
|
|
|
|
- if (Diagnostics.HasFlag (ViewDiagnosticFlags.MouseEnter) && _mouseOver)
|
|
|
+ Attribute disabled = new (cs.Disabled.Foreground, cs.Disabled.Background);
|
|
|
+ if (Diagnostics.HasFlag (ViewDiagnosticFlags.MouseOver) && _mouseOver)
|
|
|
{
|
|
|
- // Make Normal and Disabled darker when the mouse is over the view
|
|
|
- cs = new ColorScheme (cs)
|
|
|
- {
|
|
|
- Normal = new (ColorScheme.Normal.Foreground.GetDarkerColor (), ColorScheme.Normal.Background.GetDarkerColor()),
|
|
|
- Disabled = new (ColorScheme.Disabled.Foreground.GetDarkerColor (), ColorScheme.Disabled.Background.GetDarkerColor ())
|
|
|
- };
|
|
|
+ disabled = new (disabled.Foreground.GetDarkerColor (), disabled.Background.GetDarkerColor ());
|
|
|
}
|
|
|
- return Enabled ? cs.Normal : cs.Disabled;
|
|
|
+ return Enabled ? GetColor (cs.Normal) : disabled;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Attribute GetColor (Attribute inputAttribute)
|
|
|
+ {
|
|
|
+ Attribute attr = inputAttribute;
|
|
|
+ if (HighlightStyle.HasFlag (HighlightStyle.Hover) && _mouseOver)
|
|
|
+ {
|
|
|
+ attr = new (inputAttribute.Foreground.GetHighlightColor (), inputAttribute.Background);
|
|
|
+ }
|
|
|
+
|
|
|
+ return attr;
|
|
|
}
|
|
|
|
|
|
/// <summary>Moves the drawing cursor to the specified <see cref="Viewport"/>-relative location in the view.</summary>
|
|
@@ -501,7 +526,7 @@ public partial class View // Drawing APIs
|
|
|
TextFormatter?.Draw (
|
|
|
drawRect,
|
|
|
HasFocus ? GetFocusColor () : GetNormalColor (),
|
|
|
- HasFocus ? ColorScheme.HotFocus : GetHotNormalColor (),
|
|
|
+ HasFocus ? GetHotFocusColor () : GetHotNormalColor (),
|
|
|
Rectangle.Empty
|
|
|
);
|
|
|
SetSubViewNeedsDisplay ();
|
|
@@ -513,7 +538,7 @@ public partial class View // Drawing APIs
|
|
|
if (_subviews is { } && SubViewNeedsDisplay)
|
|
|
{
|
|
|
IEnumerable<View> subviewsNeedingDraw;
|
|
|
- if (TabStop == TabBehavior.TabGroup && _subviews.Count(v => v.Arrangement.HasFlag (ViewArrangement.Overlapped)) > 0)
|
|
|
+ if (TabStop == TabBehavior.TabGroup && _subviews.Count (v => v.Arrangement.HasFlag (ViewArrangement.Overlapped)) > 0)
|
|
|
{
|
|
|
// TODO: This is a temporary hack to make overlapped non-Toplevels have a zorder. See also View.SetFocus
|
|
|
subviewsNeedingDraw = _subviews.Where (
|