Columns: Moved BeginColumns/EndColumns/flags from #913 to imgui_internals.h + minor shallow tweaks. Removed demo code temporarily. (#125)

This commit is contained in:
omar
2017-08-20 18:44:48 +08:00
parent bc78535bbf
commit 19a42cb2fd
4 changed files with 27 additions and 71 deletions

View File

@ -1553,49 +1553,6 @@ void ImGui::ShowTestWindow(bool* p_open)
}
*/
if (ImGui::TreeNode("Advanced settings"))
{
static bool border = true;
static bool preserveWidths = true;
static bool forceWithinWindow = true;
ImGui::Checkbox("Border", &border);
ImGui::SameLine();
ImGui::Checkbox("Preserve widths", &preserveWidths);
ImGui::SameLine();
ImGui::Checkbox("Force within window", &forceWithinWindow);
ImGuiColumnsFlags flags = 0;
flags |= (border ? 0 : ImGuiColumnsFlags_NoBorder);
flags |= (preserveWidths ? 0 : ImGuiColumnsFlags_NoPreserveWidths);
flags |= (forceWithinWindow ? 0 : ImGuiColumnsFlags_NoForceWithinWindow);
ImGui::BeginColumns("AdvancedColumns", 4, flags);
ImGui::Separator();
ImGui::Text("ID"); ImGui::NextColumn();
ImGui::Text("Name"); ImGui::NextColumn();
ImGui::Text("Path"); ImGui::NextColumn();
ImGui::Text("Flags"); ImGui::NextColumn();
ImGui::Separator();
const char* names[3] = { "One", "Two", "Three" };
const char* paths[3] = { "/path/one", "/path/two", "/path/three" };
static int selected = -1;
for (int i = 0; i < 3; i++)
{
char label[32];
sprintf(label, "%04d", i);
if (ImGui::Selectable(label, selected == i, ImGuiSelectableFlags_SpanAllColumns))
selected = i;
ImGui::NextColumn();
ImGui::Text(names[i]); ImGui::NextColumn();
ImGui::Text(paths[i]); ImGui::NextColumn();
ImGui::Text("...."); ImGui::NextColumn();
}
ImGui::EndColumns();
ImGui::Separator();
ImGui::TreePop();
}
// Create multiple items in a same cell before switching to next column
if (ImGui::TreeNode("Mixed items"))
{