MCPcopy Create free account
hub / github.com/ShenCiao/CialloResearch / ShowDemoWindowLayout

Function ShowDemoWindowLayout

imgui/imgui_demo.cpp:2594–3374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2592}
2593
2594static void ShowDemoWindowLayout()
2595{
2596 IMGUI_DEMO_MARKER("Layout");
2597 if (!ImGui::CollapsingHeader("Layout & Scrolling"))
2598 return;
2599
2600 IMGUI_DEMO_MARKER("Layout/Child windows");
2601 if (ImGui::TreeNode("Child windows"))
2602 {
2603 HelpMarker("Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window.");
2604 static bool disable_mouse_wheel = false;
2605 static bool disable_menu = false;
2606 ImGui::Checkbox("Disable Mouse Wheel", &disable_mouse_wheel);
2607 ImGui::Checkbox("Disable Menu", &disable_menu);
2608
2609 // Child 1: no border, enable horizontal scrollbar
2610 {
2611 ImGuiWindowFlags window_flags = ImGuiWindowFlags_HorizontalScrollbar;
2612 if (disable_mouse_wheel)
2613 window_flags |= ImGuiWindowFlags_NoScrollWithMouse;
2614 ImGui::BeginChild("ChildL", ImVec2(ImGui::GetContentRegionAvail().x * 0.5f, 260), false, window_flags);
2615 for (int i = 0; i < 100; i++)
2616 ImGui::Text("%04d: scrollable region", i);
2617 ImGui::EndChild();
2618 }
2619
2620 ImGui::SameLine();
2621
2622 // Child 2: rounded border
2623 {
2624 ImGuiWindowFlags window_flags = ImGuiWindowFlags_None;
2625 if (disable_mouse_wheel)
2626 window_flags |= ImGuiWindowFlags_NoScrollWithMouse;
2627 if (!disable_menu)
2628 window_flags |= ImGuiWindowFlags_MenuBar;
2629 ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f);
2630 ImGui::BeginChild("ChildR", ImVec2(0, 260), true, window_flags);
2631 if (!disable_menu && ImGui::BeginMenuBar())
2632 {
2633 if (ImGui::BeginMenu("Menu"))
2634 {
2635 ShowExampleMenuFile();
2636 ImGui::EndMenu();
2637 }
2638 ImGui::EndMenuBar();
2639 }
2640 if (ImGui::BeginTable("split", 2, ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings))
2641 {
2642 for (int i = 0; i < 100; i++)
2643 {
2644 char buf[32];
2645 sprintf(buf, "%03d", i);
2646 ImGui::TableNextColumn();
2647 ImGui::Button(buf, ImVec2(-FLT_MIN, 0.0f));
2648 }
2649 ImGui::EndTable();
2650 }
2651 ImGui::EndChild();

Callers 1

ShowDemoWindowMethod · 0.85

Calls 14

ImVec2Function · 0.85
PushStyleVarFunction · 0.85
ShowExampleMenuFileFunction · 0.85
PopStyleVarFunction · 0.85
PushStyleColorFunction · 0.85
PopStyleColorFunction · 0.85
DragFloatFunction · 0.85
ImVec4Class · 0.85
PlotHistogramFunction · 0.85
AddRectFilledMethod · 0.80
AddTextMethod · 0.80
HelpMarkerFunction · 0.70

Tested by

no test coverage detected