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.
| 8648 | // - BeginMenuBar() = menu-bar inside current window (which needs the ImGuiWindowFlags_MenuBar flag!) |
| 8649 | // - BeginMainMenuBar() = helper to create menu-bar-sized window at the top of the main viewport + call BeginMenuBar() into it. |
| 8650 | static void ShowExampleAppMainMenuBar() |
| 8651 | { |
| 8652 | if (ImGui::BeginMainMenuBar()) |
| 8653 | { |
| 8654 | if (ImGui::BeginMenu("File")) |
| 8655 | { |
| 8656 | ShowExampleMenuFile(); |
| 8657 | ImGui::EndMenu(); |
| 8658 | } |
| 8659 | if (ImGui::BeginMenu("Edit")) |
| 8660 | { |
| 8661 | if (ImGui::MenuItem("Undo", "CTRL+Z")) {} |
| 8662 | if (ImGui::MenuItem("Redo", "CTRL+Y", false, false)) {} // Disabled item |
| 8663 | ImGui::Separator(); |
| 8664 | if (ImGui::MenuItem("Cut", "CTRL+X")) {} |
| 8665 | if (ImGui::MenuItem("Copy", "CTRL+C")) {} |
| 8666 | if (ImGui::MenuItem("Paste", "CTRL+V")) {} |
| 8667 | ImGui::EndMenu(); |
| 8668 | } |
| 8669 | ImGui::EndMainMenuBar(); |
| 8670 | } |
| 8671 | } |
| 8672 | |
| 8673 | // Note that shortcuts are currently provided for display only |
| 8674 | // (future version will add explicit flags to BeginMenu() to request processing shortcuts) |
no test coverage detected