| 2546 | } |
| 2547 | |
| 2548 | static void ShowDemoWindowLayout() |
| 2549 | { |
| 2550 | IMGUI_DEMO_MARKER("Layout"); |
| 2551 | if (!ImGui::CollapsingHeader("Layout & Scrolling")) |
| 2552 | return; |
| 2553 | |
| 2554 | IMGUI_DEMO_MARKER("Layout/Child windows"); |
| 2555 | if (ImGui::TreeNode("Child windows")) |
| 2556 | { |
| 2557 | HelpMarker("Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window."); |
| 2558 | static bool disable_mouse_wheel = false; |
| 2559 | static bool disable_menu = false; |
| 2560 | ImGui::Checkbox("Disable Mouse Wheel", &disable_mouse_wheel); |
| 2561 | ImGui::Checkbox("Disable Menu", &disable_menu); |
| 2562 | |
| 2563 | // Child 1: no border, enable horizontal scrollbar |
| 2564 | { |
| 2565 | ImGuiWindowFlags window_flags = ImGuiWindowFlags_HorizontalScrollbar; |
| 2566 | if (disable_mouse_wheel) |
| 2567 | window_flags |= ImGuiWindowFlags_NoScrollWithMouse; |
| 2568 | ImGui::BeginChild("ChildL", ImVec2(ImGui::GetContentRegionAvail().x * 0.5f, 260), false, window_flags); |
| 2569 | for (int i = 0; i < 100; i++) |
| 2570 | ImGui::Text("%04d: scrollable region", i); |
| 2571 | ImGui::EndChild(); |
| 2572 | } |
| 2573 | |
| 2574 | ImGui::SameLine(); |
| 2575 | |
| 2576 | // Child 2: rounded border |
| 2577 | { |
| 2578 | ImGuiWindowFlags window_flags = ImGuiWindowFlags_None; |
| 2579 | if (disable_mouse_wheel) |
| 2580 | window_flags |= ImGuiWindowFlags_NoScrollWithMouse; |
| 2581 | if (!disable_menu) |
| 2582 | window_flags |= ImGuiWindowFlags_MenuBar; |
| 2583 | ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f); |
| 2584 | ImGui::BeginChild("ChildR", ImVec2(0, 260), true, window_flags); |
| 2585 | if (!disable_menu && ImGui::BeginMenuBar()) |
| 2586 | { |
| 2587 | if (ImGui::BeginMenu("Menu")) |
| 2588 | { |
| 2589 | ShowExampleMenuFile(); |
| 2590 | ImGui::EndMenu(); |
| 2591 | } |
| 2592 | ImGui::EndMenuBar(); |
| 2593 | } |
| 2594 | if (ImGui::BeginTable("split", 2, ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings)) |
| 2595 | { |
| 2596 | for (int i = 0; i < 100; i++) |
| 2597 | { |
| 2598 | char buf[32]; |
| 2599 | sprintf(buf, "%03d", i); |
| 2600 | ImGui::TableNextColumn(); |
| 2601 | ImGui::Button(buf, ImVec2(-FLT_MIN, 0.0f)); |
| 2602 | } |
| 2603 | ImGui::EndTable(); |
| 2604 | } |
| 2605 | ImGui::EndChild(); |
no test coverage detected