#nullable enable namespace Terminal.Gui.App; public static partial class Application // Screen related stuff; intended to hide Driver details { /// /// Gets or sets the size of the screen. By default, this is the size of the screen as reported by the . /// /// /// /// If the has not been initialized, this will return a default size of 2048x2048; useful for unit tests. /// /// public static Rectangle Screen { get => ApplicationImpl.Instance.Screen; set => ApplicationImpl.Instance.Screen = value; } /// Invoked when the terminal's size changed. The new size of the terminal is provided. /// /// Event handlers can set to to prevent /// from changing it's size to match the new terminal size. /// public static event EventHandler? SizeChanging { add { if (ApplicationImpl.Instance is ApplicationImpl impl) { impl.SizeChanging += value; } } remove { if (ApplicationImpl.Instance is ApplicationImpl impl) { impl.SizeChanging -= value; } } } // Internal helper method for ApplicationImpl.ResetState to clear this event internal static void ClearSizeChangingEvent () { if (ApplicationImpl.Instance is ApplicationImpl impl) { impl.SizeChanging = null; } } /// /// Called when the application's size changes. Sets the size of all s and fires the /// event. /// /// The new size. /// if the size was changed. public static bool OnSizeChanging (SizeChangedEventArgs args) { return ApplicationImpl.Instance.OnSizeChanging (args); } /// /// Gets or sets whether the screen will be cleared, and all Views redrawn, during the next Application iteration. /// /// /// This is typical set to true when a View's changes and that view has no /// SuperView (e.g. when is moved or resized. /// internal static bool ClearScreenNextIteration { get => ApplicationImpl.Instance.ClearScreenNextIteration; set => ApplicationImpl.Instance.ClearScreenNextIteration = value; } }