IComponentFactory.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #nullable enable
  2. using System.Collections.Concurrent;
  3. using Terminal.Gui.App;
  4. namespace Terminal.Gui.Drivers;
  5. /// <summary>
  6. /// Base untyped interface for <see cref="IComponentFactory{T}"/> for methods that are not templated on low level
  7. /// console input type.
  8. /// </summary>
  9. public interface IComponentFactory
  10. {
  11. /// <summary>
  12. /// Create the <see cref="IConsoleOutput"/> class for the current driver implementation i.e. the class responsible for
  13. /// rendering <see cref="IOutputBuffer"/> into the console.
  14. /// </summary>
  15. /// <returns></returns>
  16. IConsoleOutput CreateOutput ();
  17. }
  18. /// <summary>
  19. /// Creates driver specific subcomponent classes (<see cref="IConsoleInput{T}"/>, <see cref="IInputProcessor"/> etc) for a
  20. /// <see cref="IMainLoopCoordinator"/>.
  21. /// </summary>
  22. /// <typeparam name="T"></typeparam>
  23. public interface IComponentFactory<T> : IComponentFactory
  24. {
  25. /// <summary>
  26. /// Create <see cref="IConsoleInput{T}"/> class for the current driver implementation i.e. the class responsible for reading
  27. /// user input from the console.
  28. /// </summary>
  29. /// <returns></returns>
  30. IConsoleInput<T> CreateInput ();
  31. /// <summary>
  32. /// Creates the <see cref="InputProcessor{T}"/> class for the current driver implementation i.e. the class responsible for
  33. /// translating raw console input into Terminal.Gui common event <see cref="Key"/> and <see cref="MouseEventArgs"/>.
  34. /// </summary>
  35. /// <param name="inputBuffer"></param>
  36. /// <returns></returns>
  37. IInputProcessor CreateInputProcessor (ConcurrentQueue<T> inputBuffer);
  38. /// <summary>
  39. /// Creates <see cref="IConsoleSizeMonitor"/> class for the current driver implementation i.e. the class responsible for
  40. /// reporting the current size of the terminal.
  41. /// </summary>
  42. /// <param name="consoleOutput"></param>
  43. /// <param name="outputBuffer"></param>
  44. /// <returns></returns>
  45. IConsoleSizeMonitor CreateConsoleSizeMonitor (IConsoleOutput consoleOutput, IOutputBuffer outputBuffer);
  46. }