// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using System.Drawing; using JetBrains.Annotations; using osu.Framework.Bindables; using osu.Framework.Configuration; namespace osu.Framework.Platform { /// /// Interface representation of the game window, intended to hide any implementation-specific code. /// public interface IWindow : IDisposable { /// /// Cycles through the available s as determined by . /// void CycleMode(); /// /// Configures the based on the provided . /// /// The configuration manager to use. void SetupWindow(FrameworkConfigManager config); /// /// Creates the concrete window implementation. /// void Create(); /// /// Return value decides whether we should intercept and cancel this exit (if possible). /// [CanBeNull] event Func ExitRequested; /// /// Invoked when the has closed. /// [CanBeNull] event Action Exited; /// /// Invoked when the client size has changed. /// [CanBeNull] event Action Resized; /// /// Whether the OS cursor is currently contained within the game window. /// IBindable CursorInWindow { get; } /// /// Controls the state of the OS cursor. /// CursorState CursorState { get; set; } /// /// Controls the state of the window. /// WindowState WindowState { get; set; } /// /// Controls the vertical sync mode of the screen. /// bool VerticalSync { get; set; } /// /// Returns the default for the implementation. /// WindowMode DefaultWindowMode { get; } /// /// Whether this is active (in the foreground). /// IBindable IsActive { get; } /// /// Provides a that can be used to keep track of the "safe area" insets on mobile /// devices. This usually corresponds to areas of the screen hidden under notches and rounded corners. /// The safe area insets are provided by the operating system and dynamically change as the user rotates the device. /// BindableSafeArea SafeAreaPadding { get; } /// /// The s supported by this implementation. /// IBindableList SupportedWindowModes { get; } /// /// Provides a that manages the current window mode. /// Supported window modes for the current platform can be retrieved via . /// Bindable WindowMode { get; } /// /// Exposes the physical displays as an . /// IEnumerable Displays { get; } /// /// Gets the that has been set as "primary" or "default" in the operating system. /// Display PrimaryDisplay { get; } /// /// Exposes the that this window is currently on as a . /// Bindable CurrentDisplayBindable { get; } /// /// The for the display that this window is currently on. /// IBindable CurrentDisplayMode { get; } /// /// Makes this window the current graphics context, if appropriate for the driver. /// void MakeCurrent(); /// /// Clears the current graphics context, if appropriate for the driver. /// void ClearCurrent(); /// /// Request close. /// void Close(); /// /// Start the window's run loop. Is a blocking call. /// void Run(); /// /// Requests that the graphics backend perform a buffer swap. /// void SwapBuffers(); /// /// Whether the window currently has focus. /// bool Focused { get; } /// /// Convert a screen based coordinate to local window space. /// /// Point PointToClient(Point point); /// /// Convert a window based coordinate to global screen space. /// /// Point PointToScreen(Point point); /// /// The client size of the window (excluding any window decoration/border). /// Size ClientSize { get; } /// /// The window title. /// string Title { get; set; } } }