IOrientation.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #nullable enable
  2. namespace Terminal.Gui;
  3. using System;
  4. /// <summary>
  5. /// Implement this interface to provide orientation support.
  6. /// </summary>
  7. /// <remarks>
  8. /// See <see cref="OrientationHelper"/> for a helper class that implements this interface.
  9. /// </remarks>
  10. public interface IOrientation
  11. {
  12. /// <summary>
  13. /// Gets or sets the orientation of the View.
  14. /// </summary>
  15. Orientation Orientation { get; set; }
  16. /// <summary>
  17. /// Raised when <see cref="Orientation"/> is changing. Can be cancelled.
  18. /// </summary>
  19. public event EventHandler<CancelEventArgs<Orientation>>? OrientationChanging;
  20. /// <summary>
  21. /// Called when <see cref="Orientation"/> is changing.
  22. /// </summary>
  23. /// <param name="currentOrientation">The current orientation.</param>
  24. /// <param name="newOrientation">The new orientation.</param>
  25. /// <returns><see langword="true"/> to cancel the change.</returns>
  26. public bool OnOrientationChanging (Orientation currentOrientation, Orientation newOrientation) { return false; }
  27. /// <summary>
  28. /// Raised when <see cref="Orientation"/> has changed.
  29. /// </summary>
  30. public event EventHandler<EventArgs<Orientation>>? OrientationChanged;
  31. /// <summary>
  32. /// Called when <see cref="Orientation"/> has been changed.
  33. /// </summary>
  34. /// <param name="newOrientation"></param>
  35. /// <returns></returns>
  36. public void OnOrientationChanged (Orientation newOrientation) { return; }
  37. }