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.
| 6114 | // - BeginMenuBar() = menu-bar inside current window (which needs the ImGuiWindowFlags_MenuBar flag!) |
| 6115 | // - BeginMainMenuBar() = helper to create menu-bar-sized window at the top of the main viewport + call BeginMenuBar() into it. |
| 6116 | static void ShowExampleAppMainMenuBar() |
| 6117 | { |
| 6118 | if (ImGui::BeginMainMenuBar()) |
| 6119 | { |
| 6120 | if (ImGui::BeginMenu("File")) |
| 6121 | { |
| 6122 | ShowExampleMenuFile(); |
| 6123 | ImGui::EndMenu(); |
| 6124 | } |
| 6125 | if (ImGui::BeginMenu("Edit")) |
| 6126 | { |
| 6127 | if (ImGui::MenuItem("Undo", "CTRL+Z")) {} |
| 6128 | if (ImGui::MenuItem("Redo", "CTRL+Y", false, false)) {} // Disabled item |
| 6129 | ImGui::Separator(); |
| 6130 | if (ImGui::MenuItem("Cut", "CTRL+X")) {} |
| 6131 | if (ImGui::MenuItem("Copy", "CTRL+C")) {} |
| 6132 | if (ImGui::MenuItem("Paste", "CTRL+V")) {} |
| 6133 | ImGui::EndMenu(); |
| 6134 | } |
| 6135 | ImGui::EndMainMenuBar(); |
| 6136 | } |
| 6137 | } |
| 6138 | |
| 6139 | // Note that shortcuts are currently provided for display only |
| 6140 | // (future version will add explicit flags to BeginMenu() to request processing shortcuts) |
no test coverage detected