Minor formatting changes

This commit is contained in:
Critical Impact 2025-09-05 16:19:32 +10:00
parent 2dd9ecd8e8
commit 660781393e
6 changed files with 40 additions and 24 deletions

View file

@ -1,7 +1,3 @@
// <copyright file="IWindow.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System.Collections.Generic;
using System.Numerics;
@ -27,7 +23,7 @@ public interface IWindow
string WindowName { get; set; }
/// <summary>
/// Gets a value indicating whether the window is focused.
/// Gets or sets a value indicating whether the window is focused.
/// </summary>
bool IsFocused { get; set; }
@ -137,7 +133,7 @@ public interface IWindow
bool IsOpen { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this window will request focus from the window system next frame
/// Gets or sets a value indicating whether this window will request focus from the window system next frame.
/// </summary>
public bool RequestFocus { get; set; }
@ -199,7 +195,7 @@ public interface IWindow
/// <summary>
/// Code to be executed when the window is safe to be disposed or removed from the window system.
/// Doing so in <see cref="WindowHost.OnClose"/> may result in animations not playing correctly.
/// Doing so in <see cref="IWindow.OnClose"/> may result in animations not playing correctly.
/// </summary>
void OnSafeToRemove();

View file

@ -1,11 +1,10 @@
// <copyright file="IWindowSystem.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System.Collections.Generic;
namespace Dalamud.Interface.Windowing;
/// <summary>
/// Class running a WindowSystem using <see cref="IWindow"/> implementations to simplify ImGui windowing.
/// </summary>
public interface IWindowSystem
{
/// <summary>

View file

@ -9,7 +9,7 @@ namespace Dalamud.Interface.Windowing;
public abstract class Window : IWindow
{
/// <summary>
/// Initializes a new instance of the <see cref="WindowHost"/> class.
/// Initializes a new instance of the <see cref="Window"/> class.
/// </summary>
/// <param name="name">The name/ID of this window.
/// If you have multiple windows with the same name, you will need to
@ -25,7 +25,7 @@ public abstract class Window : IWindow
}
/// <summary>
/// Initializes a new instance of the <see cref="WindowHost"/> class.
/// Initializes a new instance of the <see cref="Window"/> class.
/// </summary>
/// <param name="name">The name/ID of this window.
/// If you have multiple windows with the same name, you will need to
@ -36,7 +36,6 @@ public abstract class Window : IWindow
{
}
/// <inheritdoc/>
public string? Namespace { get; set; }

View file

@ -51,6 +51,10 @@ public class WindowHost
private Vector2 fadeOutSize = Vector2.Zero;
private Vector2 fadeOutOrigin = Vector2.Zero;
/// <summary>
/// Initializes a new instance of the <see cref="WindowHost"/> class.
/// </summary>
/// <param name="window">A plugin provided window.</param>
internal WindowHost(IWindow window)
{
this.Window = window;
@ -88,10 +92,13 @@ public class WindowHost
IsReducedMotion = 1 << 3,
}
private bool CanShowCloseButton => this.Window.ShowCloseButton && !this.internalIsClickthrough;
/// <summary>
/// Gets or sets the backing window provided by the plugin.
/// </summary>
public IWindow Window { get; set; }
private bool CanShowCloseButton => this.Window.ShowCloseButton && !this.internalIsClickthrough;
/// <summary>
/// Draw the window via ImGui.
/// </summary>
@ -158,12 +165,13 @@ public class WindowHost
UIGlobals.PlaySoundEffect(this.Window.OnOpenSfxId);
}
//TODO: We may have to allow for windows to configure if they should fade
// TODO: We may have to allow for windows to configure if they should fade
if (this.internalAlpha.HasValue)
{
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, this.internalAlpha.Value);
this.didPushInternalAlpha = true;
}
this.Window.PreDraw();
this.ApplyConditionals();
@ -404,6 +412,7 @@ public class WindowHost
ImGui.PopStyleVar();
this.didPushInternalAlpha = false;
}
this.Window.PostDraw();
this.PostHandlePreset(persistence);
@ -439,8 +448,7 @@ public class WindowHost
var (min, max) = this.GetValidatedConstraints(this.Window.SizeConstraints.Value);
ImGui.SetNextWindowSizeConstraints(
min * ImGuiHelpers.GlobalScale,
max * ImGuiHelpers.GlobalScale
);
max * ImGuiHelpers.GlobalScale);
}
var maxBgAlpha = this.internalAlpha ?? this.Window.BgAlpha;
@ -460,7 +468,7 @@ public class WindowHost
}
}
private (Vector2 min, Vector2 max) GetValidatedConstraints(WindowSizeConstraints constraints)
private (Vector2 Min, Vector2 Max) GetValidatedConstraints(WindowSizeConstraints constraints)
{
var min = constraints.MinimumSize;
var max = constraints.MaximumSize;
@ -472,7 +480,6 @@ public class WindowHost
return (min, max);
}
private void PreHandlePreset(WindowSystemPersistence? persistence)
{
if (persistence == null || this.hasInitializedFromPreset)

View file

@ -2,8 +2,25 @@ using System.Numerics;
namespace Dalamud.Interface.Windowing;
/// <summary>
/// Structure detailing the size constraints of a window.
/// </summary>
public struct WindowSizeConstraints
{
/// <summary>
/// Initializes a new instance of the <see cref="WindowSizeConstraints"/> struct.
/// </summary>
public WindowSizeConstraints()
{
}
/// <summary>
/// Gets or sets the minimum size of the window.
/// </summary>
public Vector2 MinimumSize { get; set; }
/// <summary>
/// Gets or sets the maximum size of the window.
/// </summary>
public Vector2 MaximumSize { get; set; }
}

View file

@ -8,9 +8,7 @@ using Serilog;
namespace Dalamud.Interface.Windowing;
/// <summary>
/// Class running a WindowSystem using <see cref="IWindow"/> implementations to simplify ImGui windowing.
/// </summary>
/// <inheritdoc/>
public class WindowSystem : IWindowSystem
{
private static DateTimeOffset lastAnyFocus;