53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
using System.Numerics;
|
|
using Dalamud.Bindings.ImGui;
|
|
using Dalamud.Interface;
|
|
using Dalamud.Interface.Utility.Raii;
|
|
|
|
namespace HellionChat.Ui.Components.Settings;
|
|
|
|
internal sealed class TabSidebar
|
|
{
|
|
private readonly FontManager _fonts;
|
|
|
|
public event Action<string>? OnTabSelected;
|
|
public string ActiveTab { get; private set; } = "general";
|
|
|
|
public TabSidebar(FontManager fonts)
|
|
{
|
|
_fonts = fonts;
|
|
}
|
|
|
|
public void Draw()
|
|
{
|
|
using var child = ImRaii.Child("##settings-tab-sidebar", new Vector2(170, 0), true);
|
|
if (!child.Success)
|
|
{
|
|
return;
|
|
}
|
|
|
|
DrawEntry("general", FontAwesomeIcon.SlidersH, "General");
|
|
DrawEntry("appearance", FontAwesomeIcon.Palette, "Appearance");
|
|
DrawEntry("chat", FontAwesomeIcon.Comments, "Chat");
|
|
DrawEntry("window", FontAwesomeIcon.WindowMaximize, "Window");
|
|
DrawEntry("channels", FontAwesomeIcon.Hashtag, "Channels");
|
|
DrawEntry("data-privacy", FontAwesomeIcon.Shield, "Data & Privacy");
|
|
DrawEntry("about", FontAwesomeIcon.InfoCircle, "About");
|
|
}
|
|
|
|
private void DrawEntry(string id, FontAwesomeIcon icon, string label)
|
|
{
|
|
using (_fonts.FontAwesome.Push())
|
|
{
|
|
ImGui.TextUnformatted(icon.ToIconString());
|
|
}
|
|
ImGui.SameLine();
|
|
|
|
var selected = ActiveTab == id;
|
|
if (ImGui.Selectable($" {label}##tab-{id}", selected))
|
|
{
|
|
ActiveTab = id;
|
|
OnTabSelected?.Invoke(id);
|
|
}
|
|
}
|
|
}
|