MCPcopy Create free account
hub / github.com/RenderKit/embree / DebugNodeTable

Method DebugNodeTable

tutorials/common/imgui/imgui_tables.cpp:3552–3614  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3550}
3551
3552void ImGui::DebugNodeTable(ImGuiTable* table)
3553{
3554 char buf[512];
3555 char* p = buf;
3556 const char* buf_end = buf + IM_ARRAYSIZE(buf);
3557 const bool is_active = (table->LastFrameActive >= ImGui::GetFrameCount() - 2); // Note that fully clipped early out scrolling tables will appear as inactive here.
3558 ImFormatString(p, buf_end - p, "Table 0x%08X (%d columns, in '%s')%s", table->ID, table->ColumnsCount, table->OuterWindow->Name, is_active ? "" : " *Inactive*");
3559 if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); }
3560 bool open = TreeNode(table, "%s", buf);
3561 if (!is_active) { PopStyleColor(); }
3562 if (IsItemHovered())
3563 GetForegroundDrawList()->AddRect(table->OuterRect.Min, table->OuterRect.Max, IM_COL32(255, 255, 0, 255));
3564 if (IsItemVisible() && table->HoveredColumnBody != -1)
3565 GetForegroundDrawList()->AddRect(GetItemRectMin(), GetItemRectMax(), IM_COL32(255, 255, 0, 255));
3566 if (!open)
3567 return;
3568 if (table->InstanceCurrent > 0)
3569 ImGui::Text("** %d instances of same table! Some data below will refer to last instance.", table->InstanceCurrent + 1);
3570 bool clear_settings = SmallButton("Clear settings");
3571 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));
3572 BulletText("ColumnsGivenWidth: %.1f, ColumnsAutoFitWidth: %.1f, InnerWidth: %.1f%s", table->ColumnsGivenWidth, table->ColumnsAutoFitWidth, table->InnerWidth, table->InnerWidth == 0.0f ? " (auto)" : "");
3573 BulletText("CellPaddingX: %.1f, CellSpacingX: %.1f/%.1f, OuterPaddingX: %.1f", table->CellPaddingX, table->CellSpacingX1, table->CellSpacingX2, table->OuterPaddingX);
3574 BulletText("HoveredColumnBody: %d, HoveredColumnBorder: %d", table->HoveredColumnBody, table->HoveredColumnBorder);
3575 BulletText("ResizedColumn: %d, ReorderColumn: %d, HeldHeaderColumn: %d", table->ResizedColumn, table->ReorderColumn, table->HeldHeaderColumn);
3576 //BulletText("BgDrawChannels: %d/%d", 0, table->BgDrawChannelUnfrozen);
3577 float sum_weights = 0.0f;
3578 for (int n = 0; n < table->ColumnsCount; n++)
3579 if (table->Columns[n].Flags & ImGuiTableColumnFlags_WidthStretch)
3580 sum_weights += table->Columns[n].StretchWeight;
3581 for (int n = 0; n < table->ColumnsCount; n++)
3582 {
3583 ImGuiTableColumn* column = &table->Columns[n];
3584 const char* name = TableGetColumnName(table, n);
3585 ImFormatString(buf, IM_ARRAYSIZE(buf),
3586 "Column %d order %d '%s': offset %+.2f to %+.2f%s\n"
3587 "Enabled: %d, VisibleX/Y: %d/%d, RequestOutput: %d, SkipItems: %d, DrawChannels: %d,%d\n"
3588 "WidthGiven: %.1f, Request/Auto: %.1f/%.1f, StretchWeight: %.3f (%.1f%%)\n"
3589 "MinX: %.1f, MaxX: %.1f (%+.1f), ClipRect: %.1f to %.1f (+%.1f)\n"
3590 "ContentWidth: %.1f,%.1f, HeadersUsed/Ideal %.1f/%.1f\n"
3591 "Sort: %d%s, UserID: 0x%08X, Flags: 0x%04X: %s%s%s..",
3592 n, column->DisplayOrder, name, column->MinX - table->WorkRect.Min.x, column->MaxX - table->WorkRect.Min.x, (n < table->FreezeColumnsRequest) ? " (Frozen)" : "",
3593 column->IsEnabled, column->IsVisibleX, column->IsVisibleY, column->IsRequestOutput, column->IsSkipItems, column->DrawChannelFrozen, column->DrawChannelUnfrozen,
3594 column->WidthGiven, column->WidthRequest, column->WidthAuto, column->StretchWeight, column->StretchWeight > 0.0f ? (column->StretchWeight / sum_weights) * 100.0f : 0.0f,
3595 column->MinX, column->MaxX, column->MaxX - column->MinX, column->ClipRect.Min.x, column->ClipRect.Max.x, column->ClipRect.Max.x - column->ClipRect.Min.x,
3596 column->ContentMaxXFrozen - column->WorkMinX, column->ContentMaxXUnfrozen - column->WorkMinX, column->ContentMaxXHeadersUsed - column->WorkMinX, column->ContentMaxXHeadersIdeal - column->WorkMinX,
3597 column->SortOrder, (column->SortDirection == ImGuiSortDirection_Ascending) ? " (Asc)" : (column->SortDirection == ImGuiSortDirection_Descending) ? " (Des)" : "", column->UserID, column->Flags,
3598 (column->Flags & ImGuiTableColumnFlags_WidthStretch) ? "WidthStretch " : "",
3599 (column->Flags & ImGuiTableColumnFlags_WidthFixed) ? "WidthFixed " : "",
3600 (column->Flags & ImGuiTableColumnFlags_NoResize) ? "NoResize " : "");
3601 Bullet();
3602 Selectable(buf);
3603 if (IsItemHovered())
3604 {
3605 ImRect r(column->MinX, table->OuterRect.Min.y, column->MaxX, table->OuterRect.Max.y);
3606 GetForegroundDrawList()->AddRect(r.Min, r.Max, IM_COL32(255, 255, 0, 255));
3607 }
3608 }
3609 if (ImGuiTableSettings* settings = TableGetBoundSettings(table))

Callers

nothing calls this directly

Calls 4

ImFormatStringFunction · 0.85
GetForegroundDrawListFunction · 0.85
AddRectMethod · 0.80

Tested by

no test coverage detected