mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
feat: add Window.BringToFront()
This commit is contained in:
parent
261d8a167f
commit
636a6ae775
1 changed files with 18 additions and 0 deletions
|
|
@ -15,6 +15,7 @@ public abstract class Window
|
|||
|
||||
private bool internalLastIsOpen = false;
|
||||
private bool internalIsOpen = false;
|
||||
private bool nextFrameBringToFront = false;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Window"/> class.
|
||||
|
|
@ -126,6 +127,17 @@ public abstract class Window
|
|||
this.IsOpen ^= true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bring this window to the front.
|
||||
/// </summary>
|
||||
public void BringToFront()
|
||||
{
|
||||
if (!this.IsOpen)
|
||||
return;
|
||||
|
||||
this.nextFrameBringToFront = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Code to always be executed before the open-state of the window is checked.
|
||||
/// </summary>
|
||||
|
|
@ -241,6 +253,12 @@ public abstract class Window
|
|||
ImGui.PushStyleColor(ImGuiCol.TitleBgCollapsed, focusedHeaderColor);
|
||||
}
|
||||
|
||||
if (this.nextFrameBringToFront)
|
||||
{
|
||||
ImGui.SetNextWindowFocus();
|
||||
this.nextFrameBringToFront = false;
|
||||
}
|
||||
|
||||
if (this.ShowCloseButton ? ImGui.Begin(this.WindowName, ref this.internalIsOpen, this.Flags) : ImGui.Begin(this.WindowName, this.Flags))
|
||||
{
|
||||
// Draw the actual window contents
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue