mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-07 16:34:36 +01:00
* Use new Lock objects * Fix CA1513: Use ObjectDisposedException.ThrowIf * Fix CA1860: Avoid using 'Enumerable.Any()' extension method * Fix IDE0028: Use collection initializers or expressions * Fix CA2263: Prefer generic overload when type is known * Fix CA1862: Use the 'StringComparison' method overloads to perform case-insensitive string comparisons * Fix IDE0270: Null check can be simplified * Fix IDE0280: Use 'nameof' * Fix IDE0009: Add '.this' * Fix IDE0007: Use 'var' instead of explicit type * Fix IDE0062: Make local function static * Fix CA1859: Use concrete types when possible for improved performance * Fix IDE0066: Use switch expression Only applied to where it doesn't look horrendous. * Use is over switch * Fix CA1847: Use String.Contains(char) instead of String.Contains(string) with single characters * Fix SYSLIB1045: Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time. * Fix CA1866: Use 'string.EndsWith(char)' instead of 'string.EndsWith(string)' when you have a string with a single char * Fix IDE0057: Substring can be simplified * Fix IDE0059: Remove unnecessary value assignment * Fix CA1510: Use ArgumentNullException throw helper * Fix IDE0300: Use collection expression for array * Fix IDE0250: Struct can be made 'readonly' * Fix IDE0018: Inline variable declaration * Fix CA1850: Prefer static HashData method over ComputeHash * Fi CA1872: Prefer 'Convert.ToHexString' and 'Convert.ToHexStringLower' over call chains based on 'BitConverter.ToString' * Update ModuleLog instantiations * Organize usings
52 lines
1.5 KiB
C#
52 lines
1.5 KiB
C#
using Dalamud.Bindings.ImGui;
|
|
using Dalamud.Interface.Utility.Raii;
|
|
|
|
using FFXIVClientStructs.FFXIV.Common.Math;
|
|
|
|
namespace Dalamud.Interface.Components;
|
|
|
|
/// <summary>
|
|
/// Class containing various methods providing ImGui components.
|
|
/// </summary>
|
|
public static partial class ImGuiComponents
|
|
{
|
|
/// <summary>
|
|
/// HelpMarker component to add a help icon with text on hover.
|
|
/// </summary>
|
|
/// <param name="helpText">The text to display on hover.</param>
|
|
public static void HelpMarker(string helpText) => HelpMarker(helpText, FontAwesomeIcon.InfoCircle);
|
|
|
|
/// <summary>
|
|
/// HelpMarker component to add a custom icon with text on hover.
|
|
/// </summary>
|
|
/// <param name="helpText">The text to display on hover.</param>
|
|
/// <param name="icon">The icon to use.</param>
|
|
/// <param name="color">The color of the icon.</param>
|
|
public static void HelpMarker(string helpText, FontAwesomeIcon icon, Vector4? color = null)
|
|
{
|
|
using var col = new ImRaii.Color();
|
|
|
|
if (color.HasValue)
|
|
{
|
|
col.Push(ImGuiCol.TextDisabled, color.Value);
|
|
}
|
|
|
|
ImGui.SameLine();
|
|
|
|
using (ImRaii.PushFont(UiBuilder.IconFont))
|
|
{
|
|
ImGui.TextDisabled(icon.ToIconString());
|
|
}
|
|
|
|
if (ImGui.IsItemHovered())
|
|
{
|
|
using (ImRaii.Tooltip())
|
|
{
|
|
using (ImRaii.TextWrapPos(ImGui.GetFontSize() * 35.0f))
|
|
{
|
|
ImGui.Text(helpText);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|