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.
| 8882 | // - BeginMenuBar() = menu-bar inside current window (which needs the ImGuiWindowFlags_MenuBar flag!) |
| 8883 | // - BeginMainMenuBar() = helper to create menu-bar-sized window at the top of the main viewport + call BeginMenuBar() into it. |
| 8884 | static void ShowExampleAppMainMenuBar() |
| 8885 | { |
| 8886 | if (ImGui::BeginMainMenuBar()) |
| 8887 | { |
| 8888 | if (ImGui::BeginMenu("File")) |
| 8889 | { |
| 8890 | IMGUI_DEMO_MARKER("Menu/File"); |
| 8891 | ShowExampleMenuFile(); |
| 8892 | ImGui::EndMenu(); |
| 8893 | } |
| 8894 | if (ImGui::BeginMenu("Edit")) |
| 8895 | { |
| 8896 | IMGUI_DEMO_MARKER("Menu/Edit"); |
| 8897 | if (ImGui::MenuItem("Undo", "Ctrl+Z")) {} |
| 8898 | if (ImGui::MenuItem("Redo", "Ctrl+Y", false, false)) {} // Disabled item |
| 8899 | ImGui::Separator(); |
| 8900 | if (ImGui::MenuItem("Cut", "Ctrl+X")) {} |
| 8901 | if (ImGui::MenuItem("Copy", "Ctrl+C")) {} |
| 8902 | if (ImGui::MenuItem("Paste", "Ctrl+V")) {} |
| 8903 | ImGui::EndMenu(); |
| 8904 | } |
| 8905 | ImGui::EndMainMenuBar(); |
| 8906 | } |
| 8907 | } |
| 8908 | |
| 8909 | // Note that shortcuts are currently provided for display only |
| 8910 | // (future version will add explicit flags to BeginMenu() to request processing shortcuts) |
no test coverage detected