MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / DebugNodeTable

Method DebugNodeTable

plugins/Cardinal/src/DearImGui/imgui_tables.cpp:3518–3578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3516}
3517
3518void ImGui::DebugNodeTable(ImGuiTable* table)
3519{
3520 char buf[512];
3521 char* p = buf;
3522 const char* buf_end = buf + IM_ARRAYSIZE(buf);
3523 const bool is_active = (table->LastFrameActive >= ImGui::GetFrameCount() - 2); // Note that fully clipped early out scrolling tables will appear as inactive here.
3524 ImFormatString(p, buf_end - p, "Table 0x%08X (%d columns, in '%s')%s", table->ID, table->ColumnsCount, table->OuterWindow->Name, is_active ? "" : " *Inactive*");
3525 if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); }
3526 bool open = TreeNode(table, "%s", buf);
3527 if (!is_active) { PopStyleColor(); }
3528 if (IsItemHovered())
3529 GetForegroundDrawList()->AddRect(table->OuterRect.Min, table->OuterRect.Max, IM_COL32(255, 255, 0, 255));
3530 if (IsItemVisible() && table->HoveredColumnBody != -1)
3531 GetForegroundDrawList()->AddRect(GetItemRectMin(), GetItemRectMax(), IM_COL32(255, 255, 0, 255));
3532 if (!open)
3533 return;
3534 bool clear_settings = SmallButton("Clear settings");
3535 BulletText("OuterRect: Pos: (%.1f,%.1f) Size: (%.1f,%.1f) Sizing: '%s'", table->OuterRect.Min.x, table->OuterRect.Min.y, table->OuterRect.GetWidth(), table->OuterRect.GetHeight(), DebugNodeTableGetSizingPolicyDesc(table->Flags));
3536 BulletText("ColumnsGivenWidth: %.1f, ColumnsAutoFitWidth: %.1f, InnerWidth: %.1f%s", table->ColumnsGivenWidth, table->ColumnsAutoFitWidth, table->InnerWidth, table->InnerWidth == 0.0f ? " (auto)" : "");
3537 BulletText("CellPaddingX: %.1f, CellSpacingX: %.1f/%.1f, OuterPaddingX: %.1f", table->CellPaddingX, table->CellSpacingX1, table->CellSpacingX2, table->OuterPaddingX);
3538 BulletText("HoveredColumnBody: %d, HoveredColumnBorder: %d", table->HoveredColumnBody, table->HoveredColumnBorder);
3539 BulletText("ResizedColumn: %d, ReorderColumn: %d, HeldHeaderColumn: %d", table->ResizedColumn, table->ReorderColumn, table->HeldHeaderColumn);
3540 //BulletText("BgDrawChannels: %d/%d", 0, table->BgDrawChannelUnfrozen);
3541 float sum_weights = 0.0f;
3542 for (int n = 0; n < table->ColumnsCount; n++)
3543 if (table->Columns[n].Flags & ImGuiTableColumnFlags_WidthStretch)
3544 sum_weights += table->Columns[n].StretchWeight;
3545 for (int n = 0; n < table->ColumnsCount; n++)
3546 {
3547 ImGuiTableColumn* column = &table->Columns[n];
3548 const char* name = TableGetColumnName(table, n);
3549 ImFormatString(buf, IM_ARRAYSIZE(buf),
3550 "Column %d order %d '%s': offset %+.2f to %+.2f%s\n"
3551 "Enabled: %d, VisibleX/Y: %d/%d, RequestOutput: %d, SkipItems: %d, DrawChannels: %d,%d\n"
3552 "WidthGiven: %.1f, Request/Auto: %.1f/%.1f, StretchWeight: %.3f (%.1f%%)\n"
3553 "MinX: %.1f, MaxX: %.1f (%+.1f), ClipRect: %.1f to %.1f (+%.1f)\n"
3554 "ContentWidth: %.1f,%.1f, HeadersUsed/Ideal %.1f/%.1f\n"
3555 "Sort: %d%s, UserID: 0x%08X, Flags: 0x%04X: %s%s%s..",
3556 n, column->DisplayOrder, name, column->MinX - table->WorkRect.Min.x, column->MaxX - table->WorkRect.Min.x, (n < table->FreezeColumnsRequest) ? " (Frozen)" : "",
3557 column->IsEnabled, column->IsVisibleX, column->IsVisibleY, column->IsRequestOutput, column->IsSkipItems, column->DrawChannelFrozen, column->DrawChannelUnfrozen,
3558 column->WidthGiven, column->WidthRequest, column->WidthAuto, column->StretchWeight, column->StretchWeight > 0.0f ? (column->StretchWeight / sum_weights) * 100.0f : 0.0f,
3559 column->MinX, column->MaxX, column->MaxX - column->MinX, column->ClipRect.Min.x, column->ClipRect.Max.x, column->ClipRect.Max.x - column->ClipRect.Min.x,
3560 column->ContentMaxXFrozen - column->WorkMinX, column->ContentMaxXUnfrozen - column->WorkMinX, column->ContentMaxXHeadersUsed - column->WorkMinX, column->ContentMaxXHeadersIdeal - column->WorkMinX,
3561 column->SortOrder, (column->SortDirection == ImGuiSortDirection_Ascending) ? " (Asc)" : (column->SortDirection == ImGuiSortDirection_Descending) ? " (Des)" : "", column->UserID, column->Flags,
3562 (column->Flags & ImGuiTableColumnFlags_WidthStretch) ? "WidthStretch " : "",
3563 (column->Flags & ImGuiTableColumnFlags_WidthFixed) ? "WidthFixed " : "",
3564 (column->Flags & ImGuiTableColumnFlags_NoResize) ? "NoResize " : "");
3565 Bullet();
3566 Selectable(buf);
3567 if (IsItemHovered())
3568 {
3569 ImRect r(column->MinX, table->OuterRect.Min.y, column->MaxX, table->OuterRect.Max.y);
3570 GetForegroundDrawList()->AddRect(r.Min, r.Max, IM_COL32(255, 255, 0, 255));
3571 }
3572 }
3573 if (ImGuiTableSettings* settings = TableGetBoundSettings(table))
3574 DebugNodeTableSettings(settings);
3575 if (clear_settings)

Callers

nothing calls this directly

Calls 4

ImFormatStringFunction · 0.85
GetForegroundDrawListFunction · 0.85
AddRectMethod · 0.80

Tested by

no test coverage detected