| 245 | |
| 246 | template <typename DrawComponent> |
| 247 | bool drawMultiComponentWidget(const char* label, const int components, DrawComponent&& draw_component) { |
| 248 | bool changed = false; |
| 249 | ImGui::BeginGroup(); |
| 250 | ImGui::PushID(label); |
| 251 | ImGui::PushMultiItemsWidths(components, ImGui::CalcItemWidth()); |
| 252 | for (int i = 0; i < components; ++i) { |
| 253 | ImGui::PushID(i); |
| 254 | changed |= draw_component(i, MULTI_COMPONENT_LABELS[i]); |
| 255 | ImGui::PopID(); |
| 256 | ImGui::PopItemWidth(); |
| 257 | if (i + 1 < components) |
| 258 | ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); |
| 259 | } |
| 260 | ImGui::PopID(); |
| 261 | |
| 262 | const char* const label_end = ImGui::FindRenderedTextEnd(label); |
| 263 | if (label != label_end) { |
| 264 | ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); |
| 265 | ImGui::TextEx(label, label_end); |
| 266 | } |
| 267 | ImGui::EndGroup(); |
| 268 | return changed; |
| 269 | } |
| 270 | } // namespace |
| 271 | |
| 272 | bool InputText(const char* label, char* buf, const std::size_t buf_size, const ImGuiInputTextFlags flags, |
no outgoing calls
no test coverage detected