mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-01 05:13:40 +01:00
refactor(Dalamud): switch to file-scoped namespaces
This commit is contained in:
parent
13cf3d93dc
commit
b5f34c3199
325 changed files with 45878 additions and 46218 deletions
|
|
@ -2,69 +2,68 @@ using System.Numerics;
|
|||
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.Components
|
||||
namespace Dalamud.Interface.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Class containing various methods providing ImGui components.
|
||||
/// </summary>
|
||||
public static partial class ImGuiComponents
|
||||
{
|
||||
/// <summary>
|
||||
/// Class containing various methods providing ImGui components.
|
||||
/// ColorPicker with palette.
|
||||
/// </summary>
|
||||
public static partial class ImGuiComponents
|
||||
/// <param name="id">Id for the color picker.</param>
|
||||
/// <param name="description">The description of the color picker.</param>
|
||||
/// <param name="originalColor">The current color.</param>
|
||||
/// <returns>Selected color.</returns>
|
||||
public static Vector4 ColorPickerWithPalette(int id, string description, Vector4 originalColor)
|
||||
{
|
||||
/// <summary>
|
||||
/// ColorPicker with palette.
|
||||
/// </summary>
|
||||
/// <param name="id">Id for the color picker.</param>
|
||||
/// <param name="description">The description of the color picker.</param>
|
||||
/// <param name="originalColor">The current color.</param>
|
||||
/// <returns>Selected color.</returns>
|
||||
public static Vector4 ColorPickerWithPalette(int id, string description, Vector4 originalColor)
|
||||
const ImGuiColorEditFlags flags = ImGuiColorEditFlags.NoSidePreview | ImGuiColorEditFlags.NoSmallPreview;
|
||||
return ColorPickerWithPalette(id, description, originalColor, flags);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ColorPicker with palette with color picker options.
|
||||
/// </summary>
|
||||
/// <param name="id">Id for the color picker.</param>
|
||||
/// <param name="description">The description of the color picker.</param>
|
||||
/// <param name="originalColor">The current color.</param>
|
||||
/// <param name="flags">Flags to customize color picker.</param>
|
||||
/// <returns>Selected color.</returns>
|
||||
public static Vector4 ColorPickerWithPalette(int id, string description, Vector4 originalColor, ImGuiColorEditFlags flags)
|
||||
{
|
||||
var existingColor = originalColor;
|
||||
var selectedColor = originalColor;
|
||||
var colorPalette = ImGuiHelpers.DefaultColorPalette(36);
|
||||
if (ImGui.ColorButton($"{description}###ColorPickerButton{id}", originalColor))
|
||||
{
|
||||
const ImGuiColorEditFlags flags = ImGuiColorEditFlags.NoSidePreview | ImGuiColorEditFlags.NoSmallPreview;
|
||||
return ColorPickerWithPalette(id, description, originalColor, flags);
|
||||
ImGui.OpenPopup($"###ColorPickerPopup{id}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ColorPicker with palette with color picker options.
|
||||
/// </summary>
|
||||
/// <param name="id">Id for the color picker.</param>
|
||||
/// <param name="description">The description of the color picker.</param>
|
||||
/// <param name="originalColor">The current color.</param>
|
||||
/// <param name="flags">Flags to customize color picker.</param>
|
||||
/// <returns>Selected color.</returns>
|
||||
public static Vector4 ColorPickerWithPalette(int id, string description, Vector4 originalColor, ImGuiColorEditFlags flags)
|
||||
if (ImGui.BeginPopup($"###ColorPickerPopup{id}"))
|
||||
{
|
||||
var existingColor = originalColor;
|
||||
var selectedColor = originalColor;
|
||||
var colorPalette = ImGuiHelpers.DefaultColorPalette(36);
|
||||
if (ImGui.ColorButton($"{description}###ColorPickerButton{id}", originalColor))
|
||||
if (ImGui.ColorPicker4($"###ColorPicker{id}", ref existingColor, flags))
|
||||
{
|
||||
ImGui.OpenPopup($"###ColorPickerPopup{id}");
|
||||
selectedColor = existingColor;
|
||||
}
|
||||
|
||||
if (ImGui.BeginPopup($"###ColorPickerPopup{id}"))
|
||||
for (var i = 0; i < 4; i++)
|
||||
{
|
||||
if (ImGui.ColorPicker4($"###ColorPicker{id}", ref existingColor, flags))
|
||||
ImGui.Spacing();
|
||||
for (var j = i * 9; j < (i * 9) + 9; j++)
|
||||
{
|
||||
selectedColor = existingColor;
|
||||
}
|
||||
|
||||
for (var i = 0; i < 4; i++)
|
||||
{
|
||||
ImGui.Spacing();
|
||||
for (var j = i * 9; j < (i * 9) + 9; j++)
|
||||
if (ImGui.ColorButton($"###ColorPickerSwatch{id}{i}{j}", colorPalette[j]))
|
||||
{
|
||||
if (ImGui.ColorButton($"###ColorPickerSwatch{id}{i}{j}", colorPalette[j]))
|
||||
{
|
||||
selectedColor = colorPalette[j];
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
selectedColor = colorPalette[j];
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.EndPopup();
|
||||
ImGui.SameLine();
|
||||
}
|
||||
}
|
||||
|
||||
return selectedColor;
|
||||
ImGui.EndPopup();
|
||||
}
|
||||
|
||||
return selectedColor;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,75 +2,74 @@ using System.Numerics;
|
|||
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.Components
|
||||
namespace Dalamud.Interface.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Class containing various methods providing ImGui components.
|
||||
/// </summary>
|
||||
public static partial class ImGuiComponents
|
||||
{
|
||||
/// <summary>
|
||||
/// Class containing various methods providing ImGui components.
|
||||
/// Alpha modified IconButton component to use an icon as a button with alpha and color options.
|
||||
/// </summary>
|
||||
public static partial class ImGuiComponents
|
||||
/// <param name="icon">The icon for the button.</param>
|
||||
/// <param name="id">The ID of the button.</param>
|
||||
/// <param name="defaultColor">The default color of the button.</param>
|
||||
/// <param name="activeColor">The color of the button when active.</param>
|
||||
/// <param name="hoveredColor">The color of the button when hovered.</param>
|
||||
/// <param name="alphaMult">A multiplier for the current alpha levels.</param>
|
||||
/// <returns>Indicator if button is clicked.</returns>
|
||||
public static bool DisabledButton(FontAwesomeIcon icon, int? id = null, Vector4? defaultColor = null, Vector4? activeColor = null, Vector4? hoveredColor = null, float alphaMult = .5f)
|
||||
{
|
||||
/// <summary>
|
||||
/// Alpha modified IconButton component to use an icon as a button with alpha and color options.
|
||||
/// </summary>
|
||||
/// <param name="icon">The icon for the button.</param>
|
||||
/// <param name="id">The ID of the button.</param>
|
||||
/// <param name="defaultColor">The default color of the button.</param>
|
||||
/// <param name="activeColor">The color of the button when active.</param>
|
||||
/// <param name="hoveredColor">The color of the button when hovered.</param>
|
||||
/// <param name="alphaMult">A multiplier for the current alpha levels.</param>
|
||||
/// <returns>Indicator if button is clicked.</returns>
|
||||
public static bool DisabledButton(FontAwesomeIcon icon, int? id = null, Vector4? defaultColor = null, Vector4? activeColor = null, Vector4? hoveredColor = null, float alphaMult = .5f)
|
||||
{
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
|
||||
var text = icon.ToIconString();
|
||||
if (id.HasValue)
|
||||
text = $"{text}{id}";
|
||||
var text = icon.ToIconString();
|
||||
if (id.HasValue)
|
||||
text = $"{text}{id}";
|
||||
|
||||
var button = DisabledButton(text, defaultColor, activeColor, hoveredColor, alphaMult);
|
||||
var button = DisabledButton(text, defaultColor, activeColor, hoveredColor, alphaMult);
|
||||
|
||||
ImGui.PopFont();
|
||||
ImGui.PopFont();
|
||||
|
||||
return button;
|
||||
}
|
||||
return button;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Alpha modified Button component to use as a disabled button with alpha and color options.
|
||||
/// </summary>
|
||||
/// <param name="labelWithId">The button label with ID.</param>
|
||||
/// <param name="defaultColor">The default color of the button.</param>
|
||||
/// <param name="activeColor">The color of the button when active.</param>
|
||||
/// <param name="hoveredColor">The color of the button when hovered.</param>
|
||||
/// <param name="alphaMult">A multiplier for the current alpha levels.</param>
|
||||
/// <returns>Indicator if button is clicked.</returns>
|
||||
public static bool DisabledButton(string labelWithId, Vector4? defaultColor = null, Vector4? activeColor = null, Vector4? hoveredColor = null, float alphaMult = .5f)
|
||||
{
|
||||
if (defaultColor.HasValue)
|
||||
ImGui.PushStyleColor(ImGuiCol.Button, defaultColor.Value);
|
||||
/// <summary>
|
||||
/// Alpha modified Button component to use as a disabled button with alpha and color options.
|
||||
/// </summary>
|
||||
/// <param name="labelWithId">The button label with ID.</param>
|
||||
/// <param name="defaultColor">The default color of the button.</param>
|
||||
/// <param name="activeColor">The color of the button when active.</param>
|
||||
/// <param name="hoveredColor">The color of the button when hovered.</param>
|
||||
/// <param name="alphaMult">A multiplier for the current alpha levels.</param>
|
||||
/// <returns>Indicator if button is clicked.</returns>
|
||||
public static bool DisabledButton(string labelWithId, Vector4? defaultColor = null, Vector4? activeColor = null, Vector4? hoveredColor = null, float alphaMult = .5f)
|
||||
{
|
||||
if (defaultColor.HasValue)
|
||||
ImGui.PushStyleColor(ImGuiCol.Button, defaultColor.Value);
|
||||
|
||||
if (activeColor.HasValue)
|
||||
ImGui.PushStyleColor(ImGuiCol.ButtonActive, activeColor.Value);
|
||||
if (activeColor.HasValue)
|
||||
ImGui.PushStyleColor(ImGuiCol.ButtonActive, activeColor.Value);
|
||||
|
||||
if (hoveredColor.HasValue)
|
||||
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, hoveredColor.Value);
|
||||
if (hoveredColor.HasValue)
|
||||
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, hoveredColor.Value);
|
||||
|
||||
var style = ImGui.GetStyle();
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, style.Alpha * alphaMult);
|
||||
var style = ImGui.GetStyle();
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, style.Alpha * alphaMult);
|
||||
|
||||
var button = ImGui.Button(labelWithId);
|
||||
var button = ImGui.Button(labelWithId);
|
||||
|
||||
ImGui.PopStyleVar();
|
||||
ImGui.PopStyleVar();
|
||||
|
||||
if (defaultColor.HasValue)
|
||||
ImGui.PopStyleColor();
|
||||
if (defaultColor.HasValue)
|
||||
ImGui.PopStyleColor();
|
||||
|
||||
if (activeColor.HasValue)
|
||||
ImGui.PopStyleColor();
|
||||
if (activeColor.HasValue)
|
||||
ImGui.PopStyleColor();
|
||||
|
||||
if (hoveredColor.HasValue)
|
||||
ImGui.PopStyleColor();
|
||||
if (hoveredColor.HasValue)
|
||||
ImGui.PopStyleColor();
|
||||
|
||||
return button;
|
||||
}
|
||||
return button;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.Components
|
||||
namespace Dalamud.Interface.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Class containing various methods providing ImGui components.
|
||||
/// </summary>
|
||||
public static partial class ImGuiComponents
|
||||
{
|
||||
/// <summary>
|
||||
/// Class containing various methods providing ImGui components.
|
||||
/// HelpMarker component to add a help icon with text on hover.
|
||||
/// </summary>
|
||||
public static partial class ImGuiComponents
|
||||
/// <param name="helpText">The text to display on hover.</param>
|
||||
public static void HelpMarker(string helpText)
|
||||
{
|
||||
/// <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)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
ImGui.TextDisabled(FontAwesomeIcon.InfoCircle.ToIconString());
|
||||
ImGui.PopFont();
|
||||
if (!ImGui.IsItemHovered()) return;
|
||||
ImGui.BeginTooltip();
|
||||
ImGui.PushTextWrapPos(ImGui.GetFontSize() * 35.0f);
|
||||
ImGui.TextUnformatted(helpText);
|
||||
ImGui.PopTextWrapPos();
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
ImGui.SameLine();
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
ImGui.TextDisabled(FontAwesomeIcon.InfoCircle.ToIconString());
|
||||
ImGui.PopFont();
|
||||
if (!ImGui.IsItemHovered()) return;
|
||||
ImGui.BeginTooltip();
|
||||
ImGui.PushTextWrapPos(ImGui.GetFontSize() * 35.0f);
|
||||
ImGui.TextUnformatted(helpText);
|
||||
ImGui.PopTextWrapPos();
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,101 +2,100 @@ using System.Numerics;
|
|||
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.Components
|
||||
namespace Dalamud.Interface.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Class containing various methods providing ImGui components.
|
||||
/// </summary>
|
||||
public static partial class ImGuiComponents
|
||||
{
|
||||
/// <summary>
|
||||
/// Class containing various methods providing ImGui components.
|
||||
/// IconButton component to use an icon as a button.
|
||||
/// </summary>
|
||||
public static partial class ImGuiComponents
|
||||
/// <param name="icon">The icon for the button.</param>
|
||||
/// <returns>Indicator if button is clicked.</returns>
|
||||
public static bool IconButton(FontAwesomeIcon icon)
|
||||
=> IconButton(icon, null, null, null);
|
||||
|
||||
/// <summary>
|
||||
/// IconButton component to use an icon as a button.
|
||||
/// </summary>
|
||||
/// <param name="id">The ID of the button.</param>
|
||||
/// <param name="icon">The icon for the button.</param>
|
||||
/// <returns>Indicator if button is clicked.</returns>
|
||||
public static bool IconButton(int id, FontAwesomeIcon icon)
|
||||
=> IconButton(id, icon, null, null, null);
|
||||
|
||||
/// <summary>
|
||||
/// IconButton component to use an icon as a button.
|
||||
/// </summary>
|
||||
/// <param name="iconText">Text already containing the icon string.</param>
|
||||
/// <returns>Indicator if button is clicked.</returns>
|
||||
public static bool IconButton(string iconText)
|
||||
=> IconButton(iconText, null, null, null);
|
||||
|
||||
/// <summary>
|
||||
/// IconButton component to use an icon as a button.
|
||||
/// </summary>
|
||||
/// <param name="icon">The icon for the button.</param>
|
||||
/// <param name="defaultColor">The default color of the button.</param>
|
||||
/// <param name="activeColor">The color of the button when active.</param>
|
||||
/// <param name="hoveredColor">The color of the button when hovered.</param>
|
||||
/// <returns>Indicator if button is clicked.</returns>
|
||||
public static bool IconButton(FontAwesomeIcon icon, Vector4? defaultColor = null, Vector4? activeColor = null, Vector4? hoveredColor = null)
|
||||
=> IconButton($"{icon.ToIconString()}", defaultColor, activeColor, hoveredColor);
|
||||
|
||||
/// <summary>
|
||||
/// IconButton component to use an icon as a button with color options.
|
||||
/// </summary>
|
||||
/// <param name="id">The ID of the button.</param>
|
||||
/// <param name="icon">The icon for the button.</param>
|
||||
/// <param name="defaultColor">The default color of the button.</param>
|
||||
/// <param name="activeColor">The color of the button when active.</param>
|
||||
/// <param name="hoveredColor">The color of the button when hovered.</param>
|
||||
/// <returns>Indicator if button is clicked.</returns>
|
||||
public static bool IconButton(int id, FontAwesomeIcon icon, Vector4? defaultColor = null, Vector4? activeColor = null, Vector4? hoveredColor = null)
|
||||
=> IconButton($"{icon.ToIconString()}{id}", defaultColor, activeColor, hoveredColor);
|
||||
|
||||
/// <summary>
|
||||
/// IconButton component to use an icon as a button with color options.
|
||||
/// </summary>
|
||||
/// <param name="iconText">Text already containing the icon string.</param>
|
||||
/// <param name="defaultColor">The default color of the button.</param>
|
||||
/// <param name="activeColor">The color of the button when active.</param>
|
||||
/// <param name="hoveredColor">The color of the button when hovered.</param>
|
||||
/// <returns>Indicator if button is clicked.</returns>
|
||||
public static bool IconButton(string iconText, Vector4? defaultColor = null, Vector4? activeColor = null, Vector4? hoveredColor = null)
|
||||
{
|
||||
/// <summary>
|
||||
/// IconButton component to use an icon as a button.
|
||||
/// </summary>
|
||||
/// <param name="icon">The icon for the button.</param>
|
||||
/// <returns>Indicator if button is clicked.</returns>
|
||||
public static bool IconButton(FontAwesomeIcon icon)
|
||||
=> IconButton(icon, null, null, null);
|
||||
var numColors = 0;
|
||||
|
||||
/// <summary>
|
||||
/// IconButton component to use an icon as a button.
|
||||
/// </summary>
|
||||
/// <param name="id">The ID of the button.</param>
|
||||
/// <param name="icon">The icon for the button.</param>
|
||||
/// <returns>Indicator if button is clicked.</returns>
|
||||
public static bool IconButton(int id, FontAwesomeIcon icon)
|
||||
=> IconButton(id, icon, null, null, null);
|
||||
|
||||
/// <summary>
|
||||
/// IconButton component to use an icon as a button.
|
||||
/// </summary>
|
||||
/// <param name="iconText">Text already containing the icon string.</param>
|
||||
/// <returns>Indicator if button is clicked.</returns>
|
||||
public static bool IconButton(string iconText)
|
||||
=> IconButton(iconText, null, null, null);
|
||||
|
||||
/// <summary>
|
||||
/// IconButton component to use an icon as a button.
|
||||
/// </summary>
|
||||
/// <param name="icon">The icon for the button.</param>
|
||||
/// <param name="defaultColor">The default color of the button.</param>
|
||||
/// <param name="activeColor">The color of the button when active.</param>
|
||||
/// <param name="hoveredColor">The color of the button when hovered.</param>
|
||||
/// <returns>Indicator if button is clicked.</returns>
|
||||
public static bool IconButton(FontAwesomeIcon icon, Vector4? defaultColor = null, Vector4? activeColor = null, Vector4? hoveredColor = null)
|
||||
=> IconButton($"{icon.ToIconString()}", defaultColor, activeColor, hoveredColor);
|
||||
|
||||
/// <summary>
|
||||
/// IconButton component to use an icon as a button with color options.
|
||||
/// </summary>
|
||||
/// <param name="id">The ID of the button.</param>
|
||||
/// <param name="icon">The icon for the button.</param>
|
||||
/// <param name="defaultColor">The default color of the button.</param>
|
||||
/// <param name="activeColor">The color of the button when active.</param>
|
||||
/// <param name="hoveredColor">The color of the button when hovered.</param>
|
||||
/// <returns>Indicator if button is clicked.</returns>
|
||||
public static bool IconButton(int id, FontAwesomeIcon icon, Vector4? defaultColor = null, Vector4? activeColor = null, Vector4? hoveredColor = null)
|
||||
=> IconButton($"{icon.ToIconString()}{id}", defaultColor, activeColor, hoveredColor);
|
||||
|
||||
/// <summary>
|
||||
/// IconButton component to use an icon as a button with color options.
|
||||
/// </summary>
|
||||
/// <param name="iconText">Text already containing the icon string.</param>
|
||||
/// <param name="defaultColor">The default color of the button.</param>
|
||||
/// <param name="activeColor">The color of the button when active.</param>
|
||||
/// <param name="hoveredColor">The color of the button when hovered.</param>
|
||||
/// <returns>Indicator if button is clicked.</returns>
|
||||
public static bool IconButton(string iconText, Vector4? defaultColor = null, Vector4? activeColor = null, Vector4? hoveredColor = null)
|
||||
if (defaultColor.HasValue)
|
||||
{
|
||||
var numColors = 0;
|
||||
|
||||
if (defaultColor.HasValue)
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.Button, defaultColor.Value);
|
||||
numColors++;
|
||||
}
|
||||
|
||||
if (activeColor.HasValue)
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.ButtonActive, activeColor.Value);
|
||||
numColors++;
|
||||
}
|
||||
|
||||
if (hoveredColor.HasValue)
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, hoveredColor.Value);
|
||||
numColors++;
|
||||
}
|
||||
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
|
||||
var button = ImGui.Button(iconText);
|
||||
|
||||
ImGui.PopFont();
|
||||
|
||||
if (numColors > 0)
|
||||
ImGui.PopStyleColor(numColors);
|
||||
|
||||
return button;
|
||||
ImGui.PushStyleColor(ImGuiCol.Button, defaultColor.Value);
|
||||
numColors++;
|
||||
}
|
||||
|
||||
if (activeColor.HasValue)
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.ButtonActive, activeColor.Value);
|
||||
numColors++;
|
||||
}
|
||||
|
||||
if (hoveredColor.HasValue)
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, hoveredColor.Value);
|
||||
numColors++;
|
||||
}
|
||||
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
|
||||
var button = ImGui.Button(iconText);
|
||||
|
||||
ImGui.PopFont();
|
||||
|
||||
if (numColors > 0)
|
||||
ImGui.PopStyleColor(numColors);
|
||||
|
||||
return button;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,17 @@
|
|||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.Components
|
||||
namespace Dalamud.Interface.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Class containing various methods providing ImGui components.
|
||||
/// </summary>
|
||||
public static partial class ImGuiComponents
|
||||
{
|
||||
/// <summary>
|
||||
/// Class containing various methods providing ImGui components.
|
||||
/// Test component to demonstrate how ImGui components work.
|
||||
/// </summary>
|
||||
public static partial class ImGuiComponents
|
||||
public static void Test()
|
||||
{
|
||||
/// <summary>
|
||||
/// Test component to demonstrate how ImGui components work.
|
||||
/// </summary>
|
||||
public static void Test()
|
||||
{
|
||||
ImGui.Text("You are viewing the test component. The test was a success.");
|
||||
}
|
||||
ImGui.Text("You are viewing the test component. The test was a success.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,31 +1,30 @@
|
|||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.Components
|
||||
namespace Dalamud.Interface.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Class containing various methods providing ImGui components.
|
||||
/// </summary>
|
||||
public static partial class ImGuiComponents
|
||||
{
|
||||
/// <summary>
|
||||
/// Class containing various methods providing ImGui components.
|
||||
/// TextWithLabel component to show labeled text.
|
||||
/// </summary>
|
||||
public static partial class ImGuiComponents
|
||||
/// <param name="label">The label for text.</param>
|
||||
/// <param name="value">The text value.</param>
|
||||
/// <param name="hint">The hint to show on hover.</param>
|
||||
public static void TextWithLabel(string label, string value, string hint = "")
|
||||
{
|
||||
/// <summary>
|
||||
/// TextWithLabel component to show labeled text.
|
||||
/// </summary>
|
||||
/// <param name="label">The label for text.</param>
|
||||
/// <param name="value">The text value.</param>
|
||||
/// <param name="hint">The hint to show on hover.</param>
|
||||
public static void TextWithLabel(string label, string value, string hint = "")
|
||||
ImGui.Text(label + ": ");
|
||||
ImGui.SameLine();
|
||||
if (string.IsNullOrEmpty(hint))
|
||||
{
|
||||
ImGui.Text(label + ": ");
|
||||
ImGui.SameLine();
|
||||
if (string.IsNullOrEmpty(hint))
|
||||
{
|
||||
ImGui.Text(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.Text(value + "*");
|
||||
if (ImGui.IsItemHovered()) ImGui.SetTooltip(hint);
|
||||
}
|
||||
ImGui.Text(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.Text(value + "*");
|
||||
if (ImGui.IsItemHovered()) ImGui.SetTooltip(hint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
namespace Dalamud.Interface.Components
|
||||
namespace Dalamud.Interface.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Class containing various methods providing ImGui components.
|
||||
/// </summary>
|
||||
public static partial class ImGuiComponents
|
||||
{
|
||||
/// <summary>
|
||||
/// Class containing various methods providing ImGui components.
|
||||
/// </summary>
|
||||
public static partial class ImGuiComponents
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue