MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / DemoWindowLayout

Function DemoWindowLayout

Source/3rdParty/imgui/imgui_demo.cpp:4362–5241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4360//-----------------------------------------------------------------------------
4361
4362static 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 }

Callers 1

ShowDemoWindowMethod · 0.85

Calls 15

CollapsingHeaderFunction · 0.85
SeparatorTextFunction · 0.85
CheckboxFunction · 0.85
BeginChildFunction · 0.85
ImVec2Function · 0.85
BeginMenuFunction · 0.85
ShowExampleMenuFileFunction · 0.85
BeginTableFunction · 0.85
PopStyleVarFunction · 0.85
GetStyleColorVec4Function · 0.85
PopStyleColorFunction · 0.85
DragIntFunction · 0.85

Tested by

no test coverage detected