mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 05:04:15 +01:00
Update UIDebug2, ImGuiComponents, ImGuiHelpers (#2081)
* Update ImGuiComponents & ImGuiHelpers Took some helper functions created for `UiDebug2`, and incorporated them into `ImGuiComponents` / `ImGuiHelpers` instead - `IconButton()` (and its various overloads) now includes an optional size parameter - `IconButtonSelect()` has been added, allowing a row or grid of IconButtons to serve as a radio-like input - `HelpMarker()` now includes an optional color parameter - `ClickToCopyText()` now includes an optional color parameter, and includes the `FontAwesome.Copy` icon in the tooltip. - Implemented ImRaii in these files These changes are intended not to break any existing calls in plugins or within Dalamud itself. * Fix ambiguous overloads * UiDebug2 Updates - Fixed XY coordinate display - Added AtkValue table to AddonTree display - Restored old behaviour wherein the Addon display initially only shows the Root node and a collapsed node list - The above should also fix the Element Selector / Search behaviour, allowing it to scroll correctly to the searched node - Now displays field offsets for any node/component whose pointer exists in the addon struct - Tidied up node tree headers by removing memory addresses (they're still readable in the opened tree, of course)
This commit is contained in:
parent
94f16ac16e
commit
ee63f60877
18 changed files with 649 additions and 278 deletions
|
|
@ -167,17 +167,41 @@ public static class ImGuiHelpers
|
|||
/// </summary>
|
||||
/// <param name="text">The text to show.</param>
|
||||
/// <param name="textCopy">The text to copy when clicked.</param>
|
||||
public static void ClickToCopyText(string text, string? textCopy = null)
|
||||
/// <param name="color">The color of the text.</param>
|
||||
public static void ClickToCopyText(string text, string? textCopy = null, Vector4? color = null)
|
||||
{
|
||||
textCopy ??= text;
|
||||
ImGui.Text($"{text}");
|
||||
|
||||
using (var col = new ImRaii.Color())
|
||||
{
|
||||
if (color.HasValue)
|
||||
{
|
||||
col.Push(ImGuiCol.Text, color.Value);
|
||||
}
|
||||
|
||||
ImGui.TextUnformatted($"{text}");
|
||||
}
|
||||
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand);
|
||||
if (textCopy != text) ImGui.SetTooltip(textCopy);
|
||||
|
||||
using (ImRaii.Tooltip())
|
||||
{
|
||||
using (ImRaii.PushFont(UiBuilder.IconFont))
|
||||
{
|
||||
ImGui.TextUnformatted(FontAwesomeIcon.Copy.ToIconString());
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGui.TextUnformatted(textCopy);
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui.IsItemClicked()) ImGui.SetClipboardText($"{textCopy}");
|
||||
if (ImGui.IsItemClicked())
|
||||
{
|
||||
ImGui.SetClipboardText(textCopy);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Draws a SeString.</summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue