IComponentFactory.cs 2.0 KB

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