MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / DebugNodeTabBar

Method DebugNodeTabBar

TheForceEngine/TFE_Ui/imGUI/imgui.cpp:15559–15597  ·  view source on GitHub ↗

[DEBUG] Display contents of ImGuiTabBar

Source from the content-addressed store, hash-verified

15557
15558// [DEBUG] Display contents of ImGuiTabBar
15559void ImGui::DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label)
15560{
15561 // Standalone tab bars (not associated to docking/windows functionality) currently hold no discernible strings.
15562 char buf[256];
15563 char* p = buf;
15564 const char* buf_end = buf + IM_ARRAYSIZE(buf);
15565 const bool is_active = (tab_bar->PrevFrameVisible >= GetFrameCount() - 2);
15566 p += ImFormatString(p, buf_end - p, "%s 0x%08X (%d tabs)%s {", label, tab_bar->ID, tab_bar->Tabs.Size, is_active ? "" : " *Inactive*");
15567 for (int tab_n = 0; tab_n < ImMin(tab_bar->Tabs.Size, 3); tab_n++)
15568 {
15569 ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];
15570 p += ImFormatString(p, buf_end - p, "%s'%s'", tab_n > 0 ? ", " : "", TabBarGetTabName(tab_bar, tab));
15571 }
15572 p += ImFormatString(p, buf_end - p, (tab_bar->Tabs.Size > 3) ? " ... }" : " } ");
15573 if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); }
15574 bool open = TreeNode(label, "%s", buf);
15575 if (!is_active) { PopStyleColor(); }
15576 if (is_active && IsItemHovered())
15577 {
15578 ImDrawList* draw_list = GetForegroundDrawList();
15579 draw_list->AddRect(tab_bar->BarRect.Min, tab_bar->BarRect.Max, IM_COL32(255, 255, 0, 255));
15580 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));
15581 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));
15582 }
15583 if (open)
15584 {
15585 for (int tab_n = 0; tab_n < tab_bar->Tabs.Size; tab_n++)
15586 {
15587 ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];
15588 PushID(tab);
15589 if (SmallButton("<")) { TabBarQueueReorder(tab_bar, tab, -1); } SameLine(0, 2);
15590 if (SmallButton(">")) { TabBarQueueReorder(tab_bar, tab, +1); } SameLine();
15591 Text("%02d%c Tab 0x%08X '%s' Offset: %.2f, Width: %.2f/%.2f",
15592 tab_n, (tab->ID == tab_bar->SelectedTabId) ? '*' : ' ', tab->ID, TabBarGetTabName(tab_bar, tab), tab->Offset, tab->Width, tab->ContentWidth);
15593 PopID();
15594 }
15595 TreePop();
15596 }
15597}
15598
15599void ImGui::DebugNodeViewport(ImGuiViewportP* viewport)
15600{

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