diff --git a/Dalamud/ClientLanguageExtensions.cs b/Dalamud/ClientLanguageExtensions.cs index dccefb93f..abfba3ad5 100644 --- a/Dalamud/ClientLanguageExtensions.cs +++ b/Dalamud/ClientLanguageExtensions.cs @@ -10,8 +10,8 @@ namespace Dalamud /// /// Converts a Dalamud ClientLanguage to the corresponding Lumina variant. /// - /// Langauge to convert. - /// Converted langauge. + /// Language to convert. + /// Converted language. public static Lumina.Data.Language ToLumina(this ClientLanguage language) { return language switch diff --git a/Dalamud/Interface/Windowing/Window.cs b/Dalamud/Interface/Windowing/Window.cs index ff0a7b958..e1333e072 100644 --- a/Dalamud/Interface/Windowing/Window.cs +++ b/Dalamud/Interface/Windowing/Window.cs @@ -121,6 +121,28 @@ namespace Dalamud.Interface.Windowing this.IsOpen ^= true; } + /// + /// Code to always be executed before the open-state of the window is checked. + /// + public virtual void PreOpenCheck() + { + } + + /// + /// Additional conditions for the window to be drawn, regardless of its open-state. + /// + /// + /// True if the window should be drawn, false otherwise. + /// + /// + /// Not being drawn due to failing this condition will not change focus or trigger OnClose. + /// This is checked before PreDraw, but after Update. + /// + public virtual bool DrawConditions() + { + return true; + } + /// /// Code to be executed before conditionals are applied and the window is drawn. /// @@ -170,6 +192,8 @@ namespace Dalamud.Interface.Windowing /// internal void DrawInternal() { + this.PreOpenCheck(); + if (!this.IsOpen) { if (this.internalIsOpen != this.internalLastIsOpen) @@ -184,6 +208,8 @@ namespace Dalamud.Interface.Windowing } this.Update(); + if (!this.DrawConditions()) + return; var hasNamespace = !string.IsNullOrEmpty(this.Namespace);