Tables: Made TableHeader() responsible for opening per-column context menu to move responsibility away from TableAutoHeaders().

This commit is contained in:
omar
2020-06-19 17:28:06 +02:00
committed by ocornut
parent 27e779b3ef
commit 745d8cdb49
2 changed files with 17 additions and 21 deletions

View File

@ -3960,13 +3960,12 @@ static void ShowDemoWindowTables()
}
// Demonstrate using TableHeader() calls instead of TableAutoHeaders()
// FIXME-TABLE: Currently this doesn't get us feature-parity with TableAutoHeaders(), e.g. missing context menu. Tables API needs some work!
if (open_action != -1)
ImGui::SetNextItemOpen(open_action != 0);
if (ImGui::TreeNode("Custom headers"))
{
const int COLUMNS_COUNT = 3;
if (ImGui::BeginTable("##table1", COLUMNS_COUNT, ImGuiTableFlags_Borders | ImGuiTableFlags_Reorderable))
if (ImGui::BeginTable("##table1", COLUMNS_COUNT, ImGuiTableFlags_Borders | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable))
{
ImGui::TableSetupColumn("Apricot");
ImGui::TableSetupColumn("Banana");