Tables: Demo: Moved Columns section into Tables & Columns section under a Legacy section.

This commit is contained in:
omar 2019-12-29 19:48:10 +01:00 committed by ocornut
parent 78b12068d9
commit 47b39f6371

View file

@ -484,7 +484,6 @@ void ImGui::ShowDemoWindow(bool* p_open)
ShowDemoWindowLayout(); ShowDemoWindowLayout();
ShowDemoWindowPopups(); ShowDemoWindowPopups();
ShowDemoWindowTables(); ShowDemoWindowTables();
ShowDemoWindowColumns();
ShowDemoWindowMisc(); ShowDemoWindowMisc();
// End of ShowDemoWindow() // End of ShowDemoWindow()
@ -3289,7 +3288,7 @@ const ImGuiTableSortSpecs* MyItem::s_current_sort_specs = NULL;
static void ShowDemoWindowTables() static void ShowDemoWindowTables()
{ {
//ImGui::SetNextItemOpen(true, ImGuiCond_Once); //ImGui::SetNextItemOpen(true, ImGuiCond_Once);
if (!ImGui::CollapsingHeader("Tables")) if (!ImGui::CollapsingHeader("Tables & Columns"))
return; return;
ImGui::PushID("Tables"); ImGui::PushID("Tables");
@ -4175,27 +4174,23 @@ static void ShowDemoWindowTables()
ImGui::TreePop(); ImGui::TreePop();
} }
ImGui::PopID();
ShowDemoWindowColumns();
if (disable_indent) if (disable_indent)
ImGui::PopStyleVar(); ImGui::PopStyleVar();
ImGui::PopID();
} }
// 2020: Columns are under-featured and not maintained. Prefer using the more flexible and powerful Tables API! // Demonstrate old/legacy Columns API!
// [2020: Columns are under-featured and not maintained. Prefer using the more flexible and powerful BeginTable() API!]
static void ShowDemoWindowColumns() static void ShowDemoWindowColumns()
{ {
if (!ImGui::CollapsingHeader("Columns")) bool open = ImGui::TreeNode("Legacy Columns API");
return;
ImGui::PushID("Columns");
static bool disable_indent = false;
ImGui::Checkbox("Disable tree indentation", &disable_indent);
ImGui::SameLine(); ImGui::SameLine();
HelpMarker("Disable the indenting of tree nodes so demo columns can use the full window width."); HelpMarker("Columns() is an old API! Prefer using the more flexible and powerful BeginTable() API!");
if (disable_indent) if (!open)
ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, 0.0f); return;
ImGui::TextWrapped("Note: Columns are under-featured and not maintained. Prefer using the more flexible and powerful Tables API!");
// Basic columns // Basic columns
if (ImGui::TreeNode("Basic")) if (ImGui::TreeNode("Basic"))
@ -4407,9 +4402,7 @@ static void ShowDemoWindowColumns()
ImGui::TreePop(); ImGui::TreePop();
} }
if (disable_indent) ImGui::TreePop();
ImGui::PopStyleVar();
ImGui::PopID();
} }
static void ShowDemoWindowMisc() static void ShowDemoWindowMisc()