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