Tables: Shared menu item id for "Size all" variations. Avoid allocation on single sort specs. Fix TableGetColumnIsEnabled(). Massage TableHeaderRows().

This commit is contained in:
ocornut
2020-12-02 13:58:55 +01:00
parent e126a64782
commit 155b8bb816
3 changed files with 42 additions and 45 deletions

View File

@ -1900,7 +1900,7 @@ struct ImGuiTableSortSpecsColumn
ImS16 SortOrder; // Index within parent ImGuiTableSortSpecs (always stored in order starting from 0, tables sorted on a single criteria will always have a 0 here)
ImGuiSortDirection SortDirection : 8; // ImGuiSortDirection_Ascending or ImGuiSortDirection_Descending (you can use this or SortSign, whichever is more convenient for your sort function)
ImGuiTableSortSpecsColumn() { ColumnUserID = 0; ColumnIndex = 0; SortOrder = 0; SortDirection = ImGuiSortDirection_Ascending; }
ImGuiTableSortSpecsColumn() { memset(this, 0, sizeof(*this)); }
};
// Sorting specifications for a table (often handling sort specs for a single column, occasionally more)
@ -1913,7 +1913,7 @@ struct ImGuiTableSortSpecs
int SpecsCount; // Sort spec count. Most often 1 unless e.g. ImGuiTableFlags_MultiSortable is enabled.
bool SpecsDirty; // Set to true when specs have changed since last time! Use this to sort again, then clear the flag.
ImGuiTableSortSpecs() { Specs = NULL; SpecsCount = 0; SpecsDirty = false; }
ImGuiTableSortSpecs() { memset(this, 0, sizeof(*this)); }
};
//-----------------------------------------------------------------------------