Note that shortcuts are currently provided for display only (future version will add explicit flags to BeginMenu() to request processing shortcuts)
| 8909 | // Note that shortcuts are currently provided for display only |
| 8910 | // (future version will add explicit flags to BeginMenu() to request processing shortcuts) |
| 8911 | static void ShowExampleMenuFile() |
| 8912 | { |
| 8913 | IMGUI_DEMO_MARKER("Examples/Menu"); |
| 8914 | ImGui::MenuItem("(demo menu)", NULL, false, false); |
| 8915 | if (ImGui::MenuItem("New")) {} |
| 8916 | if (ImGui::MenuItem("Open", "Ctrl+O")) {} |
| 8917 | if (ImGui::BeginMenu("Open Recent")) |
| 8918 | { |
| 8919 | ImGui::MenuItem("fish_hat.c"); |
| 8920 | ImGui::MenuItem("fish_hat.inl"); |
| 8921 | ImGui::MenuItem("fish_hat.h"); |
| 8922 | if (ImGui::BeginMenu("More..")) |
| 8923 | { |
| 8924 | ImGui::MenuItem("Hello"); |
| 8925 | ImGui::MenuItem("Sailor"); |
| 8926 | if (ImGui::BeginMenu("Recurse..")) |
| 8927 | { |
| 8928 | ShowExampleMenuFile(); |
| 8929 | ImGui::EndMenu(); |
| 8930 | } |
| 8931 | ImGui::EndMenu(); |
| 8932 | } |
| 8933 | ImGui::EndMenu(); |
| 8934 | } |
| 8935 | if (ImGui::MenuItem("Save", "Ctrl+S")) {} |
| 8936 | if (ImGui::MenuItem("Save As..")) {} |
| 8937 | |
| 8938 | ImGui::Separator(); |
| 8939 | if (ImGui::BeginMenu("Options")) |
| 8940 | { |
| 8941 | IMGUI_DEMO_MARKER("Examples/Menu/Options"); |
| 8942 | static bool enabled = true; |
| 8943 | ImGui::MenuItem("Enabled", "", &enabled); |
| 8944 | ImGui::BeginChild("child", ImVec2(0, 60), ImGuiChildFlags_Borders); |
| 8945 | for (int i = 0; i < 10; i++) |
| 8946 | ImGui::Text("Scrolling Text %d", i); |
| 8947 | ImGui::EndChild(); |
| 8948 | static float f = 0.5f; |
| 8949 | static int n = 0; |
| 8950 | ImGui::SliderFloat("Value", &f, 0.0f, 1.0f); |
| 8951 | ImGui::InputFloat("Input", &f, 0.1f); |
| 8952 | ImGui::Combo("Combo", &n, "Yes\0No\0Maybe\0\0"); |
| 8953 | ImGui::EndMenu(); |
| 8954 | } |
| 8955 | |
| 8956 | if (ImGui::BeginMenu("Colors")) |
| 8957 | { |
| 8958 | IMGUI_DEMO_MARKER("Examples/Menu/Colors"); |
| 8959 | float sz = ImGui::GetTextLineHeight(); |
| 8960 | for (int i = 0; i < ImGuiCol_COUNT; i++) |
| 8961 | { |
| 8962 | const char* name = ImGui::GetStyleColorName((ImGuiCol)i); |
| 8963 | ImVec2 p = ImGui::GetCursorScreenPos(); |
| 8964 | ImGui::GetWindowDrawList()->AddRectFilled(p, ImVec2(p.x + sz, p.y + sz), ImGui::GetColorU32((ImGuiCol)i)); |
| 8965 | ImGui::Dummy(ImVec2(sz, sz)); |
| 8966 | ImGui::SameLine(); |
| 8967 | ImGui::MenuItem(name); |
| 8968 | } |
no test coverage detected