| 2657 | } |
| 2658 | |
| 2659 | static void ShowDemoWindowLayout() |
| 2660 | { |
| 2661 | IMGUI_DEMO_MARKER("Layout"); |
| 2662 | if (!ImGui::CollapsingHeader("Layout & Scrolling")) |
| 2663 | return; |
| 2664 | |
| 2665 | IMGUI_DEMO_MARKER("Layout/Child windows"); |
| 2666 | if (ImGui::TreeNode("Child windows")) |
| 2667 | { |
| 2668 | ImGui::SeparatorText("Child windows"); |
| 2669 | |
| 2670 | HelpMarker("Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window."); |
| 2671 | static bool disable_mouse_wheel = false; |
| 2672 | static bool disable_menu = false; |
| 2673 | ImGui::Checkbox("Disable Mouse Wheel", &disable_mouse_wheel); |
| 2674 | ImGui::Checkbox("Disable Menu", &disable_menu); |
| 2675 | |
| 2676 | // Child 1: no border, enable horizontal scrollbar |
| 2677 | { |
| 2678 | ImGuiWindowFlags window_flags = ImGuiWindowFlags_HorizontalScrollbar; |
| 2679 | if (disable_mouse_wheel) |
| 2680 | window_flags |= ImGuiWindowFlags_NoScrollWithMouse; |
| 2681 | ImGui::BeginChild("ChildL", ImVec2(ImGui::GetContentRegionAvail().x * 0.5f, 260), false, window_flags); |
| 2682 | for (int i = 0; i < 100; i++) |
| 2683 | ImGui::Text("%04d: scrollable region", i); |
| 2684 | ImGui::EndChild(); |
| 2685 | } |
| 2686 | |
| 2687 | ImGui::SameLine(); |
| 2688 | |
| 2689 | // Child 2: rounded border |
| 2690 | { |
| 2691 | ImGuiWindowFlags window_flags = ImGuiWindowFlags_None; |
| 2692 | if (disable_mouse_wheel) |
| 2693 | window_flags |= ImGuiWindowFlags_NoScrollWithMouse; |
| 2694 | if (!disable_menu) |
| 2695 | window_flags |= ImGuiWindowFlags_MenuBar; |
| 2696 | ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f); |
| 2697 | ImGui::BeginChild("ChildR", ImVec2(0, 260), true, window_flags); |
| 2698 | if (!disable_menu && ImGui::BeginMenuBar()) |
| 2699 | { |
| 2700 | if (ImGui::BeginMenu("Menu")) |
| 2701 | { |
| 2702 | ShowExampleMenuFile(); |
| 2703 | ImGui::EndMenu(); |
| 2704 | } |
| 2705 | ImGui::EndMenuBar(); |
| 2706 | } |
| 2707 | if (ImGui::BeginTable("split", 2, ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings)) |
| 2708 | { |
| 2709 | for (int i = 0; i < 100; i++) |
| 2710 | { |
| 2711 | char buf[32]; |
| 2712 | sprintf(buf, "%03d", i); |
| 2713 | ImGui::TableNextColumn(); |
| 2714 | ImGui::Button(buf, ImVec2(-FLT_MIN, 0.0f)); |
| 2715 | } |
| 2716 | ImGui::EndTable(); |
no test coverage detected