qstbak/Questionable/Questionable.Windows.ChangelogComponents/ChangelogFooterComponent.cs
2026-08-17 20:29:32 +10:00

51 lines
1.8 KiB
C#

using System;
using System.Numerics;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Utility.Raii;
namespace Questionable.Windows.ChangelogComponents;
internal sealed class ChangelogFooterComponent
{
public static void Draw(Action onConfirm)
{
ImDrawListPtr windowDrawList = ImGui.GetWindowDrawList();
Vector2 cursorScreenPos = ImGui.GetCursorScreenPos();
float x = ImGui.GetContentRegionAvail().X;
Vector2 pMax = cursorScreenPos + new Vector2(x, 2f);
Vector4 accentColor = UiThemeUtils.AccentColor;
accentColor.W = 0.4f;
uint colUprLeft = ImGui.ColorConvertFloat4ToU32(accentColor);
uint colUprRight = ImGui.ColorConvertFloat4ToU32(UiThemeUtils.AccentColor);
uint colBotRight = ImGui.ColorConvertFloat4ToU32(UiThemeUtils.AccentColor);
accentColor = UiThemeUtils.AccentColor;
accentColor.W = 0.4f;
windowDrawList.AddRectFilledMultiColor(cursorScreenPos, pMax, colUprLeft, colUprRight, colBotRight, ImGui.ColorConvertFloat4ToU32(accentColor));
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 8f);
float x2;
using (ImRaii.PushFont(UiBuilder.IconFont))
{
x2 = ImGui.CalcTextSize(FontAwesomeIcon.CheckCircle.ToIconString()).X;
}
float num = x2 + 6f + ImGui.CalcTextSize("Got It!").X + ImGui.GetStyle().FramePadding.X * 2f;
float num2 = (ImGui.GetContentRegionAvail().X - num) * 0.5f;
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + num2);
using (ImRaii.PushColor(ImGuiCol.Button, UiThemeUtils.PlayButtonColor))
{
using (ImRaii.PushColor(ImGuiCol.ButtonHovered, UiThemeUtils.PlayButtonHover))
{
using (ImRaii.PushColor(ImGuiCol.ButtonActive, UiThemeUtils.PlayButtonActive))
{
using (ImRaii.PushColor(ImGuiCol.Text, UiThemeUtils.PlayButtonText))
{
if (UiThemeUtils.IconTextButton(FontAwesomeIcon.CheckCircle, "Got It!", num))
{
onConfirm();
}
}
}
}
}
}
}