MCPcopy Create free account
hub / github.com/Aegel5/SimpleSwitcher / TableInitColumnDefaults

Function TableInitColumnDefaults

imgui_tiny_app/imgui/imgui_tables.cpp:1615–1636  ·  view source on GitHub ↗

Called in TableSetupColumn() when initializing and in TableLoadSettings() for defaults before applying stored settings. 'init_mask' specify which fields to initialize.

Source from the content-addressed store, hash-verified

1613// Called in TableSetupColumn() when initializing and in TableLoadSettings() for defaults before applying stored settings.
1614// 'init_mask' specify which fields to initialize.
1615static void TableInitColumnDefaults(ImGuiTable* table, ImGuiTableColumn* column, ImGuiTableColumnFlags init_mask)
1616{
1617 ImGuiTableColumnFlags flags = column->Flags;
1618 if (init_mask & ImGuiTableFlags_Resizable)
1619 {
1620 float init_width_or_weight = column->InitStretchWeightOrWidth;
1621 column->WidthRequest = ((flags & ImGuiTableColumnFlags_WidthFixed) && init_width_or_weight > 0.0f) ? init_width_or_weight : -1.0f;
1622 column->StretchWeight = (init_width_or_weight > 0.0f && (flags & ImGuiTableColumnFlags_WidthStretch)) ? init_width_or_weight : -1.0f;
1623 if (init_width_or_weight > 0.0f) // Disable auto-fit if an explicit width/weight has been specified
1624 column->AutoFitQueue = 0x00;
1625 }
1626 if (init_mask & ImGuiTableFlags_Reorderable)
1627 column->DisplayOrder = (ImGuiTableColumnIdx)table->Columns.index_from_ptr(column);
1628 if (init_mask & ImGuiTableFlags_Hideable)
1629 column->IsUserEnabled = column->IsUserEnabledNextFrame = (flags & ImGuiTableColumnFlags_DefaultHide) ? 0 : 1;
1630 if (init_mask & ImGuiTableFlags_Sortable)
1631 {
1632 // Multiple columns using _DefaultSort will be reassigned unique SortOrder values when building the sort specs.
1633 column->SortOrder = (flags & ImGuiTableColumnFlags_DefaultSort) ? 0 : -1;
1634 column->SortDirection = (flags & ImGuiTableColumnFlags_DefaultSort) ? ((flags & ImGuiTableColumnFlags_PreferSortDescending) ? (ImS8)ImGuiSortDirection_Descending : (ImU8)(ImGuiSortDirection_Ascending)) : (ImS8)ImGuiSortDirection_None;
1635 }
1636}
1637
1638// See "COLUMNS SIZING POLICIES" comments at the top of this file
1639// If (init_width_or_weight <= 0.0f) it is ignored

Callers 2

TableSetupColumnMethod · 0.85
TableLoadSettingsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected