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.
| 8844 | // - BeginMenuBar() = menu-bar inside current window (which needs the ImGuiWindowFlags_MenuBar flag!) |
| 8845 | // - BeginMainMenuBar() = helper to create menu-bar-sized window at the top of the main viewport + call BeginMenuBar() into it. |
| 8846 | static void ShowExampleAppMainMenuBar() |
| 8847 | { |
| 8848 | if (ImGui::BeginMainMenuBar()) |
| 8849 | { |
| 8850 | if (ImGui::BeginMenu("File")) |
| 8851 | { |
| 8852 | IMGUI_DEMO_MARKER("Menu/File"); |
| 8853 | ShowExampleMenuFile(); |
| 8854 | ImGui::EndMenu(); |
| 8855 | } |
| 8856 | if (ImGui::BeginMenu("Edit")) |
| 8857 | { |
| 8858 | IMGUI_DEMO_MARKER("Menu/Edit"); |
| 8859 | if (ImGui::MenuItem("Undo", "Ctrl+Z")) {} |
| 8860 | if (ImGui::MenuItem("Redo", "Ctrl+Y", false, false)) {} // Disabled item |
| 8861 | ImGui::Separator(); |
| 8862 | if (ImGui::MenuItem("Cut", "Ctrl+X")) {} |
| 8863 | if (ImGui::MenuItem("Copy", "Ctrl+C")) {} |
| 8864 | if (ImGui::MenuItem("Paste", "Ctrl+V")) {} |
| 8865 | ImGui::EndMenu(); |
| 8866 | } |
| 8867 | ImGui::EndMainMenuBar(); |
| 8868 | } |
| 8869 | } |
| 8870 | |
| 8871 | // Note that shortcuts are currently provided for display only |
| 8872 | // (future version will add explicit flags to BeginMenu() to request processing shortcuts) |
no test coverage detected