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