Browse Source

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

omar 5 years ago
parent
commit
47b39f6371
1 changed files with 12 additions and 19 deletions
  1. 12 19
      imgui_demo.cpp

+ 12 - 19
imgui_demo.cpp

@@ -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"))
-        return;
-
-    ImGui::PushID("Columns");
-
-    static bool disable_indent = false;
-    ImGui::Checkbox("Disable tree indentation", &disable_indent);
+    bool open = ImGui::TreeNode("Legacy Columns API");
     ImGui::SameLine();
     ImGui::SameLine();
-    HelpMarker("Disable the indenting of tree nodes so demo columns can use the full window width.");
-    if (disable_indent)
-        ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, 0.0f);
-
-    ImGui::TextWrapped("Note: Columns are under-featured and not maintained. Prefer using the more flexible and powerful Tables API!");
+    HelpMarker("Columns() is an old API! Prefer using the more flexible and powerful BeginTable() API!");
+    if (!open)
+        return;
 
 
     // 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::PopStyleVar();
-    ImGui::PopID();
+    ImGui::TreePop();
 }
 }
 
 
 static void ShowDemoWindowMisc()
 static void ShowDemoWindowMisc()