MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / DemoWindowLayout

Function DemoWindowLayout

3rdparty/imgui/src/imgui_demo.cpp:4438–5317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4436//-----------------------------------------------------------------------------
4437
4438static void DemoWindowLayout()
4439{
4440 if (!ImGui::CollapsingHeader("Layout & Scrolling"))
4441 return;
4442
4443 if (ImGui::TreeNode("Child windows"))
4444 {
4445 IMGUI_DEMO_MARKER("Layout/Child windows");
4446 ImGui::SeparatorText("Child windows");
4447
4448 HelpMarker("Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window.");
4449 static bool disable_mouse_wheel = false;
4450 static bool disable_menu = false;
4451 ImGui::Checkbox("Disable Mouse Wheel", &disable_mouse_wheel);
4452 ImGui::Checkbox("Disable Menu", &disable_menu);
4453
4454 // Child 1: no border, enable horizontal scrollbar
4455 {
4456 ImGuiWindowFlags window_flags = ImGuiWindowFlags_HorizontalScrollbar;
4457 if (disable_mouse_wheel)
4458 window_flags |= ImGuiWindowFlags_NoScrollWithMouse;
4459 ImGui::BeginChild("ChildL", ImVec2(ImGui::GetContentRegionAvail().x * 0.5f, 260), ImGuiChildFlags_None, window_flags);
4460 for (int i = 0; i < 100; i++)
4461 ImGui::Text("%04d: scrollable region", i);
4462 ImGui::EndChild();
4463 }
4464
4465 ImGui::SameLine();
4466
4467 // Child 2: rounded border
4468 {
4469 ImGuiWindowFlags window_flags = ImGuiWindowFlags_None;
4470 if (disable_mouse_wheel)
4471 window_flags |= ImGuiWindowFlags_NoScrollWithMouse;
4472 if (!disable_menu)
4473 window_flags |= ImGuiWindowFlags_MenuBar;
4474 ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f);
4475 ImGui::BeginChild("ChildR", ImVec2(0, 260), ImGuiChildFlags_Borders, window_flags);
4476 if (!disable_menu && ImGui::BeginMenuBar())
4477 {
4478 if (ImGui::BeginMenu("Menu"))
4479 {
4480 ShowExampleMenuFile();
4481 ImGui::EndMenu();
4482 }
4483 ImGui::EndMenuBar();
4484 }
4485 if (ImGui::BeginTable("split", 2, ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings))
4486 {
4487 for (int i = 0; i < 100; i++)
4488 {
4489 char buf[32];
4490 sprintf(buf, "%03d", i);
4491 ImGui::TableNextColumn();
4492 ImGui::Button(buf, ImVec2(-FLT_MIN, 0.0f));
4493 }
4494 ImGui::EndTable();
4495 }

Callers 1

ShowDemoWindowMethod · 0.85

Calls 12

HelpMarkerFunction · 0.85
ShowExampleMenuFileFunction · 0.85
sprintfFunction · 0.85
IndentFunction · 0.85
ImVec4Class · 0.85
BeginFunction · 0.85
EndFunction · 0.85
AddRectFilledMethod · 0.80
AddTextMethod · 0.80
ImVec2Function · 0.50
PushClipRectMethod · 0.45
PopClipRectMethod · 0.45

Tested by

no test coverage detected