mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-25 09:59:18 +01:00
* Update text-related ImGui calls * Use ImU8String for SafeTextColored * Restore wrapped calls * Update MenuItem call * Use ImGui.Text over ImGui.TextUnformatted * Add ImGui.TextColoredWrapped * Obsolete SafeText helpers * Fix obsoleted calls * SafeTextColored didn't exist before imgui-bindings * Remove %% replacements
33 lines
876 B
C#
33 lines
876 B
C#
using Dalamud.Bindings.ImGui;
|
|
using Dalamud.Interface.Utility;
|
|
|
|
namespace Dalamud.Interface.Internal.Windows.Data;
|
|
|
|
/// <summary>
|
|
/// Common utilities used in Widgets.
|
|
/// </summary>
|
|
internal class WidgetUtil
|
|
{
|
|
/// <summary>
|
|
/// Draws text that can be copied on click.
|
|
/// </summary>
|
|
/// <param name="text">The text shown and to be copied.</param>
|
|
/// <param name="tooltipText">The text in the tooltip.</param>
|
|
internal static void DrawCopyableText(string text, string tooltipText = "Copy")
|
|
{
|
|
ImGui.TextWrapped(text);
|
|
|
|
if (ImGui.IsItemHovered())
|
|
{
|
|
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand);
|
|
ImGui.BeginTooltip();
|
|
ImGui.Text(tooltipText);
|
|
ImGui.EndTooltip();
|
|
}
|
|
|
|
if (ImGui.IsItemClicked())
|
|
{
|
|
ImGui.SetClipboardText(text);
|
|
}
|
|
}
|
|
}
|