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.
| 6398 | // - BeginMenuBar() = menu-bar inside current window (which needs the ImGuiWindowFlags_MenuBar flag!) |
| 6399 | // - BeginMainMenuBar() = helper to create menu-bar-sized window at the top of the main viewport + call BeginMenuBar() into it. |
| 6400 | static void ShowExampleAppMainMenuBar() |
| 6401 | { |
| 6402 | if (ImGui::BeginMainMenuBar()) |
| 6403 | { |
| 6404 | if (ImGui::BeginMenu("File")) |
| 6405 | { |
| 6406 | ShowExampleMenuFile(); |
| 6407 | ImGui::EndMenu(); |
| 6408 | } |
| 6409 | if (ImGui::BeginMenu("Edit")) |
| 6410 | { |
| 6411 | if (ImGui::MenuItem("Undo", "CTRL+Z")) {} |
| 6412 | if (ImGui::MenuItem("Redo", "CTRL+Y", false, false)) {} // Disabled item |
| 6413 | ImGui::Separator(); |
| 6414 | if (ImGui::MenuItem("Cut", "CTRL+X")) {} |
| 6415 | if (ImGui::MenuItem("Copy", "CTRL+C")) {} |
| 6416 | if (ImGui::MenuItem("Paste", "CTRL+V")) {} |
| 6417 | ImGui::EndMenu(); |
| 6418 | } |
| 6419 | ImGui::EndMainMenuBar(); |
| 6420 | } |
| 6421 | } |
| 6422 | |
| 6423 | // Note that shortcuts are currently provided for display only |
| 6424 | // (future version will add explicit flags to BeginMenu() to request processing shortcuts) |
no test coverage detected