namespace Terminal.Gui.Drawing;
using System;
#pragma warning disable CS1711
///
/// Provides data for cancellable workflow events that resolve an for a specific
/// in the Cancellable Work Pattern (CWP).
///
///
///
/// Used in events like to allow customization or cancellation
/// of attribute resolution for a , such as determining the appearance of a
/// based on its state (e.g., focused, disabled).
///
///
/// Inherits from with T = , providing a
/// cancellable result workflow where event handlers can supply a custom or mark
/// the operation as handled.
///
///
/// The type of the result, constrained to .
///
///
/// View view = new();
/// view.GettingAttributeForRole += (sender, args) =>
/// {
/// if (args.Role == VisualRole.Focus)
/// {
/// args.Result = new Attribute(Color.BrightCyan, Color.Black);
/// args.Handled = true;
/// }
/// };
/// Attribute attribute = view.GetAttributeForRole(VisualRole.Focus);
///
///
///
///
///
///
public class VisualRoleEventArgs : ResultEventArgs
{
///
/// Gets the for which an is being resolved.
///
public VisualRole Role { get; }
///
/// Initializes a new instance of the class with the specified
/// and initial result.
///
/// The for which the attribute is being resolved.
/// The initial attribute result, which may be null if no result is provided.
public VisualRoleEventArgs (in VisualRole role, Attribute? result)
: base (result)
{
Role = role;
}
}
#pragma warning restore CS1711