Note that shortcuts are currently provided for display only (future version will add explicit flags to BeginMenu() to request processing shortcuts)
| 4131 | // Note that shortcuts are currently provided for display only |
| 4132 | // (future version will add explicit flags to BeginMenu() to request processing shortcuts) |
| 4133 | static void ShowExampleMenuFile() |
| 4134 | { |
| 4135 | ImGui::MenuItem("(demo menu)", NULL, false, false); |
| 4136 | if (ImGui::MenuItem("New")) {} |
| 4137 | if (ImGui::MenuItem("Open", "Ctrl+O")) {} |
| 4138 | if (ImGui::BeginMenu("Open Recent")) |
| 4139 | { |
| 4140 | ImGui::MenuItem("fish_hat.c"); |
| 4141 | ImGui::MenuItem("fish_hat.inl"); |
| 4142 | ImGui::MenuItem("fish_hat.h"); |
| 4143 | if (ImGui::BeginMenu("More..")) |
| 4144 | { |
| 4145 | ImGui::MenuItem("Hello"); |
| 4146 | ImGui::MenuItem("Sailor"); |
| 4147 | if (ImGui::BeginMenu("Recurse..")) |
| 4148 | { |
| 4149 | ShowExampleMenuFile(); |
| 4150 | ImGui::EndMenu(); |
| 4151 | } |
| 4152 | ImGui::EndMenu(); |
| 4153 | } |
| 4154 | ImGui::EndMenu(); |
| 4155 | } |
| 4156 | if (ImGui::MenuItem("Save", "Ctrl+S")) {} |
| 4157 | if (ImGui::MenuItem("Save As..")) {} |
| 4158 | |
| 4159 | ImGui::Separator(); |
| 4160 | if (ImGui::BeginMenu("Options")) |
| 4161 | { |
| 4162 | static bool enabled = true; |
| 4163 | ImGui::MenuItem("Enabled", "", &enabled); |
| 4164 | ImGui::BeginChild("child", ImVec2(0, 60), true); |
| 4165 | for (int i = 0; i < 10; i++) |
| 4166 | ImGui::Text("Scrolling Text %d", i); |
| 4167 | ImGui::EndChild(); |
| 4168 | static float f = 0.5f; |
| 4169 | static int n = 0; |
| 4170 | ImGui::SliderFloat("Value", &f, 0.0f, 1.0f); |
| 4171 | ImGui::InputFloat("Input", &f, 0.1f); |
| 4172 | ImGui::Combo("Combo", &n, "Yes\0No\0Maybe\0\0"); |
| 4173 | ImGui::EndMenu(); |
| 4174 | } |
| 4175 | |
| 4176 | if (ImGui::BeginMenu("Colors")) |
| 4177 | { |
| 4178 | float sz = ImGui::GetTextLineHeight(); |
| 4179 | for (int i = 0; i < ImGuiCol_COUNT; i++) |
| 4180 | { |
| 4181 | const char* name = ImGui::GetStyleColorName((ImGuiCol)i); |
| 4182 | ImVec2 p = ImGui::GetCursorScreenPos(); |
| 4183 | ImGui::GetWindowDrawList()->AddRectFilled(p, ImVec2(p.x + sz, p.y + sz), ImGui::GetColorU32((ImGuiCol)i)); |
| 4184 | ImGui::Dummy(ImVec2(sz, sz)); |
| 4185 | ImGui::SameLine(); |
| 4186 | ImGui::MenuItem(name); |
| 4187 | } |
| 4188 | ImGui::EndMenu(); |
| 4189 | } |
| 4190 |
no test coverage detected