MCPcopy Create free account
hub / github.com/Nelarius/imnodes / ShowExampleAppMainMenuBar

Function ShowExampleAppMainMenuBar

dependencies/imgui-1.87/imgui_demo.cpp:6348–6369  ·  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

6346// - BeginMenuBar() = menu-bar inside current window (which needs the ImGuiWindowFlags_MenuBar flag!)
6347// - BeginMainMenuBar() = helper to create menu-bar-sized window at the top of the main viewport + call BeginMenuBar() into it.
6348static void ShowExampleAppMainMenuBar()
6349{
6350 if (ImGui::BeginMainMenuBar())
6351 {
6352 if (ImGui::BeginMenu("File"))
6353 {
6354 ShowExampleMenuFile();
6355 ImGui::EndMenu();
6356 }
6357 if (ImGui::BeginMenu("Edit"))
6358 {
6359 if (ImGui::MenuItem("Undo", "CTRL+Z")) {}
6360 if (ImGui::MenuItem("Redo", "CTRL+Y", false, false)) {} // Disabled item
6361 ImGui::Separator();
6362 if (ImGui::MenuItem("Cut", "CTRL+X")) {}
6363 if (ImGui::MenuItem("Copy", "CTRL+C")) {}
6364 if (ImGui::MenuItem("Paste", "CTRL+V")) {}
6365 ImGui::EndMenu();
6366 }
6367 ImGui::EndMainMenuBar();
6368 }
6369}
6370
6371// Note that shortcuts are currently provided for display only
6372// (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