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

Function ShowExampleAppLayout

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

Demonstrate create a window with multiple child windows.

Source from the content-addressed store, hash-verified

9407
9408// Demonstrate create a window with multiple child windows.
9409static void ShowExampleAppLayout(bool* p_open)
9410{
9411 ImGui::SetNextWindowSize(ImVec2(500, 440), ImGuiCond_FirstUseEver);
9412 if (ImGui::Begin("Example: Simple layout", p_open, ImGuiWindowFlags_MenuBar))
9413 {
9414 IMGUI_DEMO_MARKER("Examples/Simple layout");
9415 if (ImGui::BeginMenuBar())
9416 {
9417 if (ImGui::BeginMenu("File"))
9418 {
9419 if (ImGui::MenuItem("Close", "Ctrl+W")) { *p_open = false; }
9420 ImGui::EndMenu();
9421 }
9422 ImGui::EndMenuBar();
9423 }
9424
9425 // Left
9426 static int selected = 0;
9427 {
9428 ImGui::BeginChild("left pane", ImVec2(150, 0), ImGuiChildFlags_Borders | ImGuiChildFlags_ResizeX);
9429 for (int i = 0; i < 100; i++)
9430 {
9431 char label[128];
9432 sprintf(label, "MyObject %d", i);
9433 if (ImGui::Selectable(label, selected == i, ImGuiSelectableFlags_SelectOnNav))
9434 selected = i;
9435 }
9436 ImGui::EndChild();
9437 }
9438 ImGui::SameLine();
9439
9440 // Right
9441 {
9442 ImGui::BeginGroup();
9443 ImGui::BeginChild("item view", ImVec2(0, -ImGui::GetFrameHeightWithSpacing())); // Leave room for 1 line below us
9444 ImGui::Text("MyObject: %d", selected);
9445 ImGui::Separator();
9446 if (ImGui::BeginTabBar("##Tabs", ImGuiTabBarFlags_None))
9447 {
9448 if (ImGui::BeginTabItem("Description"))
9449 {
9450 ImGui::TextWrapped("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ");
9451 ImGui::EndTabItem();
9452 }
9453 if (ImGui::BeginTabItem("Details"))
9454 {
9455 ImGui::Text("ID: 0123456789");
9456 ImGui::EndTabItem();
9457 }
9458 ImGui::EndTabBar();
9459 }
9460 ImGui::EndChild();
9461 if (ImGui::Button("Revert")) {}
9462 ImGui::SameLine();
9463 if (ImGui::Button("Save")) {}
9464 ImGui::EndGroup();
9465 }
9466 }

Callers 1

ShowDemoWindowMethod · 0.85

Calls 15

SetNextWindowSizeFunction · 0.85
ImVec2Function · 0.85
BeginMenuFunction · 0.85
MenuItemFunction · 0.85
BeginChildFunction · 0.85
SelectableFunction · 0.85
SeparatorFunction · 0.85
BeginTabBarFunction · 0.85
BeginTabItemFunction · 0.85
TextWrappedFunction · 0.85
EndFunction · 0.85
BeginFunction · 0.50

Tested by

no test coverage detected