mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-19 06:17:43 +01:00
* Load new localization before firing change event * Update texts in SettingsWindow when locale changes * Localize settings search * Update settings search input - Disable when Credits are scrolling, so Search Results aren't shown instead - Select all on single click, as usual for a search bar * Remove unused IsVisible property * Fix General tab being unselected on language change * Fix search results throwing, oops * Missed using LocRef in EnumSettingsEntry * Set CultureInfo before loading locs * Change it to LazyLoc instead So CheapLoc can export localizations...
84 lines
1.7 KiB
C#
84 lines
1.7 KiB
C#
using System.Diagnostics.CodeAnalysis;
|
|
|
|
using Dalamud.Interface.Utility;
|
|
|
|
namespace Dalamud.Interface.Internal.Windows.Settings;
|
|
|
|
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
|
internal abstract class SettingsTab : IDisposable
|
|
{
|
|
public abstract SettingsEntry[] Entries { get; }
|
|
|
|
public abstract string Title { get; }
|
|
|
|
public abstract SettingsOpenKind Kind { get; }
|
|
|
|
public bool IsOpen { get; set; } = false;
|
|
|
|
public virtual void OnOpen()
|
|
{
|
|
foreach (var settingsEntry in this.Entries)
|
|
{
|
|
settingsEntry.OnOpen();
|
|
}
|
|
}
|
|
|
|
public virtual void OnClose()
|
|
{
|
|
foreach (var settingsEntry in this.Entries)
|
|
{
|
|
settingsEntry.OnClose();
|
|
}
|
|
}
|
|
|
|
public virtual void Draw()
|
|
{
|
|
foreach (var settingsEntry in this.Entries)
|
|
{
|
|
if (settingsEntry.IsVisible)
|
|
settingsEntry.Draw();
|
|
|
|
ImGuiHelpers.ScaledDummy(5);
|
|
}
|
|
|
|
ImGuiHelpers.ScaledDummy(15);
|
|
}
|
|
|
|
public virtual void PostDraw()
|
|
{
|
|
foreach (var settingsEntry in this.Entries)
|
|
{
|
|
settingsEntry.PostDraw();
|
|
}
|
|
}
|
|
|
|
public virtual void Load()
|
|
{
|
|
foreach (var settingsEntry in this.Entries)
|
|
{
|
|
settingsEntry.Load();
|
|
}
|
|
}
|
|
|
|
public virtual void Save()
|
|
{
|
|
foreach (var settingsEntry in this.Entries)
|
|
{
|
|
settingsEntry.Save();
|
|
}
|
|
}
|
|
|
|
public virtual void Discard()
|
|
{
|
|
foreach (var settingsEntry in this.Entries)
|
|
{
|
|
settingsEntry.Load();
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public virtual void Dispose()
|
|
{
|
|
// ignored
|
|
}
|
|
}
|