IComponentFactory.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System.Collections.Concurrent;
  2. namespace Terminal.Gui.Drivers;
  3. /// <summary>
  4. /// Base untyped interface for <see cref="IComponentFactory{T}"/> for methods that are not templated on low level
  5. /// console input type.
  6. /// </summary>
  7. public interface IComponentFactory
  8. {
  9. /// <summary>
  10. /// Create the <see cref="IOutput"/> class for the current driver implementation i.e. the class responsible for
  11. /// rendering <see cref="IOutputBuffer"/> into the console.
  12. /// </summary>
  13. /// <returns></returns>
  14. IOutput CreateOutput ();
  15. }
  16. /// <summary>
  17. /// Creates driver specific subcomponent classes (<see cref="IInput{TInputRecord}"/>, <see cref="IInputProcessor"/>
  18. /// etc) for a
  19. /// <see cref="IMainLoopCoordinator"/>.
  20. /// </summary>
  21. /// <typeparam name="TInputRecord">
  22. /// The platform specific console input type. Must be a value type (struct).
  23. /// Valid types are <see cref="ConsoleKeyInfo"/>, <see cref="WindowsConsole.InputRecord"/>, and <see cref="char"/>.
  24. /// </typeparam>
  25. public interface IComponentFactory<TInputRecord> : IComponentFactory
  26. where TInputRecord : struct
  27. {
  28. /// <summary>
  29. /// Create <see cref="IInput{T}"/> class for the current driver implementation i.e. the class responsible for reading
  30. /// user input from the console.
  31. /// </summary>
  32. /// <returns></returns>
  33. IInput<TInputRecord> CreateInput ();
  34. /// <summary>
  35. /// Creates the <see cref="InputProcessorImpl{T}"/> class for the current driver implementation i.e. the class
  36. /// responsible for
  37. /// translating raw console input into Terminal.Gui common event <see cref="Key"/> and <see cref="MouseEventArgs"/>.
  38. /// </summary>
  39. /// <param name="inputQueue">
  40. /// The input queue containing raw console input events, populated by <see cref="IInput{TInputRecord}"/>
  41. /// implementations on the input thread and
  42. /// read by <see cref="IInputProcessor"/> on the main loop thread.
  43. /// </param>
  44. /// <returns></returns>
  45. IInputProcessor CreateInputProcessor (ConcurrentQueue<TInputRecord> inputQueue);
  46. /// <summary>
  47. /// Creates <see cref="ISizeMonitor"/> class for the current driver implementation i.e. the class responsible for
  48. /// reporting the current size of the terminal.
  49. /// </summary>
  50. /// <param name="consoleOutput"></param>
  51. /// <param name="outputBuffer"></param>
  52. /// <returns></returns>
  53. ISizeMonitor CreateSizeMonitor (IOutput consoleOutput, IOutputBuffer outputBuffer);
  54. }