IOrientation.cs 1.5 KB

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