@ -487,6 +487,7 @@ static ImGuiTableColumnFlags TableFixColumnFlags(ImGuiTable* table, ImGuiTableCo
// Sizing Policy
// Sizing Policy
if ( ( flags & ImGuiTableColumnFlags_WidthMask_ ) = = 0 )
if ( ( flags & ImGuiTableColumnFlags_WidthMask_ ) = = 0 )
{
{
// FIXME-TABLE: Inconsistent to promote columns to WidthAlwaysAutoResize
if ( table - > Flags & ImGuiTableFlags_SizingPolicyFixedX )
if ( table - > Flags & ImGuiTableFlags_SizingPolicyFixedX )
flags | = ( ( table - > Flags & ImGuiTableFlags_Resizable ) & & ! ( flags & ImGuiTableColumnFlags_NoResize ) ) ? ImGuiTableColumnFlags_WidthFixed : ImGuiTableColumnFlags_WidthAlwaysAutoResize ;
flags | = ( ( table - > Flags & ImGuiTableFlags_Resizable ) & & ! ( flags & ImGuiTableColumnFlags_NoResize ) ) ? ImGuiTableColumnFlags_WidthFixed : ImGuiTableColumnFlags_WidthAlwaysAutoResize ;
else
else
@ -536,7 +537,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
// Compute offset, clip rect for the frame
// Compute offset, clip rect for the frame
const ImRect work_rect = table - > WorkRect ;
const ImRect work_rect = table - > WorkRect ;
const float padding_auto_x = table - > CellPaddingX 1 ; // Can't make auto padding larger than what WorkRect knows about so right-alignment matches.
const float padding_auto_x = table - > CellPaddingX 2 ; // Can't make auto padding larger than what WorkRect knows about so right-alignment matches.
const float min_column_width = TableGetMinColumnWidth ( ) ;
const float min_column_width = TableGetMinColumnWidth ( ) ;
int count_fixed = 0 ;
int count_fixed = 0 ;
@ -595,12 +596,13 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
}
}
// Layout
// Layout
// Remove -1.0f to cancel out the +1.0f we are doing in EndTable() to make last column line visible
const float width_spacings = table - > CellSpacingX * ( table - > ColumnsActiveCount - 1 ) ;
const float width_spacings = table - > CellSpacingX * ( table - > ColumnsActiveCount - 1 ) ;
float width_avail ;
float width_avail ;
if ( ( table - > Flags & ImGuiTableFlags_ScrollX ) & & ( table - > InnerWidth = = 0.0f ) )
if ( ( table - > Flags & ImGuiTableFlags_ScrollX ) & & ( table - > InnerWidth = = 0.0f ) )
width_avail = table - > InnerClipRect . GetWidth ( ) - width_spacings - 1.0f ;
width_avail = table - > InnerClipRect . GetWidth ( ) - width_spacings - 1.0f ;
else
else
width_avail = work_rect . GetWidth ( ) - width_spacings - 1.0f ; // Remove -1.0f to cancel out the +1.0f we are doing in EndTable() to make last column line visible
width_avail = work_rect . GetWidth ( ) - width_spacings - 1.0f ;
const float width_avail_for_stretched_columns = width_avail - width_fixed ;
const float width_avail_for_stretched_columns = width_avail - width_fixed ;
float width_remaining_for_stretched_columns = width_avail_for_stretched_columns ;
float width_remaining_for_stretched_columns = width_avail_for_stretched_columns ;
@ -1406,7 +1408,10 @@ void ImGui::TableSetupColumn(const char* label, ImGuiTableColumnFlags flags,
if ( flags & ImGuiTableColumnFlags_DefaultHide )
if ( flags & ImGuiTableColumnFlags_DefaultHide )
column - > IsActive = column - > NextIsActive = false ;
column - > IsActive = column - > NextIsActive = false ;
if ( flags & ImGuiTableColumnFlags_DefaultSort )
if ( flags & ImGuiTableColumnFlags_DefaultSort )
{
column - > SortOrder = 0 ; // Multiple columns using _DefaultSort will be reordered when building the sort specs.
column - > SortOrder = 0 ; // Multiple columns using _DefaultSort will be reordered when building the sort specs.
column - > SortDirection = ( column - > Flags & ImGuiTableColumnFlags_PreferSortDescending ) ? ( ImS8 ) ImGuiSortDirection_Descending : ( ImU8 ) ( ImGuiSortDirection_Ascending ) ;
}
}
}
// Store name (append with zero-terminator in contiguous buffer)
// Store name (append with zero-terminator in contiguous buffer)
@ -2090,7 +2095,7 @@ void ImGui::TableSortSpecsClickColumn(ImGuiTable* table, ImGuiTableColumn* click
table - > IsSortSpecsDirty = true ;
table - > IsSortSpecsDirty = true ;
}
}
// Return NULL if no sort specs .
// Return NULL if no sort specs (most often when ImGuiTableFlags_Sortable is not set)
// You can sort your data again when 'SpecsChanged == true'. It will be true with sorting specs have changed since last call, or the first time.
// You can sort your data again when 'SpecsChanged == true'. It will be true with sorting specs have changed since last call, or the first time.
// Lifetime: don't hold on this pointer over multiple frames or past any subsequent call to BeginTable()!
// Lifetime: don't hold on this pointer over multiple frames or past any subsequent call to BeginTable()!
const ImGuiTableSortSpecs * ImGui : : TableGetSortSpecs ( )
const ImGuiTableSortSpecs * ImGui : : TableGetSortSpecs ( )
@ -2439,10 +2444,12 @@ void ImGui::DebugNodeTable(ImGuiTable* table)
BulletText ( " Column %d order %d name '%s': +%.1f to +%.1f \n "
BulletText ( " Column %d order %d name '%s': +%.1f to +%.1f \n "
" Active: %d, Clipped: %d, DrawChannels: %d,%d \n "
" Active: %d, Clipped: %d, DrawChannels: %d,%d \n "
" WidthGiven/Requested: %.1f/%.1f, Weight: %.2f \n "
" WidthGiven/Requested: %.1f/%.1f, Weight: %.2f \n "
" ContentWidth: RowsFrozen %d, RowsUnfrozen %d, HeadersUsed/Desired %d/%d \n "
" UserID: 0x%08X, Flags: 0x%04X: %s%s%s%s.. " ,
" UserID: 0x%08X, Flags: 0x%04X: %s%s%s%s.. " ,
n , column - > IndexDisplayOrder , name ? name : " NULL " , column - > MinX - table - > WorkRect . Min . x , column - > MaxX - table - > WorkRect . Min . x ,
n , column - > IndexDisplayOrder , name ? name : " NULL " , column - > MinX - table - > WorkRect . Min . x , column - > MaxX - table - > WorkRect . Min . x ,
column - > IsActive , column - > IsClipped , column - > DrawChannelRowsBeforeFreeze , column - > DrawChannelRowsAfterFreeze ,
column - > IsActive , column - > IsClipped , column - > DrawChannelRowsBeforeFreeze , column - > DrawChannelRowsAfterFreeze ,
column - > WidthGiven , column - > WidthRequested , column - > ResizeWeight ,
column - > WidthGiven , column - > WidthRequested , column - > ResizeWeight ,
column - > ContentWidthRowsFrozen , column - > ContentWidthRowsUnfrozen , column - > ContentWidthHeadersUsed , column - > ContentWidthHeadersDesired ,
column - > UserID , column - > Flags ,
column - > UserID , column - > Flags ,
( column - > Flags & ImGuiTableColumnFlags_WidthFixed ) ? " WidthFixed " : " " ,
( column - > Flags & ImGuiTableColumnFlags_WidthFixed ) ? " WidthFixed " : " " ,
( column - > Flags & ImGuiTableColumnFlags_WidthStretch ) ? " WidthStretch " : " " ,
( column - > Flags & ImGuiTableColumnFlags_WidthStretch ) ? " WidthStretch " : " " ,