From 12aa3cb09ed83aa478a0bfa6afbbb8b0c003bbf6 Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 11 Jan 2018 15:22:33 +0100 Subject: [PATCH] Demo: Tweaks format. --- imgui_demo.cpp | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 11dc87c6..1e1421eb 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1061,33 +1061,39 @@ void ImGui::ShowDemoWindow(bool* p_open) goto_line |= ImGui::InputInt("##Line", &line, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue); ImGui::PopItemWidth(); - ImGui::BeginChild("Sub1", ImVec2(ImGui::GetWindowContentRegionWidth() * 0.5f,300), false, ImGuiWindowFlags_HorizontalScrollbar | (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0)); - for (int i = 0; i < 100; i++) + // Child 1: no border, enable horizontal scrollbar { - ImGui::Text("%04d: scrollable region", i); - if (goto_line && line == i) + ImGui::BeginChild("Child1", ImVec2(ImGui::GetWindowContentRegionWidth() * 0.5f, 300), false, ImGuiWindowFlags_HorizontalScrollbar | (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0)); + for (int i = 0; i < 100; i++) + { + ImGui::Text("%04d: scrollable region", i); + if (goto_line && line == i) + ImGui::SetScrollHere(); + } + if (goto_line && line >= 100) ImGui::SetScrollHere(); + ImGui::EndChild(); } - if (goto_line && line >= 100) - ImGui::SetScrollHere(); - ImGui::EndChild(); ImGui::SameLine(); - ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f); - ImGui::BeginChild("Sub2", ImVec2(0,300), true, (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0)); - ImGui::Text("With border"); - ImGui::Columns(2); - for (int i = 0; i < 100; i++) + // Child 2: rounded border { - if (i == 50) - ImGui::NextColumn(); - char buf[32]; - sprintf(buf, "%08x", i*5731); - ImGui::Button(buf, ImVec2(-1.0f, 0.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f); + ImGui::BeginChild("Child2", ImVec2(0,300), true, (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0)); + ImGui::Text("With border"); + ImGui::Columns(2); + for (int i = 0; i < 100; i++) + { + if (i == 50) + ImGui::NextColumn(); + char buf[32]; + sprintf(buf, "%08x", i*5731); + ImGui::Button(buf, ImVec2(-1.0f, 0.0f)); + } + ImGui::EndChild(); + ImGui::PopStyleVar(); } - ImGui::EndChild(); - ImGui::PopStyleVar(); ImGui::TreePop(); }