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);