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

Method DebugNodeTabBar

KBotExt/imgui/imgui.cpp:14403–14441  ·  view source on GitHub ↗

[DEBUG] Display contents of ImGuiTabBar

Source from the content-addressed store, hash-verified

14401
14402// [DEBUG] Display contents of ImGuiTabBar
14403void ImGui::DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label)
14404{
14405 // Standalone tab bars (not associated to docking/windows functionality) currently hold no discernible strings.
14406 char buf[256];
14407 char* p = buf;
14408 const char* buf_end = buf + IM_ARRAYSIZE(buf);
14409 const bool is_active = (tab_bar->PrevFrameVisible >= GetFrameCount() - 2);
14410 p += ImFormatString(p, buf_end - p, "%s 0x%08X (%d tabs)%s {", label, tab_bar->ID, tab_bar->Tabs.Size, is_active ? "" : " *Inactive*");
14411 for (int tab_n = 0; tab_n < ImMin(tab_bar->Tabs.Size, 3); tab_n++)
14412 {
14413 ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];
14414 p += ImFormatString(p, buf_end - p, "%s'%s'", tab_n > 0 ? ", " : "", TabBarGetTabName(tab_bar, tab));
14415 }
14416 p += ImFormatString(p, buf_end - p, (tab_bar->Tabs.Size > 3) ? " ... }" : " } ");
14417 if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); }
14418 bool open = TreeNode(label, "%s", buf);
14419 if (!is_active) { PopStyleColor(); }
14420 if (is_active && IsItemHovered())
14421 {
14422 ImDrawList* draw_list = GetForegroundDrawList();
14423 draw_list->AddRect(tab_bar->BarRect.Min, tab_bar->BarRect.Max, IM_COL32(255, 255, 0, 255));
14424 draw_list->AddLine(ImVec2(tab_bar->ScrollingRectMinX, tab_bar->BarRect.Min.y), ImVec2(tab_bar->ScrollingRectMinX, tab_bar->BarRect.Max.y), IM_COL32(0, 255, 0, 255));
14425 draw_list->AddLine(ImVec2(tab_bar->ScrollingRectMaxX, tab_bar->BarRect.Min.y), ImVec2(tab_bar->ScrollingRectMaxX, tab_bar->BarRect.Max.y), IM_COL32(0, 255, 0, 255));
14426 }
14427 if (open)
14428 {
14429 for (int tab_n = 0; tab_n < tab_bar->Tabs.Size; tab_n++)
14430 {
14431 ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];
14432 PushID(tab);
14433 if (SmallButton("<")) { TabBarQueueReorder(tab_bar, tab, -1); } SameLine(0, 2);
14434 if (SmallButton(">")) { TabBarQueueReorder(tab_bar, tab, +1); } SameLine();
14435 Text("%02d%c Tab 0x%08X '%s' Offset: %.2f, Width: %.2f/%.2f",
14436 tab_n, (tab->ID == tab_bar->SelectedTabId) ? '*' : ' ', tab->ID, TabBarGetTabName(tab_bar, tab), tab->Offset, tab->Width, tab->ContentWidth);
14437 PopID();
14438 }
14439 TreePop();
14440 }
14441}
14442
14443void ImGui::DebugNodeViewport(ImGuiViewportP* viewport)
14444{

Callers

nothing calls this directly

Calls 6

ImFormatStringFunction · 0.85
ImMinFunction · 0.85
GetForegroundDrawListFunction · 0.85
ImVec2Function · 0.85
AddRectMethod · 0.80
AddLineMethod · 0.80

Tested by

no test coverage detected