| 2325 | } |
| 2326 | |
| 2327 | static void ShowDemoWindowLayout() |
| 2328 | { |
| 2329 | if (!ImGui::CollapsingHeader("Layout & Scrolling")) |
| 2330 | return; |
| 2331 | |
| 2332 | if (ImGui::TreeNode("Child windows")) |
| 2333 | { |
| 2334 | HelpMarker("Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window."); |
| 2335 | static bool disable_mouse_wheel = false; |
| 2336 | static bool disable_menu = false; |
| 2337 | ImGui::Checkbox("Disable Mouse Wheel", &disable_mouse_wheel); |
| 2338 | ImGui::Checkbox("Disable Menu", &disable_menu); |
| 2339 | |
| 2340 | // Child 1: no border, enable horizontal scrollbar |
| 2341 | { |
| 2342 | ImGuiWindowFlags window_flags = ImGuiWindowFlags_HorizontalScrollbar; |
| 2343 | if (disable_mouse_wheel) |
| 2344 | window_flags |= ImGuiWindowFlags_NoScrollWithMouse; |
| 2345 | ImGui::BeginChild("ChildL", ImVec2(ImGui::GetWindowContentRegionWidth() * 0.5f, 260), false, window_flags); |
| 2346 | for (int i = 0; i < 100; i++) |
| 2347 | ImGui::Text("%04d: scrollable region", i); |
| 2348 | ImGui::EndChild(); |
| 2349 | } |
| 2350 | |
| 2351 | ImGui::SameLine(); |
| 2352 | |
| 2353 | // Child 2: rounded border |
| 2354 | { |
| 2355 | ImGuiWindowFlags window_flags = ImGuiWindowFlags_None; |
| 2356 | if (disable_mouse_wheel) |
| 2357 | window_flags |= ImGuiWindowFlags_NoScrollWithMouse; |
| 2358 | if (!disable_menu) |
| 2359 | window_flags |= ImGuiWindowFlags_MenuBar; |
| 2360 | ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f); |
| 2361 | ImGui::BeginChild("ChildR", ImVec2(0, 260), true, window_flags); |
| 2362 | if (!disable_menu && ImGui::BeginMenuBar()) |
| 2363 | { |
| 2364 | if (ImGui::BeginMenu("Menu")) |
| 2365 | { |
| 2366 | ShowExampleMenuFile(); |
| 2367 | ImGui::EndMenu(); |
| 2368 | } |
| 2369 | ImGui::EndMenuBar(); |
| 2370 | } |
| 2371 | if (ImGui::BeginTable("split", 2, ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings)) |
| 2372 | { |
| 2373 | for (int i = 0; i < 100; i++) |
| 2374 | { |
| 2375 | char buf[32]; |
| 2376 | sprintf(buf, "%03d", i); |
| 2377 | ImGui::TableNextColumn(); |
| 2378 | ImGui::Button(buf, ImVec2(-FLT_MIN, 0.0f)); |
| 2379 | } |
| 2380 | ImGui::EndTable(); |
| 2381 | } |
| 2382 | ImGui::EndChild(); |
| 2383 | ImGui::PopStyleVar(); |
| 2384 | } |
no test coverage detected