MCPcopy Create free account
hub / github.com/RenderKit/embree / LabelTextV

Method LabelTextV

tutorials/common/imgui/imgui_widgets.cpp:352–378  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

350
351// Add a label+text combo aligned to other label+value widgets
352void 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
380void ImGui::BulletText(const char* fmt, ...)
381{

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