chore: convert Dalamud to file-scoped namespaces

This commit is contained in:
goat 2022-10-29 15:23:22 +02:00
parent b093323acc
commit 987ff8dc8f
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
368 changed files with 55081 additions and 55450 deletions

View file

@ -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;
}
}