MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / ShowExampleAppMainMenuBar

Function ShowExampleAppMainMenuBar

lib/imgui/imgui_demo.cpp:3534–3555  ·  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 we Begin()-ed into (the window 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

3532// - BeginMenuBar() = menu-bar inside current window we Begin()-ed into (the window needs the ImGuiWindowFlags_MenuBar flag)
3533// - BeginMainMenuBar() = helper to create menu-bar-sized window at the top of the main viewport + call BeginMenuBar() into it.
3534static void ShowExampleAppMainMenuBar()
3535{
3536 if (ImGui::BeginMainMenuBar())
3537 {
3538 if (ImGui::BeginMenu("File"))
3539 {
3540 ShowExampleMenuFile();
3541 ImGui::EndMenu();
3542 }
3543 if (ImGui::BeginMenu("Edit"))
3544 {
3545 if (ImGui::MenuItem("Undo", "CTRL+Z")) {}
3546 if (ImGui::MenuItem("Redo", "CTRL+Y", false, false)) {} // Disabled item
3547 ImGui::Separator();
3548 if (ImGui::MenuItem("Cut", "CTRL+X")) {}
3549 if (ImGui::MenuItem("Copy", "CTRL+C")) {}
3550 if (ImGui::MenuItem("Paste", "CTRL+V")) {}
3551 ImGui::EndMenu();
3552 }
3553 ImGui::EndMainMenuBar();
3554 }
3555}
3556
3557// Note that shortcuts are currently provided for display only (future version will add flags to BeginMenu to process shortcuts)
3558static void ShowExampleMenuFile()

Callers 1

ShowDemoWindowMethod · 0.85

Calls 1

ShowExampleMenuFileFunction · 0.85

Tested by

no test coverage detected