From 92db028e01ed59ab41f26605a7f83dfe4f534567 Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Sat, 11 Nov 2023 02:36:47 +0100 Subject: [PATCH] Move config button to titlebar --- Deliveroo/Windows/TurnInWindow.cs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Deliveroo/Windows/TurnInWindow.cs b/Deliveroo/Windows/TurnInWindow.cs index d7bd4ad..5357aa4 100644 --- a/Deliveroo/Windows/TurnInWindow.cs +++ b/Deliveroo/Windows/TurnInWindow.cs @@ -24,7 +24,6 @@ internal sealed class TurnInWindow : LImGui.LWindow private readonly Configuration _configuration; private readonly ICondition _condition; private readonly GcRewardsCache _gcRewardsCache; - private readonly ConfigWindow _configWindow; public TurnInWindow(DeliverooPlugin plugin, DalamudPluginInterface pluginInterface, Configuration configuration, ICondition condition, GcRewardsCache gcRewardsCache, ConfigWindow configWindow) @@ -35,7 +34,6 @@ internal sealed class TurnInWindow : LImGui.LWindow _configuration = configuration; _condition = condition; _gcRewardsCache = gcRewardsCache; - _configWindow = configWindow; Position = new Vector2(100, 100); PositionCondition = ImGuiCond.FirstUseEver; @@ -49,6 +47,20 @@ internal sealed class TurnInWindow : LImGui.LWindow Flags = ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoCollapse; ShowCloseButton = false; AllowClickthrough = false; + + TitleBarButtons.Add(new TitleBarButton + { + Icon = FontAwesomeIcon.Cog, + IconOffset = new Vector2(1.5f, 1), + Click = _ => configWindow.IsOpen = true, + Priority = int.MinValue, + ShowTooltip = () => + { + ImGui.BeginTooltip(); + ImGui.Text("Open Configuration"); + ImGui.EndTooltip(); + } + }); } public bool State { get; set; } @@ -117,10 +129,6 @@ internal sealed class TurnInWindow : LImGui.LWindow State = state; } - ImGui.SameLine(); - if (ImGuiComponents.IconButton("###OpenConfig", FontAwesomeIcon.Cog)) - _configWindow.IsOpen = true; - ImGui.Indent(27); if (!string.IsNullOrEmpty(Error)) {