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.
| 6346 | // - BeginMenuBar() = menu-bar inside current window (which needs the ImGuiWindowFlags_MenuBar flag!) |
| 6347 | // - BeginMainMenuBar() = helper to create menu-bar-sized window at the top of the main viewport + call BeginMenuBar() into it. |
| 6348 | static void ShowExampleAppMainMenuBar() |
| 6349 | { |
| 6350 | if (ImGui::BeginMainMenuBar()) |
| 6351 | { |
| 6352 | if (ImGui::BeginMenu("File")) |
| 6353 | { |
| 6354 | ShowExampleMenuFile(); |
| 6355 | ImGui::EndMenu(); |
| 6356 | } |
| 6357 | if (ImGui::BeginMenu("Edit")) |
| 6358 | { |
| 6359 | if (ImGui::MenuItem("Undo", "CTRL+Z")) {} |
| 6360 | if (ImGui::MenuItem("Redo", "CTRL+Y", false, false)) {} // Disabled item |
| 6361 | ImGui::Separator(); |
| 6362 | if (ImGui::MenuItem("Cut", "CTRL+X")) {} |
| 6363 | if (ImGui::MenuItem("Copy", "CTRL+C")) {} |
| 6364 | if (ImGui::MenuItem("Paste", "CTRL+V")) {} |
| 6365 | ImGui::EndMenu(); |
| 6366 | } |
| 6367 | ImGui::EndMainMenuBar(); |
| 6368 | } |
| 6369 | } |
| 6370 | |
| 6371 | // Note that shortcuts are currently provided for display only |
| 6372 | // (future version will add explicit flags to BeginMenu() to request processing shortcuts) |
no test coverage detected