MCPcopy Create free account
hub / github.com/ShenCiao/CialloResearch / LabelTextV

Method LabelTextV

imgui/imgui_widgets.cpp:351–377  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

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