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.
| 6620 | // - BeginMenuBar() = menu-bar inside current window (which needs the ImGuiWindowFlags_MenuBar flag!) |
| 6621 | // - BeginMainMenuBar() = helper to create menu-bar-sized window at the top of the main viewport + call BeginMenuBar() into it. |
| 6622 | static void ShowExampleAppMainMenuBar() |
| 6623 | { |
| 6624 | if (ImGui::BeginMainMenuBar()) |
| 6625 | { |
| 6626 | if (ImGui::BeginMenu("File")) |
| 6627 | { |
| 6628 | ShowExampleMenuFile(); |
| 6629 | ImGui::EndMenu(); |
| 6630 | } |
| 6631 | if (ImGui::BeginMenu("Edit")) |
| 6632 | { |
| 6633 | if (ImGui::MenuItem("Undo", "CTRL+Z")) {} |
| 6634 | if (ImGui::MenuItem("Redo", "CTRL+Y", false, false)) {} // Disabled item |
| 6635 | ImGui::Separator(); |
| 6636 | if (ImGui::MenuItem("Cut", "CTRL+X")) {} |
| 6637 | if (ImGui::MenuItem("Copy", "CTRL+C")) {} |
| 6638 | if (ImGui::MenuItem("Paste", "CTRL+V")) {} |
| 6639 | ImGui::EndMenu(); |
| 6640 | } |
| 6641 | ImGui::EndMainMenuBar(); |
| 6642 | } |
| 6643 | } |
| 6644 | |
| 6645 | // Note that shortcuts are currently provided for display only |
| 6646 | // (future version will add explicit flags to BeginMenu() to request processing shortcuts) |
no test coverage detected