MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / BulletTextV

Method BulletTextV

plugins/Cardinal/src/DearImGui/imgui_widgets.cpp:387–411  ·  view source on GitHub ↗

Text with a little bullet aligned to the typical tree node.

Source from the content-addressed store, hash-verified

385
386// Text with a little bullet aligned to the typical tree node.
387void ImGui::BulletTextV(const char* fmt, va_list args)
388{
389 ImGuiWindow* window = GetCurrentWindow();
390 if (window->SkipItems)
391 return;
392
393 ImGuiContext& g = *GImGui;
394 const ImGuiStyle& style = g.Style;
395
396 const char* text_begin = g.TempBuffer;
397 const char* text_end = text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);
398 const ImVec2 label_size = CalcTextSize(text_begin, text_end, false);
399 const ImVec2 total_size = ImVec2(g.FontSize + (label_size.x > 0.0f ? (label_size.x + style.FramePadding.x * 2) : 0.0f), label_size.y); // Empty text doesn't add padding
400 ImVec2 pos = window->DC.CursorPos;
401 pos.y += window->DC.CurrLineTextBaseOffset;
402 ItemSize(total_size, 0.0f);
403 const ImRect bb(pos, pos + total_size);
404 if (!ItemAdd(bb, 0))
405 return;
406
407 // Render
408 ImU32 text_col = GetColorU32(ImGuiCol_Text);
409 RenderBullet(window->DrawList, bb.Min + ImVec2(style.FramePadding.x + g.FontSize * 0.5f, g.FontSize * 0.5f), text_col);
410 RenderText(bb.Min + ImVec2(g.FontSize + style.FramePadding.x * 2, 0.0f), text_begin, text_end, false);
411}
412
413//-------------------------------------------------------------------------
414// [SECTION] Widgets: Main

Callers

nothing calls this directly

Calls 4

GetCurrentWindowFunction · 0.85
ImFormatStringVFunction · 0.85
ImVec2Function · 0.85
RenderBulletFunction · 0.85

Tested by

no test coverage detected