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.
| 6175 | // - BeginMenuBar() = menu-bar inside current window (which needs the ImGuiWindowFlags_MenuBar flag!) |
| 6176 | // - BeginMainMenuBar() = helper to create menu-bar-sized window at the top of the main viewport + call BeginMenuBar() into it. |
| 6177 | static void ShowExampleAppMainMenuBar() |
| 6178 | { |
| 6179 | if (ImGui::BeginMainMenuBar()) |
| 6180 | { |
| 6181 | if (ImGui::BeginMenu("File")) |
| 6182 | { |
| 6183 | ShowExampleMenuFile(); |
| 6184 | ImGui::EndMenu(); |
| 6185 | } |
| 6186 | if (ImGui::BeginMenu("Edit")) |
| 6187 | { |
| 6188 | if (ImGui::MenuItem("Undo", "CTRL+Z")) {} |
| 6189 | if (ImGui::MenuItem("Redo", "CTRL+Y", false, false)) {} // Disabled item |
| 6190 | ImGui::Separator(); |
| 6191 | if (ImGui::MenuItem("Cut", "CTRL+X")) {} |
| 6192 | if (ImGui::MenuItem("Copy", "CTRL+C")) {} |
| 6193 | if (ImGui::MenuItem("Paste", "CTRL+V")) {} |
| 6194 | ImGui::EndMenu(); |
| 6195 | } |
| 6196 | ImGui::EndMainMenuBar(); |
| 6197 | } |
| 6198 | } |
| 6199 | |
| 6200 | // Note that shortcuts are currently provided for display only |
| 6201 | // (future version will add explicit flags to BeginMenu() to request processing shortcuts) |
no test coverage detected