MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / BulletTextV

Method BulletTextV

KBotExt/imgui/imgui_widgets.cpp:374–398  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

372
373// Text with a little bullet aligned to the typical tree node.
374void ImGui::BulletTextV(const char* fmt, va_list args)
375{
376 ImGuiWindow* window = GetCurrentWindow();
377 if (window->SkipItems)
378 return;
379
380 ImGuiContext& g = *GImGui;
381 const ImGuiStyle& style = g.Style;
382
383 const char* text_begin, * text_end;
384 ImFormatStringToTempBufferV(&text_begin, &text_end, fmt, args);
385 const ImVec2 label_size = CalcTextSize(text_begin, text_end, false);
386 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
387 ImVec2 pos = window->DC.CursorPos;
388 pos.y += window->DC.CurrLineTextBaseOffset;
389 ItemSize(total_size, 0.0f);
390 const ImRect bb(pos, pos + total_size);
391 if (!ItemAdd(bb, 0))
392 return;
393
394 // Render
395 ImU32 text_col = GetColorU32(ImGuiCol_Text);
396 RenderBullet(window->DrawList, bb.Min + ImVec2(style.FramePadding.x + g.FontSize * 0.5f, g.FontSize * 0.5f), text_col);
397 RenderText(bb.Min + ImVec2(g.FontSize + style.FramePadding.x * 2, 0.0f), text_begin, text_end, false);
398}
399
400//-------------------------------------------------------------------------
401// [SECTION] Widgets: Main

Callers

nothing calls this directly

Calls 4

GetCurrentWindowFunction · 0.85
ImVec2Function · 0.85
ItemSizeFunction · 0.85

Tested by

no test coverage detected