Maximum column content width given current layout. Use column->MinX so this value differs on a per-column basis.
| 2288 | |
| 2289 | // Maximum column content width given current layout. Use column->MinX so this value differs on a per-column basis. |
| 2290 | float ImGui::TableCalcMaxColumnWidth(const ImGuiTable* table, int column_n) |
| 2291 | { |
| 2292 | const ImGuiTableColumn* column = &table->Columns[column_n]; |
| 2293 | float max_width = FLT_MAX; |
| 2294 | const float min_column_distance = table->MinColumnWidth + table->CellPaddingX * 2.0f + table->CellSpacingX1 + table->CellSpacingX2; |
| 2295 | if (table->Flags & ImGuiTableFlags_ScrollX) |
| 2296 | { |
| 2297 | // Frozen columns can't reach beyond visible width else scrolling will naturally break. |
| 2298 | // (we use DisplayOrder as within a set of multiple frozen column reordering is possible) |
| 2299 | if (column->DisplayOrder < table->FreezeColumnsRequest) |
| 2300 | { |
| 2301 | max_width = (table->InnerClipRect.Max.x - (table->FreezeColumnsRequest - column->DisplayOrder) * min_column_distance) - column->MinX; |
| 2302 | max_width = max_width - table->OuterPaddingX - table->CellPaddingX - table->CellSpacingX2; |
| 2303 | } |
| 2304 | } |
| 2305 | else if ((table->Flags & ImGuiTableFlags_NoKeepColumnsVisible) == 0) |
| 2306 | { |
| 2307 | // If horizontal scrolling if disabled, we apply a final lossless shrinking of columns in order to make |
| 2308 | // sure they are all visible. Because of this we also know that all of the columns will always fit in |
| 2309 | // table->WorkRect and therefore in table->InnerRect (because ScrollX is off) |
| 2310 | // FIXME-TABLE: This is solved incorrectly but also quite a difficult problem to fix as we also want ClipRect width to match. |
| 2311 | // See "table_width_distrib" and "table_width_keep_visible" tests |
| 2312 | max_width = table->WorkRect.Max.x - (table->ColumnsEnabledCount - column->IndexWithinEnabledSet - 1) * min_column_distance - column->MinX; |
| 2313 | //max_width -= table->CellSpacingX1; |
| 2314 | max_width -= table->CellSpacingX2; |
| 2315 | max_width -= table->CellPaddingX * 2.0f; |
| 2316 | max_width -= table->OuterPaddingX; |
| 2317 | } |
| 2318 | return max_width; |
| 2319 | } |
| 2320 | |
| 2321 | // Note this is meant to be stored in column->WidthAuto, please generally use the WidthAuto field |
| 2322 | float ImGui::TableGetColumnWidthAuto(ImGuiTable* table, ImGuiTableColumn* column) |
nothing calls this directly
no outgoing calls
no test coverage detected