| 4096 | } |
| 4097 | |
| 4098 | void ImGui::DebugNodeTable(ImGuiTable* table) |
| 4099 | { |
| 4100 | ImGuiContext& g = *GImGui; |
| 4101 | const bool is_active = (table->LastFrameActive >= g.FrameCount - 2); // Note that fully clipped early out scrolling tables will appear as inactive here. |
| 4102 | if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); } |
| 4103 | bool open = TreeNode(table, "Table 0x%08X (%d columns, in '%s')%s", table->ID, table->ColumnsCount, table->OuterWindow->Name, is_active ? "" : " *Inactive*"); |
| 4104 | if (!is_active) { PopStyleColor(); } |
| 4105 | if (IsItemHovered()) |
| 4106 | GetForegroundDrawList(table->OuterWindow)->AddRect(table->OuterRect.Min, table->OuterRect.Max, IM_COL32(255, 255, 0, 255)); |
| 4107 | if (IsItemVisible() && table->HoveredColumnBody != -1) |
| 4108 | GetForegroundDrawList(table->OuterWindow)->AddRect(GetItemRectMin(), GetItemRectMax(), IM_COL32(255, 255, 0, 255)); |
| 4109 | if (!open) |
| 4110 | return; |
| 4111 | if (table->InstanceCurrent > 0) |
| 4112 | Text("** %d instances of same table! Some data below will refer to last instance.", table->InstanceCurrent + 1); |
| 4113 | if (g.IO.ConfigDebugIsDebuggerPresent) |
| 4114 | { |
| 4115 | if (DebugBreakButton("**DebugBreak**", "in BeginTable()")) |
| 4116 | g.DebugBreakInTable = table->ID; |
| 4117 | SameLine(); |
| 4118 | } |
| 4119 | |
| 4120 | bool clear_settings = SmallButton("Clear settings"); |
| 4121 | 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)); |
| 4122 | BulletText("ColumnsGivenWidth: %.1f, ColumnsAutoFitWidth: %.1f, InnerWidth: %.1f%s", table->ColumnsGivenWidth, table->ColumnsAutoFitWidth, table->InnerWidth, table->InnerWidth == 0.0f ? " (auto)" : ""); |
| 4123 | BulletText("CellPaddingX: %.1f, CellSpacingX: %.1f/%.1f, OuterPaddingX: %.1f", table->CellPaddingX, table->CellSpacingX1, table->CellSpacingX2, table->OuterPaddingX); |
| 4124 | BulletText("HoveredColumnBody: %d, HoveredColumnBorder: %d", table->HoveredColumnBody, table->HoveredColumnBorder); |
| 4125 | BulletText("ResizedColumn: %d, HeldHeaderColumn: %d, ReorderColumn: %d", table->LastResizedColumn, table->LastHeldHeaderColumn, table->ReorderColumn); |
| 4126 | for (int n = 0; n < table->InstanceCurrent + 1; n++) |
| 4127 | { |
| 4128 | ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, n); |
| 4129 | BulletText("Instance %d: HoveredRow: %d, LastOuterHeight: %.2f", n, table_instance->HoveredRowLast, table_instance->LastOuterHeight); |
| 4130 | } |
| 4131 | //BulletText("BgDrawChannels: %d/%d", 0, table->BgDrawChannelUnfrozen); |
| 4132 | float sum_weights = 0.0f; |
| 4133 | for (int n = 0; n < table->ColumnsCount; n++) |
| 4134 | if (table->Columns[n].Flags & ImGuiTableColumnFlags_WidthStretch) |
| 4135 | sum_weights += table->Columns[n].StretchWeight; |
| 4136 | for (int n = 0; n < table->ColumnsCount; n++) |
| 4137 | { |
| 4138 | ImGuiTableColumn* column = &table->Columns[n]; |
| 4139 | const char* name = TableGetColumnName(table, n); |
| 4140 | char buf[512]; |
| 4141 | ImFormatString(buf, IM_COUNTOF(buf), |
| 4142 | "Column %d order %d '%s': offset %+.2f to %+.2f%s\n" |
| 4143 | "Enabled: %d, VisibleX/Y: %d/%d, RequestOutput: %d, SkipItems: %d, DrawChannels: %d,%d\n" |
| 4144 | "WidthGiven: %.1f, Request/Auto: %.1f/%.1f, StretchWeight: %.3f (%.1f%%)\n" |
| 4145 | "MinX: %.1f, MaxX: %.1f (%+.1f), ClipRect: %.1f to %.1f (+%.1f)\n" |
| 4146 | "ContentWidth: %.1f,%.1f, HeadersUsed/Ideal %.1f/%.1f\n" |
| 4147 | "Sort: %d%s, UserID: 0x%08X, Flags: 0x%04X: %s%s%s..", |
| 4148 | n, column->DisplayOrder, name, column->MinX - table->WorkRect.Min.x, column->MaxX - table->WorkRect.Min.x, (n < table->FreezeColumnsRequest) ? " (Frozen)" : "", |
| 4149 | column->IsEnabled, column->IsVisibleX, column->IsVisibleY, column->IsRequestOutput, column->IsSkipItems, column->DrawChannelFrozen, column->DrawChannelUnfrozen, |
| 4150 | column->WidthGiven, column->WidthRequest, column->WidthAuto, column->StretchWeight, column->StretchWeight > 0.0f ? (column->StretchWeight / sum_weights) * 100.0f : 0.0f, |
| 4151 | column->MinX, column->MaxX, column->MaxX - column->MinX, column->ClipRect.Min.x, column->ClipRect.Max.x, column->ClipRect.Max.x - column->ClipRect.Min.x, |
| 4152 | column->ContentMaxXFrozen - column->WorkMinX, column->ContentMaxXUnfrozen - column->WorkMinX, column->ContentMaxXHeadersUsed - column->WorkMinX, column->ContentMaxXHeadersIdeal - column->WorkMinX, |
| 4153 | column->SortOrder, (column->SortDirection == ImGuiSortDirection_Ascending) ? " (Asc)" : (column->SortDirection == ImGuiSortDirection_Descending) ? " (Des)" : "", column->UserID, column->Flags, |
| 4154 | (column->Flags & ImGuiTableColumnFlags_WidthStretch) ? "WidthStretch " : "", |
| 4155 | (column->Flags & ImGuiTableColumnFlags_WidthFixed) ? "WidthFixed " : "", |
nothing calls this directly
no test coverage detected