MCPcopy Create free account
hub / github.com/GPUOpen-LibrariesAndSDKs/Cauldron / ShowExampleAppLayout

Function ShowExampleAppLayout

libs/imgui/imgui_demo.cpp:2890–2931  ·  view source on GitHub ↗

Demonstrate create a window with multiple child windows.

Source from the content-addressed store, hash-verified

2888
2889// Demonstrate create a window with multiple child windows.
2890static void ShowExampleAppLayout(bool* p_open)
2891{
2892 ImGui::SetNextWindowSize(ImVec2(500, 440), ImGuiCond_FirstUseEver);
2893 if (ImGui::Begin("Example: Layout", p_open, ImGuiWindowFlags_MenuBar))
2894 {
2895 if (ImGui::BeginMenuBar())
2896 {
2897 if (ImGui::BeginMenu("File"))
2898 {
2899 if (ImGui::MenuItem("Close")) *p_open = false;
2900 ImGui::EndMenu();
2901 }
2902 ImGui::EndMenuBar();
2903 }
2904
2905 // left
2906 static int selected = 0;
2907 ImGui::BeginChild("left pane", ImVec2(150, 0), true);
2908 for (int i = 0; i < 100; i++)
2909 {
2910 char label[128];
2911 sprintf(label, "MyObject %d", i);
2912 if (ImGui::Selectable(label, selected == i))
2913 selected = i;
2914 }
2915 ImGui::EndChild();
2916 ImGui::SameLine();
2917
2918 // right
2919 ImGui::BeginGroup();
2920 ImGui::BeginChild("item view", ImVec2(0, -ImGui::GetFrameHeightWithSpacing())); // Leave room for 1 line below us
2921 ImGui::Text("MyObject: %d", selected);
2922 ImGui::Separator();
2923 ImGui::TextWrapped("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ");
2924 ImGui::EndChild();
2925 if (ImGui::Button("Revert")) {}
2926 ImGui::SameLine();
2927 if (ImGui::Button("Save")) {}
2928 ImGui::EndGroup();
2929 }
2930 ImGui::End();
2931}
2932
2933// Demonstrate create a simple property editor.
2934static void ShowExampleAppPropertyEditor(bool* p_open)

Callers 1

ShowDemoWindowMethod · 0.85

Calls 1

ImVec2Class · 0.85

Tested by

no test coverage detected