mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-21 07:17:45 +01:00
feat: settings window rework
This commit is contained in:
parent
0dc58cce56
commit
bc3dcdfad7
22 changed files with 1724 additions and 1084 deletions
72
Dalamud/Interface/Internal/Windows/Settings/SettingsTab.cs
Normal file
72
Dalamud/Interface/Internal/Windows/Settings/SettingsTab.cs
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows.Settings;
|
||||
|
||||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
||||
public abstract class SettingsTab : IDisposable
|
||||
{
|
||||
public abstract SettingsEntry[] Entries { get; }
|
||||
|
||||
public abstract string Title { get; }
|
||||
|
||||
public bool IsOpen { get; set; } = false;
|
||||
|
||||
public virtual bool IsVisible { get; } = true;
|
||||
|
||||
public virtual void OnOpen()
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
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 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
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue