Simplified some code and clariffied that currently non-resizable = always revert to default (while waiting to untangle Fixed vs Auto and programmatic override not going through TableSetupColumn)
Whereas ImGuiTableFlags_SameWidths has some unusual handling of mixed Fixed/Stretch columns, we know treat them separately.
ImGuiTableFlags_NoBordersInBodyUntilResize=1<<12,// [ALPHA] Disable vertical borders in columns Body until hovered for resize (borders will always appears in Headers). -> May move to style
ImGuiTableFlags_NoBordersInBodyUntilResize=1<<12,// [ALPHA] Disable vertical borders in columns Body until hovered for resize (borders will always appears in Headers). -> May move to style
// Sizing Policy (read above for defaults)
// Sizing Policy (read above for defaults)
ImGuiTableFlags_SizingFixedFit=1<<13,// Columns default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching contents width.
ImGuiTableFlags_SizingFixedFit=1<<13,// Columns default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching contents width.
ImGuiTableFlags_SizingFixedSame=2<<13,// Columns default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching the maximum contents width of all columns. Implicitly enable ImGuiTableFlags_NoKeepColumnsVisible.
ImGuiTableFlags_SizingStretchProp=3<<13,// Columns default to _WidthStretch with default weights proportional to each columns contents widths.
ImGuiTableFlags_SizingStretchSame=4<<13,// Columns default to _WidthStretch with default weights all equal, unless overriden by TableSetupColumn().
ImGuiTableFlags_SizingStretchSame=4<<13,// Columns default to _WidthStretch with default weights all equal, unless overriden by TableSetupColumn().
// Sizing Extra Options
// Sizing Extra Options
ImGuiTableFlags_SameWidths=1<<15,// Make all columns the same widths which is useful with Fixed columns policy (but granted by default with Stretch policy + no resize). Implicitly enable ImGuiTableFlags_NoKeepColumnsVisible and disable ImGuiTableFlags_Resizable.
ImGuiTableFlags_NoHostExtendY=1<<16,// Disable extending table past the limit set by outer_size.y. Only meaningful when neither ScrollX nor ScrollY are set (data below the limit will be clipped and not visible)
ImGuiTableFlags_NoHostExtendY=1<<16,// Disable extending table past the limit set by outer_size.y. Only meaningful when neither ScrollX nor ScrollY are set (data below the limit will be clipped and not visible)
ImGuiTableFlags_NoKeepColumnsVisible=1<<17,// Disable keeping column always minimally visible when ScrollX is off and table gets too small. Not recommended if columns are resizable.
ImGuiTableFlags_NoKeepColumnsVisible=1<<17,// Disable keeping column always minimally visible when ScrollX is off and table gets too small. Not recommended if columns are resizable.
ImGuiTableFlags_PreciseWidths=1<<18,// Disable distributing remainder width to stretched columns (width allocation on a 100-wide table with 3 columns: Without this flag: 33,33,34. With this flag: 33,33,33). With larger number of columns, resizing will appear to be less smooth.
ImGuiTableFlags_PreciseWidths=1<<18,// Disable distributing remainder width to stretched columns (width allocation on a 100-wide table with 3 columns: Without this flag: 33,33,34. With this flag: 33,33,33). With larger number of columns, resizing will appear to be less smooth.
@ -1098,7 +1099,10 @@ enum ImGuiTableFlags_
ImGuiTableFlags_ScrollY=1<<24,// Enable vertical scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size.
ImGuiTableFlags_ScrollY=1<<24,// Enable vertical scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size.
// Sorting
// Sorting
ImGuiTableFlags_SortMulti=1<<25,// Hold shift when clicking headers to sort on multiple column. TableGetSortSpecs() may return specs where (SpecsCount > 1).
ImGuiTableFlags_SortMulti=1<<25,// Hold shift when clicking headers to sort on multiple column. TableGetSortSpecs() may return specs where (SpecsCount > 1).
ImGuiTableFlags_SortTristate=1<<26// Allow no sorting, disable default sorting. TableGetSortSpecs() may return specs where (SpecsCount == 0).
ImGuiTableFlags_SortTristate=1<<26,// Allow no sorting, disable default sorting. TableGetSortSpecs() may return specs where (SpecsCount == 0).
ImGuiTableColumnFlags_DefaultHide=1<<0,// Default as a hidden/disabled column.
ImGuiTableColumnFlags_DefaultHide=1<<0,// Default as a hidden/disabled column.
ImGuiTableColumnFlags_DefaultSort=1<<1,// Default as a sorting column.
ImGuiTableColumnFlags_DefaultSort=1<<1,// Default as a sorting column.
ImGuiTableColumnFlags_WidthStretch=1<<2,// Column will stretch. Preferable with horizontal scrolling disabled (default if table sizing policy is _SizingStretchSame).
ImGuiTableColumnFlags_WidthStretch=1<<2,// Column will stretch. Preferable with horizontal scrolling disabled (default if table sizing policy is _SizingStretchSame or _SizingStretchProp).
ImGuiTableColumnFlags_WidthFixed=1<<3,// Column will not stretch. Preferable with horizontal scrolling enabled (default if table sizing policy is _SizingFixedFit and table is resizable).
ImGuiTableColumnFlags_WidthFixed=1<<3,// Column will not stretch. Preferable with horizontal scrolling enabled (default if table sizing policy is _SizingFixedFit and table is resizable).
ImGuiTableColumnFlags_WidthAuto=1<<4,// Column will not stretch and keep resizing based on submitted contents (default if table sizing policy is _SizingFixedFit and table is not resizable). Generally compatible with using right-most fitting widgets (e.g. SetNextItemWidth(-FLT_MIN))
ImGuiTableColumnFlags_WidthAuto=1<<4,// Column will not stretch and keep resizing based on submitted contents (default if table sizing policy is _SizingFixedFit and table is not resizable, or policy is _SizingFixedSame). Generally compatible with using right-most fitting widgets (e.g. SetNextItemWidth(-FLT_MIN))
{ImGuiTableFlags_None,"Default","Use default sizing policy:\n- ImGuiTableFlags_SizingFixedFit if ScrollX is on or if host window has ImGuiWindowFlags_AlwaysAutoResize.\n- ImGuiTableFlags_SizingStretchSame otherwise."},
{ImGuiTableFlags_SizingFixedFit,"ImGuiTableFlags_SizingFixedFit","Columns default to _WidthFixed (if resizable) or _WidthAuto (if not resizable), matching contents width."},
{ImGuiTableFlags_SizingFixedSame,"ImGuiTableFlags_SizingFixedSame","Columns are all the same width, matching the maximum contents width.\nImplicitly disable ImGuiTableFlags_Resizable and enable ImGuiTableFlags_NoKeepColumnsVisible."},
{ImGuiTableFlags_SizingStretchProp,"ImGuiTableFlags_SizingStretchProp","Columns default to _WidthStretch with weights proportional to their widths."},
{ImGuiTableFlags_SizingStretchSame,"ImGuiTableFlags_SizingStretchSame","Columns default to _WidthStretch with same weights."}
HelpMarker("This section allows you to interact and see the effect of various sizing policies depending on whether Scroll is enabled and the contents of your columns.");
HelpMarker("This section allows you to interact and see the effect of various sizing policies depending on whether Scroll is enabled and the contents of your columns.");
HelpMarker("Be mindful that using right-alignment (e.g. size.x = -FLT_MIN) creates a feedback loop where contents width can feed into auto-column width can feed into contents width.");
HelpMarker("Be mindful that using right-alignment (e.g. size.x = -FLT_MIN) creates a feedback loop where contents width can feed into auto-column width can feed into contents width.");
flags&=~ImGuiTableFlags_SizingStretchSame;// Can't specify both sizing polices so we clear the other
ImGui::SameLine();HelpMarker("Default if _ScrollX if enabled. Makes columns use _WidthFixed by default, or _WidthFixedResize if _Resizable is not set.");
ImGui::SameLine();HelpMarker("Disable distributing remainder width to stretched columns (width allocation on a 100-wide table with 3 columns: Without this flag: 33,33,34. With this flag: 33,33,33). With larger number of columns, resizing will appear to be less smooth.");
ImGui::SameLine();HelpMarker("Disable distributing remainder width to stretched columns (width allocation on a 100-wide table with 3 columns: Without this flag: 33,33,34. With this flag: 33,33,33). With larger number of columns, resizing will appear to be less smooth.");
flags&=~ImGuiTableFlags_SizingFixedFit;// Can't specify both sizing polices so we clear the other
ImGui::SameLine();HelpMarker("[Default if ScrollX is off]\nFit all columns within available width (or specified inner_width). Fixed and Stretch columns allowed.");
flags&=~ImGuiTableFlags_SizingStretchSame;// Can't specify both sizing polices so we clear the other
ImGui::SameLine();HelpMarker("[Default if ScrollX is on]\nEnlarge as needed: enable scrollbar if ScrollX is enabled, otherwise extend parent window's contents rectangle. Only Fixed columns allowed. Stretched columns will calculate their width assuming no scrolling.");
ImGui::SameLine();HelpMarker("In the Advanced demo we override the policy of each column so those table-wide settings have less effect that typical.");
ImGui::SameLine();HelpMarker("In the Advanced demo we override the policy of each column so those table-wide settings have less effect that typical.");
ImGui::SameLine();HelpMarker("Disable distributing remainder width to stretched columns (width allocation on a 100-wide table with 3 columns: Without this flag: 33,33,34. With this flag: 33,33,33). With larger number of columns, resizing will appear to be less smooth.");
ImGui::SameLine();HelpMarker("Disable distributing remainder width to stretched columns (width allocation on a 100-wide table with 3 columns: Without this flag: 33,33,34. With this flag: 33,33,33). With larger number of columns, resizing will appear to be less smooth.");
ImGui::SameLine();HelpMarker("Disable clipping rectangle for every individual columns (reduce draw command count, items will be able to overflow into other columns). Generally incompatible with ScrollFreeze options.");
ImGui::SameLine();HelpMarker("Disable clipping rectangle for every individual columns (reduce draw command count, items will be able to overflow into other columns). Generally incompatible with ScrollFreeze options.");
ImGuiTableColumnIdxDeclColumnsCount;// Count calls to TableSetupColumn()
ImGuiTableColumnIdxDeclColumnsCount;// Count calls to TableSetupColumn()
ImGuiTableColumnIdxHoveredColumnBody;// Index of column whose visible region is being hovered. Important: == ColumnsCount when hovering empty region after the right-most column!
ImGuiTableColumnIdxHoveredColumnBody;// Index of column whose visible region is being hovered. Important: == ColumnsCount when hovering empty region after the right-most column!
ImGuiTableColumnIdxHoveredColumnBorder;// Index of column whose right-border is being hovered (for resizing).
ImGuiTableColumnIdxHoveredColumnBorder;// Index of column whose right-border is being hovered (for resizing).
ImGuiTableColumnIdxAutoFitSingleStretchColumn;// Index of single stretch column requesting auto-fit.
ImGuiTableColumnIdxAutoFitSingleColumn;// Index of single column requesting auto-fit.
ImGuiTableColumnIdxResizedColumn;// Index of column being resized. Reset when InstanceCurrent==0.
ImGuiTableColumnIdxResizedColumn;// Index of column being resized. Reset when InstanceCurrent==0.
ImGuiTableColumnIdxLastResizedColumn;// Index of column being resized from previous frame.
ImGuiTableColumnIdxLastResizedColumn;// Index of column being resized from previous frame.
ImGuiTableColumnIdxHeldHeaderColumn;// Index of column header being held.
ImGuiTableColumnIdxHeldHeaderColumn;// Index of column header being held.
// About default width policy (if you don't specify a ImGuiTableColumnFlags_WidthXXXX flag)
// About default sizing policy (if you don't specify a ImGuiTableColumnFlags_WidthXXXX flag)
// - When Table policy ImGuiTableFlags_SizingFixedFit && (Table is Resizable || init_width > 0) --> default Column policy is ImGuiTableColumnFlags_WidthFixed
// - with Table policy ImGuiTableFlags_SizingFixedFit && (Resizable == 1 || init_width > 0) --> default Column policy is ImGuiTableColumnFlags_WidthFixed, default Width is equal to contents width
// - When Table policy ImGuiTableFlags_SizingFixedFit && (Table is !Resizable && init_width <= 0) --> default Column policy is ImGuiTableColumnFlags_WidthAuto
// - with Table policy ImGuiTableFlags_SizingFixedFit && (Resizable == 0 && init_width <= 0) --> default Column policy is ImGuiTableColumnFlags_WidthAuto, Width always equal to contents width
// - When Table policy ImGuiTableFlags_SizingStretchSame --> default Column policy is ImGuiTableColumnFlags_WidthStretch
// - with Table policy ImGuiTableFlags_SizingFixedSame --> default Column policy is ImGuiTableColumnFlags_WidthAuto, default Width is max of all contents width
// - with Table policy ImGuiTableFlags_SizingStretchSame --> default Column policy is ImGuiTableColumnFlags_WidthStretch, default Weight is 1.0f
// - with Table policy ImGuiTableFlags_SizingStretchWeight --> default Column policy is ImGuiTableColumnFlags_WidthStretch, default Weight is proportional to contents
// [Part 3] Fix column flags. Count how many fixed/stretch columns we have and sum of weights.
// [Part 3] Fix column flags and record a few extra information.
intcount_fixed=0;// Number of columns that have fixed sizing policy (not stretched sizing policy) (this is NOT the opposite of count_resizable!)
floatsum_width_requests=0.0f;// Sum of all width for fixed and auto-resize columns, excluding width contributed by Stretch columns but including spacing/padding.
floatsum_width_requests=0.0f;// Sum of all width for fixed and auto-resize columns, excluding width contributed by Stretch columns but including spacing/padding.
floatmax_width_auto=0.0f;// Largest auto-width (used for SameWidths feature)
floatstretch_sum_weights=0.0f;// Sum of all weights for stretch columns.
floatstretch_sum_weights=0.0f;// Sum of all weights for stretch columns.