[DEBUG] Display contents of ImGuiTabBar
| 19539 | |
| 19540 | // [DEBUG] Display contents of ImGuiTabBar |
| 19541 | void ImGui::DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label) |
| 19542 | { |
| 19543 | // Standalone tab bars (not associated to docking/windows functionality) currently hold no discernible strings. |
| 19544 | char buf[256]; |
| 19545 | char* p = buf; |
| 19546 | const char* buf_end = buf + IM_ARRAYSIZE(buf); |
| 19547 | const bool is_active = (tab_bar->PrevFrameVisible >= GetFrameCount() - 2); |
| 19548 | p += ImFormatString(p, buf_end - p, "%s 0x%08X (%d tabs)%s", label, tab_bar->ID, tab_bar->Tabs.Size, is_active ? "" : " *Inactive*"); |
| 19549 | p += ImFormatString(p, buf_end - p, " { "); |
| 19550 | for (int tab_n = 0; tab_n < ImMin(tab_bar->Tabs.Size, 3); tab_n++) |
| 19551 | { |
| 19552 | ImGuiTabItem* tab = &tab_bar->Tabs[tab_n]; |
| 19553 | p += ImFormatString(p, buf_end - p, "%s'%s'", |
| 19554 | tab_n > 0 ? ", " : "", (tab->Window || tab->NameOffset != -1) ? tab_bar->GetTabName(tab) : "???"); |
| 19555 | } |
| 19556 | p += ImFormatString(p, buf_end - p, (tab_bar->Tabs.Size > 3) ? " ... }" : " } "); |
| 19557 | if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); } |
| 19558 | bool open = TreeNode(label, "%s", buf); |
| 19559 | if (!is_active) { PopStyleColor(); } |
| 19560 | if (is_active && IsItemHovered()) |
| 19561 | { |
| 19562 | ImDrawList* draw_list = GetForegroundDrawList(); |
| 19563 | draw_list->AddRect(tab_bar->BarRect.Min, tab_bar->BarRect.Max, IM_COL32(255, 255, 0, 255)); |
| 19564 | 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)); |
| 19565 | 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)); |
| 19566 | } |
| 19567 | if (open) |
| 19568 | { |
| 19569 | for (int tab_n = 0; tab_n < tab_bar->Tabs.Size; tab_n++) |
| 19570 | { |
| 19571 | const ImGuiTabItem* tab = &tab_bar->Tabs[tab_n]; |
| 19572 | PushID(tab); |
| 19573 | if (SmallButton("<")) { TabBarQueueReorder(tab_bar, tab, -1); } SameLine(0, 2); |
| 19574 | if (SmallButton(">")) { TabBarQueueReorder(tab_bar, tab, +1); } SameLine(); |
| 19575 | Text("%02d%c Tab 0x%08X '%s' Offset: %.2f, Width: %.2f/%.2f", |
| 19576 | tab_n, (tab->ID == tab_bar->SelectedTabId) ? '*' : ' ', tab->ID, (tab->Window || tab->NameOffset != -1) ? tab_bar->GetTabName(tab) : "???", tab->Offset, tab->Width, tab->ContentWidth); |
| 19577 | PopID(); |
| 19578 | } |
| 19579 | TreePop(); |
| 19580 | } |
| 19581 | } |
| 19582 | |
| 19583 | void ImGui::DebugNodeViewport(ImGuiViewportP* viewport) |
| 19584 | { |
nothing calls this directly
no test coverage detected