Note that shortcuts are currently provided for display only (future version will add flags to BeginMenu to process shortcuts)
| 3556 | |
| 3557 | // Note that shortcuts are currently provided for display only (future version will add flags to BeginMenu to process shortcuts) |
| 3558 | static void ShowExampleMenuFile() |
| 3559 | { |
| 3560 | ImGui::MenuItem("(dummy menu)", NULL, false, false); |
| 3561 | if (ImGui::MenuItem("New")) {} |
| 3562 | if (ImGui::MenuItem("Open", "Ctrl+O")) {} |
| 3563 | if (ImGui::BeginMenu("Open Recent")) |
| 3564 | { |
| 3565 | ImGui::MenuItem("fish_hat.c"); |
| 3566 | ImGui::MenuItem("fish_hat.inl"); |
| 3567 | ImGui::MenuItem("fish_hat.h"); |
| 3568 | if (ImGui::BeginMenu("More..")) |
| 3569 | { |
| 3570 | ImGui::MenuItem("Hello"); |
| 3571 | ImGui::MenuItem("Sailor"); |
| 3572 | if (ImGui::BeginMenu("Recurse..")) |
| 3573 | { |
| 3574 | ShowExampleMenuFile(); |
| 3575 | ImGui::EndMenu(); |
| 3576 | } |
| 3577 | ImGui::EndMenu(); |
| 3578 | } |
| 3579 | ImGui::EndMenu(); |
| 3580 | } |
| 3581 | if (ImGui::MenuItem("Save", "Ctrl+S")) {} |
| 3582 | if (ImGui::MenuItem("Save As..")) {} |
| 3583 | ImGui::Separator(); |
| 3584 | if (ImGui::BeginMenu("Options")) |
| 3585 | { |
| 3586 | static bool enabled = true; |
| 3587 | ImGui::MenuItem("Enabled", "", &enabled); |
| 3588 | ImGui::BeginChild("child", ImVec2(0, 60), true); |
| 3589 | for (int i = 0; i < 10; i++) |
| 3590 | ImGui::Text("Scrolling Text %d", i); |
| 3591 | ImGui::EndChild(); |
| 3592 | static float f = 0.5f; |
| 3593 | static int n = 0; |
| 3594 | static bool b = true; |
| 3595 | ImGui::SliderFloat("Value", &f, 0.0f, 1.0f); |
| 3596 | ImGui::InputFloat("Input", &f, 0.1f); |
| 3597 | ImGui::Combo("Combo", &n, "Yes\0No\0Maybe\0\0"); |
| 3598 | ImGui::Checkbox("Check", &b); |
| 3599 | ImGui::EndMenu(); |
| 3600 | } |
| 3601 | if (ImGui::BeginMenu("Colors")) |
| 3602 | { |
| 3603 | float sz = ImGui::GetTextLineHeight(); |
| 3604 | for (int i = 0; i < ImGuiCol_COUNT; i++) |
| 3605 | { |
| 3606 | const char* name = ImGui::GetStyleColorName((ImGuiCol)i); |
| 3607 | ImVec2 p = ImGui::GetCursorScreenPos(); |
| 3608 | ImGui::GetWindowDrawList()->AddRectFilled(p, ImVec2(p.x+sz, p.y+sz), ImGui::GetColorU32((ImGuiCol)i)); |
| 3609 | ImGui::Dummy(ImVec2(sz, sz)); |
| 3610 | ImGui::SameLine(); |
| 3611 | ImGui::MenuItem(name); |
| 3612 | } |
| 3613 | ImGui::EndMenu(); |
| 3614 | } |
| 3615 | if (ImGui::BeginMenu("Disabled", false)) // Disabled |
no test coverage detected