#nullable enable using System.Collections.Concurrent; namespace Terminal.Gui.App; /// /// Interface for the main application loop that runs the core Terminal.Gui UI rendering and event processing. /// /// /// This interface defines the contract for the main loop that coordinates: /// /// Processing input events from the console /// Running user timeout callbacks /// Detecting UI changes that need redrawing /// Rendering UI updates to the console /// /// /// Type of raw input events processed by the loop, e.g. for cross-platform .NET driver public interface IApplicationMainLoop : IDisposable { /// /// Gets the class responsible for servicing user timeouts /// public ITimedEvents TimedEvents { get; } /// /// Gets the class responsible for writing final rendered output to the console /// public IOutputBuffer OutputBuffer { get; } /// /// Class for writing output to the console. /// public IConsoleOutput Out { get; } /// /// Gets the class responsible for processing buffered console input and translating /// it into events on the UI thread. /// public IInputProcessor InputProcessor { get; } /// /// Gets the class responsible for sending ANSI escape requests which expect a response /// from the remote terminal e.g. Device Attribute Request /// public AnsiRequestScheduler AnsiRequestScheduler { get; } /// /// Gets the class responsible for determining the current console size /// public IConsoleSizeMonitor ConsoleSizeMonitor { get; } /// /// Initializes the loop with a buffer from which data can be read /// /// /// /// /// /// void Initialize ( ITimedEvents timedEvents, ConcurrentQueue inputBuffer, IInputProcessor inputProcessor, IConsoleOutput consoleOutput, IComponentFactory componentFactory ); /// /// Perform a single iteration of the main loop then blocks for a fixed length /// of time, this method is designed to be run in a loop. /// public void Iteration (); }