| 2464 | } |
| 2465 | |
| 2466 | static void ShowDemoWindowLayout() |
| 2467 | { |
| 2468 | IMGUI_DEMO_MARKER("Layout"); |
| 2469 | if (!ImGui::CollapsingHeader("Layout & Scrolling")) |
| 2470 | return; |
| 2471 | |
| 2472 | IMGUI_DEMO_MARKER("Layout/Child windows"); |
| 2473 | if (ImGui::TreeNode("Child windows")) |
| 2474 | { |
| 2475 | HelpMarker("Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window."); |
| 2476 | static bool disable_mouse_wheel = false; |
| 2477 | static bool disable_menu = false; |
| 2478 | ImGui::Checkbox("Disable Mouse Wheel", &disable_mouse_wheel); |
| 2479 | ImGui::Checkbox("Disable Menu", &disable_menu); |
| 2480 | |
| 2481 | // Child 1: no border, enable horizontal scrollbar |
| 2482 | { |
| 2483 | ImGuiWindowFlags window_flags = ImGuiWindowFlags_HorizontalScrollbar; |
| 2484 | if (disable_mouse_wheel) |
| 2485 | window_flags |= ImGuiWindowFlags_NoScrollWithMouse; |
| 2486 | ImGui::BeginChild("ChildL", ImVec2(ImGui::GetContentRegionAvail().x * 0.5f, 260), false, window_flags); |
| 2487 | for (int i = 0; i < 100; i++) |
| 2488 | ImGui::Text("%04d: scrollable region", i); |
| 2489 | ImGui::EndChild(); |
| 2490 | } |
| 2491 | |
| 2492 | ImGui::SameLine(); |
| 2493 | |
| 2494 | // Child 2: rounded border |
| 2495 | { |
| 2496 | ImGuiWindowFlags window_flags = ImGuiWindowFlags_None; |
| 2497 | if (disable_mouse_wheel) |
| 2498 | window_flags |= ImGuiWindowFlags_NoScrollWithMouse; |
| 2499 | if (!disable_menu) |
| 2500 | window_flags |= ImGuiWindowFlags_MenuBar; |
| 2501 | ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f); |
| 2502 | ImGui::BeginChild("ChildR", ImVec2(0, 260), true, window_flags); |
| 2503 | if (!disable_menu && ImGui::BeginMenuBar()) |
| 2504 | { |
| 2505 | if (ImGui::BeginMenu("Menu")) |
| 2506 | { |
| 2507 | ShowExampleMenuFile(); |
| 2508 | ImGui::EndMenu(); |
| 2509 | } |
| 2510 | ImGui::EndMenuBar(); |
| 2511 | } |
| 2512 | if (ImGui::BeginTable("split", 2, ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings)) |
| 2513 | { |
| 2514 | for (int i = 0; i < 100; i++) |
| 2515 | { |
| 2516 | char buf[32]; |
| 2517 | sprintf(buf, "%03d", i); |
| 2518 | ImGui::TableNextColumn(); |
| 2519 | ImGui::Button(buf, ImVec2(-FLT_MIN, 0.0f)); |
| 2520 | } |
| 2521 | ImGui::EndTable(); |
| 2522 | } |
| 2523 | ImGui::EndChild(); |
no test coverage detected