MCPcopy Create free account
hub / github.com/PolygonTek/BlueshiftEngine / ShowExampleAppLayout

Function ShowExampleAppLayout

Source/ThirdParty/imgui/imgui_demo.cpp:4128–4182  ·  view source on GitHub ↗

Demonstrate create a window with multiple child windows.

Source from the content-addressed store, hash-verified

4126
4127// Demonstrate create a window with multiple child windows.
4128static void ShowExampleAppLayout(bool* p_open)
4129{
4130 ImGui::SetNextWindowSize(ImVec2(500, 440), ImGuiCond_FirstUseEver);
4131 if (ImGui::Begin("Example: Simple layout", p_open, ImGuiWindowFlags_MenuBar))
4132 {
4133 if (ImGui::BeginMenuBar())
4134 {
4135 if (ImGui::BeginMenu("File"))
4136 {
4137 if (ImGui::MenuItem("Close")) *p_open = false;
4138 ImGui::EndMenu();
4139 }
4140 ImGui::EndMenuBar();
4141 }
4142
4143 // left
4144 static int selected = 0;
4145 ImGui::BeginChild("left pane", ImVec2(150, 0), true);
4146 for (int i = 0; i < 100; i++)
4147 {
4148 char label[128];
4149 sprintf(label, "MyObject %d", i);
4150 if (ImGui::Selectable(label, selected == i))
4151 selected = i;
4152 }
4153 ImGui::EndChild();
4154 ImGui::SameLine();
4155
4156 // right
4157 ImGui::BeginGroup();
4158 ImGui::BeginChild("item view", ImVec2(0, -ImGui::GetFrameHeightWithSpacing())); // Leave room for 1 line below us
4159 ImGui::Text("MyObject: %d", selected);
4160 ImGui::Separator();
4161 if (ImGui::BeginTabBar("##Tabs", ImGuiTabBarFlags_None))
4162 {
4163 if (ImGui::BeginTabItem("Description"))
4164 {
4165 ImGui::TextWrapped("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ");
4166 ImGui::EndTabItem();
4167 }
4168 if (ImGui::BeginTabItem("Details"))
4169 {
4170 ImGui::Text("ID: 0123456789");
4171 ImGui::EndTabItem();
4172 }
4173 ImGui::EndTabBar();
4174 }
4175 ImGui::EndChild();
4176 if (ImGui::Button("Revert")) {}
4177 ImGui::SameLine();
4178 if (ImGui::Button("Save")) {}
4179 ImGui::EndGroup();
4180 }
4181 ImGui::End();
4182}
4183
4184//-----------------------------------------------------------------------------
4185// [SECTION] Example App: Property Editor / ShowExampleAppPropertyEditor()

Callers 1

ShowDemoWindowMethod · 0.85

Calls 2

ImVec2Class · 0.85
sprintfFunction · 0.85

Tested by

no test coverage detected