| 3495 | } |
| 3496 | |
| 3497 | void ImGui::DebugNodeTable(ImGuiTable* table) |
| 3498 | { |
| 3499 | char buf[512]; |
| 3500 | char* p = buf; |
| 3501 | const char* buf_end = buf + IM_ARRAYSIZE(buf); |
| 3502 | const bool is_active = (table->LastFrameActive >= ImGui::GetFrameCount() - 2); // Note that fully clipped early out scrolling tables will appear as inactive here. |
| 3503 | ImFormatString(p, buf_end - p, "Table 0x%08X (%d columns, in '%s')%s", table->ID, table->ColumnsCount, table->OuterWindow->Name, is_active ? "" : " *Inactive*"); |
| 3504 | if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); } |
| 3505 | bool open = TreeNode(table, "%s", buf); |
| 3506 | if (!is_active) { PopStyleColor(); } |
| 3507 | if (IsItemHovered()) |
| 3508 | GetForegroundDrawList()->AddRect(table->OuterRect.Min, table->OuterRect.Max, IM_COL32(255, 255, 0, 255)); |
| 3509 | if (IsItemVisible() && table->HoveredColumnBody != -1) |
| 3510 | GetForegroundDrawList()->AddRect(GetItemRectMin(), GetItemRectMax(), IM_COL32(255, 255, 0, 255)); |
| 3511 | if (!open) |
| 3512 | return; |
| 3513 | bool clear_settings = SmallButton("Clear settings"); |
| 3514 | 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)); |
| 3515 | BulletText("ColumnsGivenWidth: %.1f, ColumnsAutoFitWidth: %.1f, InnerWidth: %.1f%s", table->ColumnsGivenWidth, table->ColumnsAutoFitWidth, table->InnerWidth, table->InnerWidth == 0.0f ? " (auto)" : ""); |
| 3516 | BulletText("CellPaddingX: %.1f, CellSpacingX: %.1f/%.1f, OuterPaddingX: %.1f", table->CellPaddingX, table->CellSpacingX1, table->CellSpacingX2, table->OuterPaddingX); |
| 3517 | BulletText("HoveredColumnBody: %d, HoveredColumnBorder: %d", table->HoveredColumnBody, table->HoveredColumnBorder); |
| 3518 | BulletText("ResizedColumn: %d, ReorderColumn: %d, HeldHeaderColumn: %d", table->ResizedColumn, table->ReorderColumn, table->HeldHeaderColumn); |
| 3519 | //BulletText("BgDrawChannels: %d/%d", 0, table->BgDrawChannelUnfrozen); |
| 3520 | float sum_weights = 0.0f; |
| 3521 | for (int n = 0; n < table->ColumnsCount; n++) |
| 3522 | if (table->Columns[n].Flags & ImGuiTableColumnFlags_WidthStretch) |
| 3523 | sum_weights += table->Columns[n].StretchWeight; |
| 3524 | for (int n = 0; n < table->ColumnsCount; n++) |
| 3525 | { |
| 3526 | ImGuiTableColumn* column = &table->Columns[n]; |
| 3527 | const char* name = TableGetColumnName(table, n); |
| 3528 | ImFormatString(buf, IM_ARRAYSIZE(buf), |
| 3529 | "Column %d order %d '%s': offset %+.2f to %+.2f%s\n" |
| 3530 | "Enabled: %d, VisibleX/Y: %d/%d, RequestOutput: %d, SkipItems: %d, DrawChannels: %d,%d\n" |
| 3531 | "WidthGiven: %.1f, Request/Auto: %.1f/%.1f, StretchWeight: %.3f (%.1f%%)\n" |
| 3532 | "MinX: %.1f, MaxX: %.1f (%+.1f), ClipRect: %.1f to %.1f (+%.1f)\n" |
| 3533 | "ContentWidth: %.1f,%.1f, HeadersUsed/Ideal %.1f/%.1f\n" |
| 3534 | "Sort: %d%s, UserID: 0x%08X, Flags: 0x%04X: %s%s%s..", |
| 3535 | n, column->DisplayOrder, name, column->MinX - table->WorkRect.Min.x, column->MaxX - table->WorkRect.Min.x, (n < table->FreezeColumnsRequest) ? " (Frozen)" : "", |
| 3536 | column->IsEnabled, column->IsVisibleX, column->IsVisibleY, column->IsRequestOutput, column->IsSkipItems, column->DrawChannelFrozen, column->DrawChannelUnfrozen, |
| 3537 | column->WidthGiven, column->WidthRequest, column->WidthAuto, column->StretchWeight, column->StretchWeight > 0.0f ? (column->StretchWeight / sum_weights) * 100.0f : 0.0f, |
| 3538 | column->MinX, column->MaxX, column->MaxX - column->MinX, column->ClipRect.Min.x, column->ClipRect.Max.x, column->ClipRect.Max.x - column->ClipRect.Min.x, |
| 3539 | column->ContentMaxXFrozen - column->WorkMinX, column->ContentMaxXUnfrozen - column->WorkMinX, column->ContentMaxXHeadersUsed - column->WorkMinX, column->ContentMaxXHeadersIdeal - column->WorkMinX, |
| 3540 | column->SortOrder, (column->SortDirection == ImGuiSortDirection_Ascending) ? " (Asc)" : (column->SortDirection == ImGuiSortDirection_Descending) ? " (Des)" : "", column->UserID, column->Flags, |
| 3541 | (column->Flags & ImGuiTableColumnFlags_WidthStretch) ? "WidthStretch " : "", |
| 3542 | (column->Flags & ImGuiTableColumnFlags_WidthFixed) ? "WidthFixed " : "", |
| 3543 | (column->Flags & ImGuiTableColumnFlags_NoResize) ? "NoResize " : ""); |
| 3544 | Bullet(); |
| 3545 | Selectable(buf); |
| 3546 | if (IsItemHovered()) |
| 3547 | { |
| 3548 | ImRect r(column->MinX, table->OuterRect.Min.y, column->MaxX, table->OuterRect.Max.y); |
| 3549 | GetForegroundDrawList()->AddRect(r.Min, r.Max, IM_COL32(255, 255, 0, 255)); |
| 3550 | } |
| 3551 | } |
| 3552 | if (ImGuiTableSettings* settings = TableGetBoundSettings(table)) |
| 3553 | DebugNodeTableSettings(settings); |
| 3554 | if (clear_settings) |
nothing calls this directly
no test coverage detected