mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-14 17:07:01 +00:00
Tables: Added ImGuiTableColumnFlags_NoHeaderLabel to request TableHeadersRow() to not submit label for a column. (#4206)
This commit is contained in:
parent
fe24591411
commit
1b4323a1b4
@ -37,6 +37,8 @@ HOW TO UPDATE?
|
||||
|
||||
Other Changes:
|
||||
- TabBar: Fixed using more than 32 KB-worth of tab names. (#4176)
|
||||
- Tables: Added ImGuiTableColumnFlags_NoHeaderLabel to request TableHeadersRow() to not submit label for a column.
|
||||
Convenient for some small columns. Name will still appear in context menu. (#4206).
|
||||
- Fixed printf-style format checks on non-MinGW flavors. (#4183, #3592)
|
||||
- Demo: Fixed requirement in 1.83 to link with imgui_demo.cpp if IMGUI_DISABLE_METRICS_WINDOW is not set. (#4171)
|
||||
Normally the right way to disable compiling the demo is to set IMGUI_DISABLE_DEMO_WINDOWS, but we want to avoid
|
||||
|
1
imgui.h
1
imgui.h
@ -1180,6 +1180,7 @@ enum ImGuiTableColumnFlags_
|
||||
ImGuiTableColumnFlags_PreferSortDescending = 1 << 13, // Make the initial sort direction Descending when first sorting on this column.
|
||||
ImGuiTableColumnFlags_IndentEnable = 1 << 14, // Use current Indent value when entering cell (default for column 0).
|
||||
ImGuiTableColumnFlags_IndentDisable = 1 << 15, // Ignore current Indent value when entering cell (default for columns > 0). Indentation changes _within_ the cell will still be honored.
|
||||
ImGuiTableColumnFlags_NoHeaderLabel = 1 << 16, // TableHeadersRow() will not submit label for this column. Convenient for some small columns. Name will still appear in context menu.
|
||||
|
||||
// Output status flags, read-only via TableGetColumnFlags()
|
||||
ImGuiTableColumnFlags_IsEnabled = 1 << 20, // Status: is enabled == not hidden by user/api (referred to as "Hide" in _DefaultHide and _NoHide) flags.
|
||||
|
@ -3509,6 +3509,7 @@ static void EditTableColumnsFlags(ImGuiTableColumnFlags* p_flags)
|
||||
ImGui::CheckboxFlags("_NoSort", p_flags, ImGuiTableColumnFlags_NoSort);
|
||||
ImGui::CheckboxFlags("_NoSortAscending", p_flags, ImGuiTableColumnFlags_NoSortAscending);
|
||||
ImGui::CheckboxFlags("_NoSortDescending", p_flags, ImGuiTableColumnFlags_NoSortDescending);
|
||||
ImGui::CheckboxFlags("_NoHeaderLabel", p_flags, ImGuiTableColumnFlags_NoHeaderLabel);
|
||||
ImGui::CheckboxFlags("_NoHeaderWidth", p_flags, ImGuiTableColumnFlags_NoHeaderWidth);
|
||||
ImGui::CheckboxFlags("_PreferSortAscending", p_flags, ImGuiTableColumnFlags_PreferSortAscending);
|
||||
ImGui::CheckboxFlags("_PreferSortDescending", p_flags, ImGuiTableColumnFlags_PreferSortDescending);
|
||||
|
@ -2780,8 +2780,11 @@ float ImGui::TableGetHeaderRowHeight()
|
||||
float row_height = GetTextLineHeight();
|
||||
int columns_count = TableGetColumnCount();
|
||||
for (int column_n = 0; column_n < columns_count; column_n++)
|
||||
if (TableGetColumnFlags(column_n) & ImGuiTableColumnFlags_IsEnabled)
|
||||
{
|
||||
ImGuiTableColumnFlags flags = TableGetColumnFlags(column_n);
|
||||
if ((flags & ImGuiTableColumnFlags_IsEnabled) && !(flags & ImGuiTableColumnFlags_NoHeaderLabel))
|
||||
row_height = ImMax(row_height, CalcTextSize(TableGetColumnName(column_n)).y);
|
||||
}
|
||||
row_height += GetStyle().CellPadding.y * 2.0f;
|
||||
return row_height;
|
||||
}
|
||||
@ -2818,7 +2821,7 @@ void ImGui::TableHeadersRow()
|
||||
// Push an id to allow unnamed labels (generally accidental, but let's behave nicely with them)
|
||||
// - in your own code you may omit the PushID/PopID all-together, provided you know they won't collide
|
||||
// - table->InstanceCurrent is only >0 when we use multiple BeginTable/EndTable calls with same identifier.
|
||||
const char* name = TableGetColumnName(column_n);
|
||||
const char* name = (TableGetColumnFlags(column_n) & ImGuiTableColumnFlags_NoHeaderLabel) ? "" : TableGetColumnName(column_n);
|
||||
PushID(table->InstanceCurrent * table->ColumnsCount + column_n);
|
||||
TableHeader(name);
|
||||
PopID();
|
||||
|
Loading…
Reference in New Issue
Block a user