Note that shortcuts are currently provided for display only (future version will add explicit flags to BeginMenu() to request processing shortcuts)
| 6191 | // Note that shortcuts are currently provided for display only |
| 6192 | // (future version will add explicit flags to BeginMenu() to request processing shortcuts) |
| 6193 | static void ShowExampleMenuFile() |
| 6194 | { |
| 6195 | ImGui::MenuItem("(demo menu)", NULL, false, false); |
| 6196 | if (ImGui::MenuItem("New")) {} |
| 6197 | if (ImGui::MenuItem("Open", "Ctrl+O")) {} |
| 6198 | if (ImGui::BeginMenu("Open Recent")) |
| 6199 | { |
| 6200 | ImGui::MenuItem("fish_hat.c"); |
| 6201 | ImGui::MenuItem("fish_hat.inl"); |
| 6202 | ImGui::MenuItem("fish_hat.h"); |
| 6203 | if (ImGui::BeginMenu("More..")) |
| 6204 | { |
| 6205 | ImGui::MenuItem("Hello"); |
| 6206 | ImGui::MenuItem("Sailor"); |
| 6207 | if (ImGui::BeginMenu("Recurse..")) |
| 6208 | { |
| 6209 | ShowExampleMenuFile(); |
| 6210 | ImGui::EndMenu(); |
| 6211 | } |
| 6212 | ImGui::EndMenu(); |
| 6213 | } |
| 6214 | ImGui::EndMenu(); |
| 6215 | } |
| 6216 | if (ImGui::MenuItem("Save", "Ctrl+S")) {} |
| 6217 | if (ImGui::MenuItem("Save As..")) {} |
| 6218 | |
| 6219 | ImGui::Separator(); |
| 6220 | if (ImGui::BeginMenu("Options")) |
| 6221 | { |
| 6222 | static bool enabled = true; |
| 6223 | ImGui::MenuItem("Enabled", "", &enabled); |
| 6224 | ImGui::BeginChild("child", ImVec2(0, 60), true); |
| 6225 | for (int i = 0; i < 10; i++) |
| 6226 | ImGui::Text("Scrolling Text %d", i); |
| 6227 | ImGui::EndChild(); |
| 6228 | static float f = 0.5f; |
| 6229 | static int n = 0; |
| 6230 | ImGui::SliderFloat("Value", &f, 0.0f, 1.0f); |
| 6231 | ImGui::InputFloat("Input", &f, 0.1f); |
| 6232 | ImGui::Combo("Combo", &n, "Yes\0No\0Maybe\0\0"); |
| 6233 | ImGui::EndMenu(); |
| 6234 | } |
| 6235 | |
| 6236 | if (ImGui::BeginMenu("Colors")) |
| 6237 | { |
| 6238 | float sz = ImGui::GetTextLineHeight(); |
| 6239 | for (int i = 0; i < ImGuiCol_COUNT; i++) |
| 6240 | { |
| 6241 | const char* name = ImGui::GetStyleColorName((ImGuiCol)i); |
| 6242 | ImVec2 p = ImGui::GetCursorScreenPos(); |
| 6243 | ImGui::GetWindowDrawList()->AddRectFilled(p, ImVec2(p.x + sz, p.y + sz), ImGui::GetColorU32((ImGuiCol)i)); |
| 6244 | ImGui::Dummy(ImVec2(sz, sz)); |
| 6245 | ImGui::SameLine(); |
| 6246 | ImGui::MenuItem(name); |
| 6247 | } |
| 6248 | ImGui::EndMenu(); |
| 6249 | } |
| 6250 |
no test coverage detected