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

Function ShowExampleAppLayout

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

Demonstrate create a window with multiple child windows.

Source from the content-addressed store, hash-verified

9505
9506// Demonstrate create a window with multiple child windows.
9507static void ShowExampleAppLayout(bool* p_open)
9508{
9509 ImGui::SetNextWindowSize(ImVec2(500, 440), ImGuiCond_FirstUseEver);
9510 if (ImGui::Begin("Example: Simple layout", p_open, ImGuiWindowFlags_MenuBar))
9511 {
9512 IMGUI_DEMO_MARKER("Examples/Simple layout");
9513 if (ImGui::BeginMenuBar())
9514 {
9515 if (ImGui::BeginMenu("File"))
9516 {
9517 if (ImGui::MenuItem("Close", "Ctrl+W")) { *p_open = false; }
9518 ImGui::EndMenu();
9519 }
9520 ImGui::EndMenuBar();
9521 }
9522
9523 // Left
9524 static int selected = 0;
9525 {
9526 ImGui::BeginChild("left pane", ImVec2(150, 0), ImGuiChildFlags_Borders | ImGuiChildFlags_ResizeX);
9527 for (int i = 0; i < 100; i++)
9528 {
9529 char label[128];
9530 sprintf(label, "MyObject %d", i);
9531 if (ImGui::Selectable(label, selected == i, ImGuiSelectableFlags_SelectOnNav))
9532 selected = i;
9533 }
9534 ImGui::EndChild();
9535 }
9536 ImGui::SameLine();
9537
9538 // Right
9539 {
9540 ImGui::BeginGroup();
9541 ImGui::BeginChild("item view", ImVec2(0, -ImGui::GetFrameHeightWithSpacing())); // Leave room for 1 line below us
9542 ImGui::Text("MyObject: %d", selected);
9543 ImGui::Separator();
9544 if (ImGui::BeginTabBar("##Tabs", ImGuiTabBarFlags_None))
9545 {
9546 if (ImGui::BeginTabItem("Description"))
9547 {
9548 ImGui::TextWrapped("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ");
9549 ImGui::EndTabItem();
9550 }
9551 if (ImGui::BeginTabItem("Details"))
9552 {
9553 ImGui::Text("ID: 0123456789");
9554 ImGui::EndTabItem();
9555 }
9556 ImGui::EndTabBar();
9557 }
9558 ImGui::EndChild();
9559 if (ImGui::Button("Revert")) {}
9560 ImGui::SameLine();
9561 if (ImGui::Button("Save")) {}
9562 ImGui::EndGroup();
9563 }
9564 }

Callers 1

ShowDemoWindowMethod · 0.85

Calls 4

BeginFunction · 0.85
sprintfFunction · 0.85
EndFunction · 0.85
ImVec2Function · 0.50

Tested by

no test coverage detected