mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Merge pull request #767 from Ottermandias/WindowExtensions
This commit is contained in:
commit
bbeb188711
2 changed files with 28 additions and 2 deletions
|
|
@ -10,8 +10,8 @@ namespace Dalamud
|
|||
/// <summary>
|
||||
/// Converts a Dalamud ClientLanguage to the corresponding Lumina variant.
|
||||
/// </summary>
|
||||
/// <param name="language">Langauge to convert.</param>
|
||||
/// <returns>Converted langauge.</returns>
|
||||
/// <param name="language">Language to convert.</param>
|
||||
/// <returns>Converted language.</returns>
|
||||
public static Lumina.Data.Language ToLumina(this ClientLanguage language)
|
||||
{
|
||||
return language switch
|
||||
|
|
|
|||
|
|
@ -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