MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / LabelTextV

Method LabelTextV

plugins/Cardinal/src/DearImGui/imgui_widgets.cpp:350–376  ·  view source on GitHub ↗

Add a label+text combo aligned to other label+value widgets

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

GetCurrentWindowFunction · 0.85
ImFormatStringVFunction · 0.85
ImVec2Function · 0.85
ImMaxFunction · 0.85

Tested by

no test coverage detected