mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Add two customization points for the window system that are executed always and that can control whether the window is drawn without toggling state.
This commit is contained in:
parent
8fbe8dd213
commit
fa4c57c886
1 changed files with 26 additions and 0 deletions
|
|
@ -121,6 +121,28 @@ namespace Dalamud.Interface.Windowing
|
|||
this.IsOpen ^= true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Code to always be executed before the open-state of the window is checked.
|
||||
/// </summary>
|
||||
public virtual void PreOpenCheck()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Additional conditions for the window to be drawn, regardless of its open-state.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// True if the window should be drawn, false otherwise.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// Not being drawn due to failing this condition will not change focus or trigger OnClose.
|
||||
/// This is checked before PreDraw, but after Update.
|
||||
/// </remarks>
|
||||
public virtual bool DrawConditions()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Code to be executed before conditionals are applied and the window is drawn.
|
||||
/// </summary>
|
||||
|
|
@ -170,6 +192,8 @@ namespace Dalamud.Interface.Windowing
|
|||
/// </summary>
|
||||
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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue