MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / LabelTextV

Method LabelTextV

lib/imgui/imgui_widgets.cpp:321–344  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

319
320// Add a label+text combo aligned to other label+value widgets
321void ImGui::LabelTextV(const char* label, const char* fmt, va_list args)
322{
323 ImGuiWindow* window = GetCurrentWindow();
324 if (window->SkipItems)
325 return;
326
327 ImGuiContext& g = *GImGui;
328 const ImGuiStyle& style = g.Style;
329 const float w = CalcItemWidth();
330
331 const ImVec2 label_size = CalcTextSize(label, NULL, true);
332 const ImRect value_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2));
333 const ImRect total_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w + (label_size.x > 0.0f ? style.ItemInnerSpacing.x : 0.0f), style.FramePadding.y*2) + label_size);
334 ItemSize(total_bb, style.FramePadding.y);
335 if (!ItemAdd(total_bb, 0))
336 return;
337
338 // Render
339 const char* value_text_begin = &g.TempBuffer[0];
340 const char* value_text_end = value_text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);
341 RenderTextClipped(value_bb.Min, value_bb.Max, value_text_begin, value_text_end, NULL, ImVec2(0.0f,0.5f));
342 if (label_size.x > 0.0f)
343 RenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y + style.FramePadding.y), label);
344}
345
346void ImGui::BulletText(const char* fmt, ...)
347{

Callers

nothing calls this directly

Calls 4

GetCurrentWindowFunction · 0.85
ImVec2Class · 0.85
ItemSizeClass · 0.85
ImFormatStringVFunction · 0.85

Tested by

no test coverage detected