DrawAdornmentsEventArgs.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #nullable enable
  2. namespace Terminal.Gui.ViewBase;
  3. /// <summary>
  4. /// Provides data for events that allow cancellation of adornment drawing in the Cancellable Work Pattern (CWP).
  5. /// </summary>
  6. /// <remarks>
  7. /// <para>
  8. /// Used in events raised by <see cref="View.DoDrawAdornments"/> to allow handlers to cancel the drawing
  9. /// of <see cref="View.Margin"/>, <see cref="View.Border"/>, and <see cref="View.Padding"/> adornments.
  10. /// </para>
  11. /// </remarks>
  12. /// <seealso cref="View.DrawAdornments"/>
  13. /// <seealso cref="CWPEventHelper"/>
  14. public class DrawAdornmentsEventArgs
  15. {
  16. /// <summary>
  17. /// Gets the draw context for tracking drawn regions, or null if not tracking.
  18. /// </summary>
  19. public DrawContext? Context { get; }
  20. /// <summary>
  21. /// Gets or sets a value indicating whether the adornment drawing is handled. If true, drawing is cancelled.
  22. /// </summary>
  23. public bool Handled { get; set; }
  24. /// <summary>
  25. /// Initializes a new instance of the <see cref="DrawAdornmentsEventArgs"/> class.
  26. /// </summary>
  27. /// <param name="context">The draw context, or null if not tracking.</param>
  28. public DrawAdornmentsEventArgs (DrawContext? context)
  29. {
  30. Context = context;
  31. }
  32. }