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.
| 6549 | // - BeginMenuBar() = menu-bar inside current window (which needs the ImGuiWindowFlags_MenuBar flag!) |
| 6550 | // - BeginMainMenuBar() = helper to create menu-bar-sized window at the top of the main viewport + call BeginMenuBar() into it. |
| 6551 | static void ShowExampleAppMainMenuBar() |
| 6552 | { |
| 6553 | if (ImGui::BeginMainMenuBar()) |
| 6554 | { |
| 6555 | if (ImGui::BeginMenu("File")) |
| 6556 | { |
| 6557 | ShowExampleMenuFile(); |
| 6558 | ImGui::EndMenu(); |
| 6559 | } |
| 6560 | if (ImGui::BeginMenu("Edit")) |
| 6561 | { |
| 6562 | if (ImGui::MenuItem("Undo", "CTRL+Z")) {} |
| 6563 | if (ImGui::MenuItem("Redo", "CTRL+Y", false, false)) {} // Disabled item |
| 6564 | ImGui::Separator(); |
| 6565 | if (ImGui::MenuItem("Cut", "CTRL+X")) {} |
| 6566 | if (ImGui::MenuItem("Copy", "CTRL+C")) {} |
| 6567 | if (ImGui::MenuItem("Paste", "CTRL+V")) {} |
| 6568 | ImGui::EndMenu(); |
| 6569 | } |
| 6570 | ImGui::EndMainMenuBar(); |
| 6571 | } |
| 6572 | } |
| 6573 | |
| 6574 | // Note that shortcuts are currently provided for display only |
| 6575 | // (future version will add explicit flags to BeginMenu() to request processing shortcuts) |
no test coverage detected