using System; using System.Collections.Generic; using Robust.Client.Audio.Sources; using Robust.Client.Graphics; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; using Robust.Shared; using Robust.Shared.Audio.Sources; using Robust.Shared.Log; using Robust.Shared.Map; using Robust.Shared.Maths; namespace Robust.Client.UserInterface { [NotContentImplementable] public partial interface IUserInterfaceManager { void InitializeTesting(); InterfaceTheme ThemeDefaults { get; } /// /// Default style sheet that applies to all controls /// that do not have a more specific style sheet via . /// Stylesheet? Stylesheet { get; set; } /// /// A control can have "keyboard focus" separate from ControlFocused, obtained when calling /// Control.GrabKeyboardFocus. Corresponding events in Control are KeyboardFocusEntered/Exited /// Control? KeyboardFocused { get; } /// /// A control gets "ControlFocused" when a mouse button (or any KeyBinding which has CanFocus = true) is /// pressed down on the control. While it is focused, it will receive mouse hover events and the corresponding /// keyup event if it still has focus when that occurs (it will NOT receive the keyup if focus has /// been taken by another control). Focus is removed when a different control takes focus /// (such as by pressing a different mouse button down over a different control) or when the keyup event /// happens. When focus is lost on a control, it always fires Control.ControlFocusExited. /// Control? ControlFocused { get; set; } public void PostInitialize(); ViewportContainer MainViewport { get; } LayoutContainer StateRoot { get; } LayoutContainer WindowRoot { get; } LayoutContainer PopupRoot { get; } PopupContainer ModalRoot { get; } Control? CurrentlyHovered { get; } /// /// Gets the default UIScale that we will use if gets set to 0. /// Based on the OS-assigned window scale factor. /// float DefaultUIScale { get; } /// /// The root control for the main game window. /// WindowRoot RootControl { get; } IDebugMonitors DebugMonitors { get; } void Popup(string contents, string? title = null, bool clipboardButton = true); Control? MouseGetControl(ScreenCoordinates coordinates); /// /// Gets the mouse position in UI space, accounting for . /// ScreenCoordinates MousePositionScaled { get; } ScreenCoordinates ScreenToUIPosition(ScreenCoordinates coordinates); /// /// Give a control keyboard focus, releasing focus on the currently focused control (if any). /// /// The control to give keyboard focus to. /// Thrown if is null. /// /// Thrown if has false. /// void GrabKeyboardFocus(Control control); /// /// Release keyboard focus from the currently focused control, if any. /// void ReleaseKeyboardFocus(); /// /// Conditionally release keyboard focus if has keyboard focus. /// /// /// Thrown if is null. /// /// void ReleaseKeyboardFocus(Control ifControl); /// /// Cursor automatically used when the mouse is not over any UI control. /// ICursor? WorldCursor { get; set; } void PushModal(Control modal); WindowRoot CreateWindowRoot(IClydeWindow window); void DestroyWindowRoot(IClydeWindow window); /// /// Get the UI root associated with a window. /// /// Null if the window has no UI root. WindowRoot? GetWindowRoot(IClydeWindow window); IEnumerable AllRoots { get; } event Action OnPostDrawUIRoot; void DeferAction(Action action); public event Action? OnKeyBindDown; void SetClickSound(IAudioSource? source); /// /// Plays the UI click sound if relevant /// void ClickSound(); void SetHoverSound(IAudioSource? source); /// /// Plays the UI hover sound if relevant. /// void HoverSound(); /// /// Sets to the given control. /// void SetHovered(Control? control); /// /// Forces to get updated. This is done automatically when the mouse is moved, /// but not necessarily a new or existing control is rearranged. /// void UpdateHovered(); /// /// Render a control and all of its children. /// void RenderControl(in Control.ControlRenderArguments args, Control control); /// /// Render a control and all of its children. /// void RenderControl(IRenderHandle handle, Control control, Vector2i position); /// /// Sawmill for use by controls. /// /// /// Exists so that control don't have to inject dependencies or otherwise obtain an instance just to log errors. /// ISawmill ControlSawmill { get; } /// /// Get the UI root responsible for the current mouse position. /// /// /// This is useful to open popups or similar on the current active window. /// UIRoot GetRootForMouse(); } public readonly struct PostDrawUIRootEventArgs { public readonly UIRoot Root; public readonly DrawingHandleScreen DrawingHandle; public PostDrawUIRootEventArgs(UIRoot root, DrawingHandleScreen drawingHandle) { Root = root; DrawingHandle = drawingHandle; } } }