MCPcopy Create free account
hub / github.com/TurningWheel/Barony / ShowExampleAppMainMenuBar

Function ShowExampleAppMainMenuBar

src/imgui/imgui_demo.cpp:6444–6465  ·  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

6442// - BeginMenuBar() = menu-bar inside current window (which needs the ImGuiWindowFlags_MenuBar flag!)
6443// - BeginMainMenuBar() = helper to create menu-bar-sized window at the top of the main viewport + call BeginMenuBar() into it.
6444static void ShowExampleAppMainMenuBar()
6445{
6446 if (ImGui::BeginMainMenuBar())
6447 {
6448 if (ImGui::BeginMenu("File"))
6449 {
6450 ShowExampleMenuFile();
6451 ImGui::EndMenu();
6452 }
6453 if (ImGui::BeginMenu("Edit"))
6454 {
6455 if (ImGui::MenuItem("Undo", "CTRL+Z")) {}
6456 if (ImGui::MenuItem("Redo", "CTRL+Y", false, false)) {} // Disabled item
6457 ImGui::Separator();
6458 if (ImGui::MenuItem("Cut", "CTRL+X")) {}
6459 if (ImGui::MenuItem("Copy", "CTRL+C")) {}
6460 if (ImGui::MenuItem("Paste", "CTRL+V")) {}
6461 ImGui::EndMenu();
6462 }
6463 ImGui::EndMainMenuBar();
6464 }
6465}
6466
6467// Note that shortcuts are currently provided for display only
6468// (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