Removed HighlightEventArgs

This commit is contained in:
Tig
2024-06-30 12:57:29 -07:00
parent 50356cf14a
commit e834dfcd1c
6 changed files with 8 additions and 18 deletions

View File

@@ -220,7 +220,7 @@ public class Border : Adornment
private Color? _savedForeColor;
private void Border_Highlight (object sender, HighlightEventArgs e)
private void Border_Highlight (object sender, CancelEventArgs<HighlightStyle> e)
{
if (!Parent.Arrangement.HasFlag (ViewArrangement.Movable))
{

View File

@@ -39,7 +39,7 @@ public class Margin : Adornment
}
private bool _pressed;
private void Margin_Highlight (object? sender, HighlightEventArgs e)
private void Margin_Highlight (object? sender, CancelEventArgs<HighlightStyle> e)
{
if (ShadowStyle != Gui.ShadowStyle.None)
{

View File

@@ -1,10 +0,0 @@
namespace Terminal.Gui;
/// <summary>
/// Event arguments for the <see cref="View.Highlight"/> event.
/// </summary>
public class HighlightEventArgs : CancelEventArgs<HighlightStyle>
{
/// <inheritdoc />
public HighlightEventArgs (ref HighlightStyle currentValue, ref HighlightStyle newValue) : base (ref currentValue, ref newValue) { }
}

View File

@@ -11,7 +11,7 @@ public partial class View
/// Fired when the view is highlighted. Set <see cref="CancelEventArgs.Cancel"/> to <see langword="true"/>
/// to implement a custom highlight scheme or prevent the view from being highlighted.
/// </summary>
public event EventHandler<HighlightEventArgs> Highlight;
public event EventHandler<CancelEventArgs<HighlightStyle>> Highlight;
/// <summary>
/// Gets or sets whether the <see cref="View"/> will be highlighted visually while the mouse button is
@@ -211,7 +211,7 @@ public partial class View
/// Called when the view is to be highlighted.
/// </summary>
/// <returns><see langword="true"/>, if the event was handled, <see langword="false"/> otherwise.</returns>
protected virtual bool? OnHighlight (HighlightEventArgs args)
protected virtual bool? OnHighlight (CancelEventArgs<HighlightStyle> args)
{
Highlight?.Invoke (this, args);
@@ -442,7 +442,7 @@ public partial class View
// Enable override via virtual method and/or event
HighlightStyle copy = HighlightStyle;
var args = new HighlightEventArgs (ref copy, ref newHighlightStyle);
var args = new CancelEventArgs<HighlightStyle> (ref copy, ref newHighlightStyle);
if (OnHighlight (args) == true)
{

View File

@@ -295,7 +295,7 @@ public class Shortcut : View
private Color? _savedForeColor;
private void Shortcut_Highlight (object sender, HighlightEventArgs e)
private void Shortcut_Highlight (object sender, CancelEventArgs<HighlightStyle> e)
{
if (e.CurrentValue.HasFlag (HighlightStyle.Pressed))
{

View File

@@ -566,7 +566,7 @@ public class MouseTests (ITestOutputHelper output) : TestsAllViews
return;
void View_Highlight (object sender, HighlightEventArgs e)
void View_Highlight (object sender, CancelEventArgs<HighlightStyle> e)
{
if (e.NewValue == HighlightStyle.None)
{
@@ -635,7 +635,7 @@ public class MouseTests (ITestOutputHelper output) : TestsAllViews
return;
void View_Highlight (object sender, HighlightEventArgs e)
void View_Highlight (object sender, CancelEventArgs<HighlightStyle> e)
{
if (e.NewValue == HighlightStyle.None)
{