MCPcopy Create free account
hub / github.com/SatDump/SatDump / LabelTextV

Method LabelTextV

src-core/imgui/imgui_widgets.cpp:339–365  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

337
338// Add a label+text combo aligned to other label+value widgets
339void ImGui::LabelTextV(const char* label, const char* fmt, va_list args)
340{
341 ImGuiWindow* window = GetCurrentWindow();
342 if (window->SkipItems)
343 return;
344
345 ImGuiContext& g = *GImGui;
346 const ImGuiStyle& style = g.Style;
347 const float w = CalcItemWidth();
348
349 const char* value_text_begin, *value_text_end;
350 ImFormatStringToTempBufferV(&value_text_begin, &value_text_end, fmt, args);
351 const ImVec2 value_size = CalcTextSize(value_text_begin, value_text_end, false);
352 const ImVec2 label_size = CalcTextSize(label, NULL, true);
353
354 const ImVec2 pos = window->DC.CursorPos;
355 const ImRect value_bb(pos, pos + ImVec2(w, value_size.y + style.FramePadding.y * 2));
356 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));
357 ItemSize(total_bb, style.FramePadding.y);
358 if (!ItemAdd(total_bb, 0))
359 return;
360
361 // Render
362 RenderTextClipped(value_bb.Min + style.FramePadding, value_bb.Max, value_text_begin, value_text_end, &value_size, ImVec2(0.0f, 0.0f));
363 if (label_size.x > 0.0f)
364 RenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y + style.FramePadding.y), label);
365}
366
367void ImGui::BulletText(const char* fmt, ...)
368{

Callers

nothing calls this directly

Calls 5

GetCurrentWindowFunction · 0.85
ImVec2Function · 0.85
ImMaxFunction · 0.85
ItemSizeFunction · 0.85

Tested by

no test coverage detected