MCPcopy Create free account
hub / github.com/cinder/Cinder / LabelTextV

Method LabelTextV

src/imgui/imgui_widgets.cpp:390–416  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

388
389// Add a label+text combo aligned to other label+value widgets
390void ImGui::LabelTextV(const char* label, const char* fmt, va_list args)
391{
392 ImGuiWindow* window = GetCurrentWindow();
393 if (window->SkipItems)
394 return;
395
396 ImGuiContext& g = *GImGui;
397 const ImGuiStyle& style = g.Style;
398 const float w = CalcItemWidth();
399
400 const char* value_text_begin, *value_text_end;
401 ImFormatStringToTempBufferV(&value_text_begin, &value_text_end, fmt, args);
402 const ImVec2 value_size = CalcTextSize(value_text_begin, value_text_end, false);
403 const ImVec2 label_size = CalcTextSize(label, NULL, true);
404
405 const ImVec2 pos = window->DC.CursorPos;
406 const ImRect value_bb(pos, pos + ImVec2(w, value_size.y + style.FramePadding.y * 2));
407 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));
408 ItemSize(total_bb, style.FramePadding.y);
409 if (!ItemAdd(total_bb, 0))
410 return;
411
412 // Render
413 RenderTextClipped(value_bb.Min + style.FramePadding, value_bb.Max, value_text_begin, value_text_end, &value_size, ImVec2(0.0f, 0.0f));
414 if (label_size.x > 0.0f)
415 RenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y + style.FramePadding.y), label);
416}
417
418void ImGui::BulletText(const char* fmt, ...)
419{

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