MCPcopy Create free account
hub / github.com/VictorGordan/opengl-tutorials / DebugNodeTabBar

Method DebugNodeTabBar

ImGUI GLFW Tutorial/imgui/imgui.cpp:11419–11452  ·  view source on GitHub ↗

[DEBUG] Display contents of ImGuiTabBar

Source from the content-addressed store, hash-verified

11417
11418// [DEBUG] Display contents of ImGuiTabBar
11419void ImGui::DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label)
11420{
11421 // Standalone tab bars (not associated to docking/windows functionality) currently hold no discernible strings.
11422 char buf[256];
11423 char* p = buf;
11424 const char* buf_end = buf + IM_ARRAYSIZE(buf);
11425 const bool is_active = (tab_bar->PrevFrameVisible >= GetFrameCount() - 2);
11426 p += ImFormatString(p, buf_end - p, "%s 0x%08X (%d tabs)%s", label, tab_bar->ID, tab_bar->Tabs.Size, is_active ? "" : " *Inactive*");
11427 IM_UNUSED(p);
11428 if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); }
11429 bool open = TreeNode(tab_bar, "%s", buf);
11430 if (!is_active) { PopStyleColor(); }
11431 if (is_active && IsItemHovered())
11432 {
11433 ImDrawList* draw_list = GetForegroundDrawList();
11434 draw_list->AddRect(tab_bar->BarRect.Min, tab_bar->BarRect.Max, IM_COL32(255, 255, 0, 255));
11435 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));
11436 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));
11437 }
11438 if (open)
11439 {
11440 for (int tab_n = 0; tab_n < tab_bar->Tabs.Size; tab_n++)
11441 {
11442 const ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];
11443 PushID(tab);
11444 if (SmallButton("<")) { TabBarQueueReorder(tab_bar, tab, -1); } SameLine(0, 2);
11445 if (SmallButton(">")) { TabBarQueueReorder(tab_bar, tab, +1); } SameLine();
11446 Text("%02d%c Tab 0x%08X '%s' Offset: %.1f, Width: %.1f/%.1f",
11447 tab_n, (tab->ID == tab_bar->SelectedTabId) ? '*' : ' ', tab->ID, (tab->NameOffset != -1) ? tab_bar->GetTabName(tab) : "", tab->Offset, tab->Width, tab->ContentWidth);
11448 PopID();
11449 }
11450 TreePop();
11451 }
11452}
11453
11454void ImGui::DebugNodeViewport(ImGuiViewportP* viewport)
11455{

Callers

nothing calls this directly

Calls 6

GetTabNameMethod · 0.80
ImFormatStringFunction · 0.70
GetForegroundDrawListFunction · 0.70
ImVec2Function · 0.70
AddRectMethod · 0.45
AddLineMethod · 0.45

Tested by

no test coverage detected