beep
This commit is contained in:
parent
bdd89607a1
commit
8fc555e5de
37
client/Ui/ImGuiExt.cs
Normal file
37
client/Ui/ImGuiExt.cs
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
using Dalamud.Interface;
|
||||||
|
using ImGuiNET;
|
||||||
|
|
||||||
|
namespace OrangeGuidanceTomestone.Ui;
|
||||||
|
|
||||||
|
internal static class ImGuiExt {
|
||||||
|
internal static bool SmallIconButton(FontAwesomeIcon icon, string? id = null) {
|
||||||
|
var label = icon.ToIconString();
|
||||||
|
if (id != null) {
|
||||||
|
label += $"##{id}";
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.PushFont(UiBuilder.IconFont);
|
||||||
|
var ret = ImGui.SmallButton(label);
|
||||||
|
ImGui.PopFont();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void HelpIcon(string text) {
|
||||||
|
var colour = ImGui.GetStyle().Colors[(int) ImGuiCol.TextDisabled];
|
||||||
|
ImGui.PushStyleColor(ImGuiCol.Text, colour);
|
||||||
|
ImGui.TextUnformatted("(?)");
|
||||||
|
ImGui.PopStyleColor();
|
||||||
|
|
||||||
|
if (!ImGui.IsItemHovered()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var width = ImGui.CalcTextSize("m") * 40;
|
||||||
|
ImGui.BeginTooltip();
|
||||||
|
ImGui.PushTextWrapPos(width.X);
|
||||||
|
ImGui.TextUnformatted(text);
|
||||||
|
ImGui.PopTextWrapPos();
|
||||||
|
ImGui.EndTooltip();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||||
|
using Dalamud.Interface;
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using Lumina.Excel.GeneratedSheets;
|
using Lumina.Excel.GeneratedSheets;
|
||||||
|
@ -71,7 +72,7 @@ internal class MessageList : ITab {
|
||||||
ImGui.TextUnformatted($"Location: {territoryName}");
|
ImGui.TextUnformatted($"Location: {territoryName}");
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
if (ImGui.SmallButton($"Open map##{message.Id}") && territory != null) {
|
if (ImGuiExt.SmallIconButton(FontAwesomeIcon.MapMarkerAlt, $"{message.Id}") && territory != null) {
|
||||||
this.Plugin.GameGui.OpenMapWithMapLink(new MapLinkPayload(
|
this.Plugin.GameGui.OpenMapWithMapLink(new MapLinkPayload(
|
||||||
territory.RowId,
|
territory.RowId,
|
||||||
territory.Map.Row,
|
territory.Map.Row,
|
||||||
|
@ -80,12 +81,26 @@ internal class MessageList : ITab {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var ctrl = ImGui.GetIO().KeyCtrl;
|
||||||
|
|
||||||
var appraisals = Math.Max(0, message.PositiveVotes - message.NegativeVotes);
|
var appraisals = Math.Max(0, message.PositiveVotes - message.NegativeVotes);
|
||||||
ImGui.TextUnformatted($"Appraisals: {appraisals:N0} ({message.PositiveVotes:N0} - {message.NegativeVotes:N0})");
|
ImGui.TextUnformatted($"Appraisals: {appraisals:N0} ({message.PositiveVotes:N0} - {message.NegativeVotes:N0})");
|
||||||
|
|
||||||
|
if (!ctrl) {
|
||||||
|
ImGui.BeginDisabled();
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui.Button($"Delete##{message.Id}")) {
|
if (ImGui.Button($"Delete##{message.Id}")) {
|
||||||
this.Delete(message.Id);
|
this.Delete(message.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ctrl) {
|
||||||
|
ImGui.EndDisabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGuiExt.HelpIcon("Hold Ctrl to enable the delete button.");
|
||||||
|
|
||||||
ImGui.TreePop();
|
ImGui.TreePop();
|
||||||
|
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user