| 4360 | //----------------------------------------------------------------------------- |
| 4361 | |
| 4362 | static void DemoWindowLayout() |
| 4363 | { |
| 4364 | if (!ImGui::CollapsingHeader("Layout & Scrolling")) |
| 4365 | return; |
| 4366 | |
| 4367 | if (ImGui::TreeNode("Child windows")) |
| 4368 | { |
| 4369 | IMGUI_DEMO_MARKER("Layout/Child windows"); |
| 4370 | ImGui::SeparatorText("Child windows"); |
| 4371 | |
| 4372 | HelpMarker("Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window."); |
| 4373 | static bool disable_mouse_wheel = false; |
| 4374 | static bool disable_menu = false; |
| 4375 | ImGui::Checkbox("Disable Mouse Wheel", &disable_mouse_wheel); |
| 4376 | ImGui::Checkbox("Disable Menu", &disable_menu); |
| 4377 | |
| 4378 | // Child 1: no border, enable horizontal scrollbar |
| 4379 | { |
| 4380 | ImGuiWindowFlags window_flags = ImGuiWindowFlags_HorizontalScrollbar; |
| 4381 | if (disable_mouse_wheel) |
| 4382 | window_flags |= ImGuiWindowFlags_NoScrollWithMouse; |
| 4383 | ImGui::BeginChild("ChildL", ImVec2(ImGui::GetContentRegionAvail().x * 0.5f, 260), ImGuiChildFlags_None, window_flags); |
| 4384 | for (int i = 0; i < 100; i++) |
| 4385 | ImGui::Text("%04d: scrollable region", i); |
| 4386 | ImGui::EndChild(); |
| 4387 | } |
| 4388 | |
| 4389 | ImGui::SameLine(); |
| 4390 | |
| 4391 | // Child 2: rounded border |
| 4392 | { |
| 4393 | ImGuiWindowFlags window_flags = ImGuiWindowFlags_None; |
| 4394 | if (disable_mouse_wheel) |
| 4395 | window_flags |= ImGuiWindowFlags_NoScrollWithMouse; |
| 4396 | if (!disable_menu) |
| 4397 | window_flags |= ImGuiWindowFlags_MenuBar; |
| 4398 | ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f); |
| 4399 | ImGui::BeginChild("ChildR", ImVec2(0, 260), ImGuiChildFlags_Borders, window_flags); |
| 4400 | if (!disable_menu && ImGui::BeginMenuBar()) |
| 4401 | { |
| 4402 | if (ImGui::BeginMenu("Menu")) |
| 4403 | { |
| 4404 | ShowExampleMenuFile(); |
| 4405 | ImGui::EndMenu(); |
| 4406 | } |
| 4407 | ImGui::EndMenuBar(); |
| 4408 | } |
| 4409 | if (ImGui::BeginTable("split", 2, ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings)) |
| 4410 | { |
| 4411 | for (int i = 0; i < 100; i++) |
| 4412 | { |
| 4413 | char buf[32]; |
| 4414 | sprintf(buf, "%03d", i); |
| 4415 | ImGui::TableNextColumn(); |
| 4416 | ImGui::Button(buf, ImVec2(-FLT_MIN, 0.0f)); |
| 4417 | } |
| 4418 | ImGui::EndTable(); |
| 4419 | } |
no test coverage detected