MCPcopy Create free account
hub / github.com/Aegel5/SimpleSwitcher / ShowExampleAppMainMenuBar

Function ShowExampleAppMainMenuBar

imgui_tiny_app/imgui/imgui_demo.cpp:8884–8907  ·  view source on GitHub ↗

Demonstrate creating a "main" fullscreen menu bar and populating it. Note the difference between BeginMainMenuBar() and BeginMenuBar(): - BeginMenuBar() = menu-bar inside current window (which needs the ImGuiWindowFlags_MenuBar flag!) - BeginMainMenuBar() = helper to create menu-bar-sized window at the top of the main viewport + call BeginMenuBar() into it.

Source from the content-addressed store, hash-verified

8882// - BeginMenuBar() = menu-bar inside current window (which needs the ImGuiWindowFlags_MenuBar flag!)
8883// - BeginMainMenuBar() = helper to create menu-bar-sized window at the top of the main viewport + call BeginMenuBar() into it.
8884static void ShowExampleAppMainMenuBar()
8885{
8886 if (ImGui::BeginMainMenuBar())
8887 {
8888 if (ImGui::BeginMenu("File"))
8889 {
8890 IMGUI_DEMO_MARKER("Menu/File");
8891 ShowExampleMenuFile();
8892 ImGui::EndMenu();
8893 }
8894 if (ImGui::BeginMenu("Edit"))
8895 {
8896 IMGUI_DEMO_MARKER("Menu/Edit");
8897 if (ImGui::MenuItem("Undo", "Ctrl+Z")) {}
8898 if (ImGui::MenuItem("Redo", "Ctrl+Y", false, false)) {} // Disabled item
8899 ImGui::Separator();
8900 if (ImGui::MenuItem("Cut", "Ctrl+X")) {}
8901 if (ImGui::MenuItem("Copy", "Ctrl+C")) {}
8902 if (ImGui::MenuItem("Paste", "Ctrl+V")) {}
8903 ImGui::EndMenu();
8904 }
8905 ImGui::EndMainMenuBar();
8906 }
8907}
8908
8909// Note that shortcuts are currently provided for display only
8910// (future version will add explicit flags to BeginMenu() to request processing shortcuts)

Callers 1

ShowDemoWindowMethod · 0.85

Calls 1

ShowExampleMenuFileFunction · 0.85

Tested by

no test coverage detected