playground/ExampleApps/ExampleAppLayout.cpp
// Demonstrate create a window with multiple child windows.
Demonstrate create a window with multiple child windows.
Demonstrate create a window with multiple child windows .
static void ShowExampleAppLayout(bool* p_open)
{
    ImGui::SetNextWindowSize(ImVec2(500, 440), ImGuiCond_FirstUseEver);
    if (ImGui::Begin("Example: Simple layout", p_open, ImGuiWindowFlags_MenuBar))
    {
        DEMO_MARKER("Examples/Simple layout");
        if (ImGui::BeginMenuBar())
        {
            if (ImGui::BeginMenu("File"))
            {
                if (ImGui::MenuItem("Close")) *p_open = false;
                ImGui::EndMenu();
            }
            ImGui::EndMenuBar();
        }
        static int selected = 0;
        {
            ImGui::BeginChild("left pane", ImVec2(150, 0), true);
            for (int i = 0; i < 100; i++)
            {
                char label[128];
                sprintf(label, "MyObject %d", i);
                if (ImGui::Selectable(label, selected == i))
                    selected = i;
            }
            ImGui::EndChild();
        }
        ImGui::SameLine();
        {
            ImGui::BeginGroup();
            ImGui::BeginChild("item view", ImVec2(0, -ImGui::GetFrameHeightWithSpacing())); 
            ImGui::Text("MyObject: %d", selected);
            ImGui::Separator();
            if (ImGui::BeginTabBar("##Tabs", ImGuiTabBarFlags_None))
            {
                if (ImGui::BeginTabItem("Description"))
                {
                    ImGui::TextWrapped("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ");
                    ImGui::EndTabItem();
                }
                if (ImGui::BeginTabItem("Details"))
                {
                    ImGui::Text("ID: 0123456789");
                    ImGui::EndTabItem();
                }
                ImGui::EndTabBar();
            }
            ImGui::EndChild();
            if (ImGui::Button("Revert")) {}
            ImGui::SameLine();
            if (ImGui::Button("Save")) {}
            ImGui::EndGroup();
        }
    }
    ImGui::End();
}
static void ShowExampleAppLayout ( bool * p_open ) { ImGui :: SetNextWindowSize ( ImVec2 ( 500 , 440 ) , ImGuiCond_FirstUseEver ) ; if ( ImGui :: Begin ( " " , p_open , ImGuiWindowFlags_MenuBar ) ) { DEMO_MARKER ( " " ) ; if ( ImGui :: BeginMenuBar ( ) ) { if ( ImGui :: BeginMenu ( " " ) ) { if ( ImGui :: MenuItem ( " " ) ) * p_open = false ; ImGui :: EndMenu ( ) ; } ImGui :: EndMenuBar ( ) ; } static int selected = 0 ; { ImGui :: BeginChild ( " " , ImVec2 ( 150 , 0 ) , true ) ; for ( int i = 0 ; i < 100 ; i ++ ) { char label [ 128 ] ; sprintf ( label , " " , i ) ; if ( ImGui :: Selectable ( label , selected == i ) ) selected = i ; } ImGui :: EndChild ( ) ; } ImGui :: SameLine ( ) ; { ImGui :: BeginGroup ( ) ; ImGui :: BeginChild ( " " , ImVec2 ( 0 , - ImGui :: GetFrameHeightWithSpacing ( ) ) ) ; ImGui :: Text ( " " , selected ) ; ImGui :: Separator ( ) ; if ( ImGui :: BeginTabBar ( " " , ImGuiTabBarFlags_None ) ) { if ( ImGui :: BeginTabItem ( " " ) ) { ImGui :: TextWrapped ( " " ) ; ImGui :: EndTabItem ( ) ; } if ( ImGui :: BeginTabItem ( " " ) ) { ImGui :: Text ( " " ) ; ImGui :: EndTabItem ( ) ; } ImGui :: EndTabBar ( ) ; } ImGui :: EndChild ( ) ; if ( ImGui :: Button ( " " ) ) { } ImGui :: SameLine ( ) ; if ( ImGui :: Button ( " " ) ) { } ImGui :: EndGroup ( ) ; } } ImGui :: End ( ) ; }
Demonstrate create a window with multiple child windows.
Demonstrate create a window with multiple child windows .
// Left // FIXME: Good candidate to use ImGuiSelectableFlags_SelectOnNav // Right // Leave room for 1 line below us