2
0

FocusEventArgs.cs 1.2 KB

123456789101112131415161718192021222324
  1. namespace Terminal.Gui.ViewBase;
  2. // TODO: CWP: FocusChanging should use an event arg type derived from ResultEventArgs<bool> so that its more obvious
  3. // TODO: the result can be changed.
  4. /// <summary>The event arguments for <see cref="View.HasFocus"/> events.</summary>
  5. public class HasFocusEventArgs : CancelEventArgs<bool>
  6. {
  7. /// <summary>Initializes a new instance.</summary>
  8. /// <param name="currentHasFocus">The current value of <see cref="View.HasFocus"/>.</param>
  9. /// <param name="newHasFocus">The value <see cref="View.HasFocus"/> will have if the event is not cancelled.</param>
  10. /// <param name="currentFocused">The view that is losing focus.</param>
  11. /// <param name="newFocused">The view that is gaining focus.</param>
  12. public HasFocusEventArgs (bool currentHasFocus, bool newHasFocus, View? currentFocused, View? newFocused) : base (ref currentHasFocus, ref newHasFocus)
  13. {
  14. CurrentFocused = currentFocused;
  15. NewFocused = newFocused;
  16. }
  17. /// <summary>Gets or sets the view that is losing focus.</summary>
  18. public View? CurrentFocused { get; set; }
  19. /// <summary>Gets or sets the view that is gaining focus.</summary>
  20. public View? NewFocused { get; set; }
  21. }