Note that shortcuts are currently provided for display only (future version will add flags to BeginMenu to process shortcuts)
| 3588 | |
| 3589 | // Note that shortcuts are currently provided for display only (future version will add flags to BeginMenu to process shortcuts) |
| 3590 | static void ShowExampleMenuFile() |
| 3591 | { |
| 3592 | ImGui::MenuItem("(dummy menu)", NULL, false, false); |
| 3593 | if (ImGui::MenuItem("New")) {} |
| 3594 | if (ImGui::MenuItem("Open", "Ctrl+O")) {} |
| 3595 | if (ImGui::BeginMenu("Open Recent")) |
| 3596 | { |
| 3597 | ImGui::MenuItem("fish_hat.c"); |
| 3598 | ImGui::MenuItem("fish_hat.inl"); |
| 3599 | ImGui::MenuItem("fish_hat.h"); |
| 3600 | if (ImGui::BeginMenu("More..")) |
| 3601 | { |
| 3602 | ImGui::MenuItem("Hello"); |
| 3603 | ImGui::MenuItem("Sailor"); |
| 3604 | if (ImGui::BeginMenu("Recurse..")) |
| 3605 | { |
| 3606 | ShowExampleMenuFile(); |
| 3607 | ImGui::EndMenu(); |
| 3608 | } |
| 3609 | ImGui::EndMenu(); |
| 3610 | } |
| 3611 | ImGui::EndMenu(); |
| 3612 | } |
| 3613 | if (ImGui::MenuItem("Save", "Ctrl+S")) {} |
| 3614 | if (ImGui::MenuItem("Save As..")) {} |
| 3615 | ImGui::Separator(); |
| 3616 | if (ImGui::BeginMenu("Options")) |
| 3617 | { |
| 3618 | static bool enabled = true; |
| 3619 | ImGui::MenuItem("Enabled", "", &enabled); |
| 3620 | ImGui::BeginChild("child", ImVec2(0, 60), true); |
| 3621 | for (int i = 0; i < 10; i++) |
| 3622 | ImGui::Text("Scrolling Text %d", i); |
| 3623 | ImGui::EndChild(); |
| 3624 | static float f = 0.5f; |
| 3625 | static int n = 0; |
| 3626 | static bool b = true; |
| 3627 | ImGui::SliderFloat("Value", &f, 0.0f, 1.0f); |
| 3628 | ImGui::InputFloat("Input", &f, 0.1f); |
| 3629 | ImGui::Combo("Combo", &n, "Yes\0No\0Maybe\0\0"); |
| 3630 | ImGui::Checkbox("Check", &b); |
| 3631 | ImGui::EndMenu(); |
| 3632 | } |
| 3633 | if (ImGui::BeginMenu("Colors")) |
| 3634 | { |
| 3635 | float sz = ImGui::GetTextLineHeight(); |
| 3636 | for (int i = 0; i < ImGuiCol_COUNT; i++) |
| 3637 | { |
| 3638 | const char* name = ImGui::GetStyleColorName((ImGuiCol)i); |
| 3639 | ImVec2 p = ImGui::GetCursorScreenPos(); |
| 3640 | ImGui::GetWindowDrawList()->AddRectFilled(p, ImVec2(p.x+sz, p.y+sz), ImGui::GetColorU32((ImGuiCol)i)); |
| 3641 | ImGui::Dummy(ImVec2(sz, sz)); |
| 3642 | ImGui::SameLine(); |
| 3643 | ImGui::MenuItem(name); |
| 3644 | } |
| 3645 | ImGui::EndMenu(); |
| 3646 | } |
| 3647 | if (ImGui::BeginMenu("Disabled", false)) // Disabled |
no test coverage detected