mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 05:04:15 +01:00
chore: add raii, tables code from OtterGui into new Dalamud.Interface assembly
This commit is contained in:
parent
e0d4e60aad
commit
6bf1376515
22 changed files with 1356 additions and 0 deletions
34
Dalamud.Interface/Table/Column.cs
Normal file
34
Dalamud.Interface/Table/Column.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.Table;
|
||||
|
||||
public class Column<TItem>
|
||||
{
|
||||
public string Label = string.Empty;
|
||||
public ImGuiTableColumnFlags Flags = ImGuiTableColumnFlags.NoResize;
|
||||
|
||||
public virtual float Width
|
||||
=> -1f;
|
||||
|
||||
public string FilterLabel
|
||||
=> $"##{this.Label}Filter";
|
||||
|
||||
public virtual bool DrawFilter()
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted(this.Label);
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool FilterFunc(TItem item)
|
||||
=> true;
|
||||
|
||||
public virtual int Compare(TItem lhs, TItem rhs)
|
||||
=> 0;
|
||||
|
||||
public virtual void DrawColumn(TItem item, int idx)
|
||||
{ }
|
||||
|
||||
public int CompareInv(TItem lhs, TItem rhs)
|
||||
=> this.Compare(rhs, lhs);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue