Note that shortcuts are currently provided for display only (future version will add explicit flags to BeginMenu() to request processing shortcuts)
| 6823 | // Note that shortcuts are currently provided for display only |
| 6824 | // (future version will add explicit flags to BeginMenu() to request processing shortcuts) |
| 6825 | static void ShowExampleMenuFile() |
| 6826 | { |
| 6827 | IMGUI_DEMO_MARKER("Examples/Menu"); |
| 6828 | ImGui::MenuItem("(demo menu)", NULL, false, false); |
| 6829 | if (ImGui::MenuItem("New")) {} |
| 6830 | if (ImGui::MenuItem("Open", "Ctrl+O")) {} |
| 6831 | if (ImGui::BeginMenu("Open Recent")) |
| 6832 | { |
| 6833 | ImGui::MenuItem("fish_hat.c"); |
| 6834 | ImGui::MenuItem("fish_hat.inl"); |
| 6835 | ImGui::MenuItem("fish_hat.h"); |
| 6836 | if (ImGui::BeginMenu("More..")) |
| 6837 | { |
| 6838 | ImGui::MenuItem("Hello"); |
| 6839 | ImGui::MenuItem("Sailor"); |
| 6840 | if (ImGui::BeginMenu("Recurse..")) |
| 6841 | { |
| 6842 | ShowExampleMenuFile(); |
| 6843 | ImGui::EndMenu(); |
| 6844 | } |
| 6845 | ImGui::EndMenu(); |
| 6846 | } |
| 6847 | ImGui::EndMenu(); |
| 6848 | } |
| 6849 | if (ImGui::MenuItem("Save", "Ctrl+S")) {} |
| 6850 | if (ImGui::MenuItem("Save As..")) {} |
| 6851 | |
| 6852 | ImGui::Separator(); |
| 6853 | IMGUI_DEMO_MARKER("Examples/Menu/Options"); |
| 6854 | if (ImGui::BeginMenu("Options")) |
| 6855 | { |
| 6856 | static bool enabled = true; |
| 6857 | ImGui::MenuItem("Enabled", "", &enabled); |
| 6858 | ImGui::BeginChild("child", ImVec2(0, 60), ImGuiChildFlags_Border); |
| 6859 | for (int i = 0; i < 10; i++) |
| 6860 | ImGui::Text("Scrolling Text %d", i); |
| 6861 | ImGui::EndChild(); |
| 6862 | static float f = 0.5f; |
| 6863 | static int n = 0; |
| 6864 | ImGui::SliderFloat("Value", &f, 0.0f, 1.0f); |
| 6865 | ImGui::InputFloat("Input", &f, 0.1f); |
| 6866 | ImGui::Combo("Combo", &n, "Yes\0No\0Maybe\0\0"); |
| 6867 | ImGui::EndMenu(); |
| 6868 | } |
| 6869 | |
| 6870 | IMGUI_DEMO_MARKER("Examples/Menu/Colors"); |
| 6871 | if (ImGui::BeginMenu("Colors")) |
| 6872 | { |
| 6873 | float sz = ImGui::GetTextLineHeight(); |
| 6874 | for (int i = 0; i < ImGuiCol_COUNT; i++) |
| 6875 | { |
| 6876 | const char* name = ImGui::GetStyleColorName((ImGuiCol)i); |
| 6877 | ImVec2 p = ImGui::GetCursorScreenPos(); |
| 6878 | ImGui::GetWindowDrawList()->AddRectFilled(p, ImVec2(p.x + sz, p.y + sz), ImGui::GetColorU32((ImGuiCol)i)); |
| 6879 | ImGui::Dummy(ImVec2(sz, sz)); |
| 6880 | ImGui::SameLine(); |
| 6881 | ImGui::MenuItem(name); |
| 6882 | } |
no test coverage detected