Add a label+text combo aligned to other label+value widgets
| 350 | |
| 351 | // Add a label+text combo aligned to other label+value widgets |
| 352 | void ImGui::LabelTextV(const char* label, const char* fmt, va_list args) |
| 353 | { |
| 354 | ImGuiWindow* window = GetCurrentWindow(); |
| 355 | if (window->SkipItems) |
| 356 | return; |
| 357 | |
| 358 | ImGuiContext& g = *GImGui; |
| 359 | const ImGuiStyle& style = g.Style; |
| 360 | const float w = CalcItemWidth(); |
| 361 | |
| 362 | const char* value_text_begin, *value_text_end; |
| 363 | ImFormatStringToTempBufferV(&value_text_begin, &value_text_end, fmt, args); |
| 364 | const ImVec2 value_size = CalcTextSize(value_text_begin, value_text_end, false); |
| 365 | const ImVec2 label_size = CalcTextSize(label, NULL, true); |
| 366 | |
| 367 | const ImVec2 pos = window->DC.CursorPos; |
| 368 | const ImRect value_bb(pos, pos + ImVec2(w, value_size.y + style.FramePadding.y * 2)); |
| 369 | const ImRect total_bb(pos, pos + ImVec2(w + (label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f), ImMax(value_size.y, label_size.y) + style.FramePadding.y * 2)); |
| 370 | ItemSize(total_bb, style.FramePadding.y); |
| 371 | if (!ItemAdd(total_bb, 0)) |
| 372 | return; |
| 373 | |
| 374 | // Render |
| 375 | RenderTextClipped(value_bb.Min + style.FramePadding, value_bb.Max, value_text_begin, value_text_end, &value_size, ImVec2(0.0f, 0.0f)); |
| 376 | if (label_size.x > 0.0f) |
| 377 | RenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y + style.FramePadding.y), label); |
| 378 | } |
| 379 | |
| 380 | void ImGui::BulletText(const char* fmt, ...) |
| 381 | { |
nothing calls this directly
no test coverage detected