IKeyConverter.cs 942 B

123456789101112131415161718192021222324252627
  1. 
  2. namespace Terminal.Gui.Drivers;
  3. /// <summary>
  4. /// Interface for subcomponent of a <see cref="InputProcessorImpl{T}"/> which
  5. /// can translate the raw console input type T (which typically varies by
  6. /// driver) to the shared Terminal.Gui <see cref="Key"/> class.
  7. /// </summary>
  8. /// <typeparam name="TInputRecord"></typeparam>
  9. public interface IKeyConverter<TInputRecord>
  10. {
  11. /// <summary>
  12. /// Converts the native keyboard info type into
  13. /// the <see cref="Key"/> class used by Terminal.Gui views.
  14. /// </summary>
  15. /// <param name="keyInfo"></param>
  16. /// <returns></returns>
  17. Key ToKey (TInputRecord keyInfo);
  18. /// <summary>
  19. /// Converts a <see cref="Key"/> into the native keyboard info type. Should be used for simulating
  20. /// key presses in unit tests.
  21. /// </summary>
  22. /// <param name="key"></param>
  23. /// <returns></returns>
  24. TInputRecord ToKeyInfo (Key key);
  25. }