@ -286,7 +286,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
table - > DeclColumnsCount = 0 ;
table - > HoveredColumnBody = - 1 ;
table - > HoveredColumnBorder = - 1 ;
table - > RightMost Activ eColumn = - 1 ;
table - > RightMost Visibl eColumn = - 1 ;
// Using opaque colors facilitate overlapping elements of the grid
table - > BorderColorStrong = GetColorU32 ( ImGuiCol_TableBorderStrong ) ;
@ -333,7 +333,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
// Because we cannot safely assert in EndTable() when no rows have been created, this seems like our best option.
inner_window - > SkipItems = true ;
// Update/lock which columns will be Activ e for the frame
// Update/lock which columns will be Visibl e for the frame
TableBeginUpdateColumns ( table ) ;
return true ;
@ -371,7 +371,7 @@ void ImGui::TableBeginUpdateColumns(ImGuiTable* table)
IM_ASSERT ( reorder_dir = = - 1 | | reorder_dir = = + 1 ) ;
IM_ASSERT ( table - > Flags & ImGuiTableFlags_Reorderable ) ;
ImGuiTableColumn * src_column = & table - > Columns [ table - > ReorderColumn ] ;
ImGuiTableColumn * dst_column = & table - > Columns [ ( reorder_dir = = - 1 ) ? src_column - > Prev ActiveColumn : src_column - > NextActiv eColumn] ;
ImGuiTableColumn * dst_column = & table - > Columns [ ( reorder_dir = = - 1 ) ? src_column - > Prev VisibleColumn : src_column - > NextVisibl eColumn] ;
IM_UNUSED ( dst_column ) ;
const int src_order = src_column - > DisplayOrder ;
const int dst_order = dst_column - > DisplayOrder ;
@ -398,10 +398,10 @@ void ImGui::TableBeginUpdateColumns(ImGuiTable* table)
table - > IsSettingsDirty = true ;
}
// Setup and lock Activ e state and order
table - > Columns Activ eCount = 0 ;
// Setup and lock Visibl e state and order
table - > Columns Visibl eCount = 0 ;
table - > IsDefaultDisplayOrder = true ;
ImGuiTableColumn * last_ activ e_column = NULL ;
ImGuiTableColumn * last_ visibl e_column = NULL ;
bool want_column_auto_fit = false ;
for ( int order_n = 0 ; order_n < table - > ColumnsCount ; order_n + + )
{
@ -411,12 +411,12 @@ void ImGui::TableBeginUpdateColumns(ImGuiTable* table)
ImGuiTableColumn * column = & table - > Columns [ column_n ] ;
column - > NameOffset = - 1 ;
if ( ! ( table - > Flags & ImGuiTableFlags_Hideable ) | | ( column - > Flags & ImGuiTableColumnFlags_NoHide ) )
column - > Is Activ eNextFrame = true ;
if ( column - > Is Active ! = column - > IsActiv eNextFrame)
column - > Is Visibl eNextFrame = true ;
if ( column - > Is Visible ! = column - > IsVisibl eNextFrame)
{
column - > Is Active = column - > IsActiv eNextFrame;
column - > Is Visible = column - > IsVisibl eNextFrame;
table - > IsSettingsDirty = true ;
if ( ! column - > Is Activ e & & column - > SortOrder ! = - 1 )
if ( ! column - > Is Visibl e & & column - > SortOrder ! = - 1 )
table - > IsSortSpecsDirty = true ;
}
if ( column - > SortOrder > 0 & & ! ( table - > Flags & ImGuiTableFlags_MultiSortable ) )
@ -426,30 +426,30 @@ void ImGui::TableBeginUpdateColumns(ImGuiTable* table)
ImU64 index_mask = ( ImU64 ) 1 < < column_n ;
ImU64 display_order_mask = ( ImU64 ) 1 < < column - > DisplayOrder ;
if ( column - > Is Activ e)
if ( column - > Is Visibl e)
{
column - > Prev ActiveColumn = column - > NextActiv eColumn = - 1 ;
if ( last_ activ e_column)
column - > Prev VisibleColumn = column - > NextVisibl eColumn = - 1 ;
if ( last_ visibl e_column)
{
last_ active_column- > NextActiv eColumn = ( ImS8 ) column_n ;
column - > Prev Activ eColumn = ( ImS8 ) table - > Columns . index_from_ptr ( last_ activ e_column) ;
last_ visible_column- > NextVisibl eColumn = ( ImS8 ) column_n ;
column - > Prev Visibl eColumn = ( ImS8 ) table - > Columns . index_from_ptr ( last_ visibl e_column) ;
}
column - > IndexWithin ActiveSet = ( ImS8 ) table - > ColumnsActiv eCount;
table - > Columns Activ eCount+ + ;
table - > Activ eMaskByIndex | = index_mask ;
table - > Activ eMaskByDisplayOrder | = display_order_mask ;
last_ activ e_column = column ;
column - > IndexWithin VisibleSet = ( ImS8 ) table - > ColumnsVisibl eCount;
table - > Columns Visibl eCount+ + ;
table - > Visibl eMaskByIndex | = index_mask ;
table - > Visibl eMaskByDisplayOrder | = display_order_mask ;
last_ visibl e_column = column ;
}
else
{
column - > IndexWithin Activ eSet = - 1 ;
table - > Activ eMaskByIndex & = ~ index_mask ;
table - > Activ eMaskByDisplayOrder & = ~ display_order_mask ;
column - > IndexWithin Visibl eSet = - 1 ;
table - > Visibl eMaskByIndex & = ~ index_mask ;
table - > Visibl eMaskByDisplayOrder & = ~ display_order_mask ;
}
IM_ASSERT ( column - > IndexWithin Activ eSet < = column - > DisplayOrder ) ;
IM_ASSERT ( column - > IndexWithin Visibl eSet < = column - > DisplayOrder ) ;
}
table - > Visible MaskByIndex = table - > Activ eMaskByIndex; // Columns will be masked out by TableUpdateLayout() when Clipped
table - > RightMost ActiveColumn = ( ImS8 ) ( last_activ e_column ? table - > Columns . index_from_ptr ( last_ activ e_column) : - 1 ) ;
table - > Visible Unclipped MaskByIndex = table - > Visibl eMaskByIndex; // Columns will be masked out by TableUpdateLayout() when Clipped
table - > RightMost VisibleColumn = ( ImS8 ) ( last_visibl e_column ? table - > Columns . index_from_ptr ( last_ visibl e_column) : - 1 ) ;
// Disable child window clipping while fitting columns. This is not strictly necessary but makes it possible to avoid
// the column fitting to wait until the first visible frame of the child container (may or not be a good thing).
@ -473,9 +473,9 @@ void ImGui::TableUpdateDrawChannels(ImGuiTable* table)
// - FreezeRows || FreezeColumns --> 1+N*2 (unless scrolling value is zero)
// - FreezeRows && FreezeColunns --> 2+N*2 (unless scrolling value is zero)
const int freeze_row_multiplier = ( table - > FreezeRowsCount > 0 ) ? 2 : 1 ;
const int channels_for_row = ( table - > Flags & ImGuiTableFlags_NoClipX ) ? 1 : table - > Columns Activ eCount;
const int channels_for_row = ( table - > Flags & ImGuiTableFlags_NoClipX ) ? 1 : table - > Columns Visibl eCount;
const int channels_for_background = 1 ;
const int channels_for_dummy = ( table - > Columns Activ eCount < table - > ColumnsCount | | table - > Visible MaskByIndex ! = table - > Activ eMaskByIndex) ? + 1 : 0 ;
const int channels_for_dummy = ( table - > Columns Visibl eCount < table - > ColumnsCount | | table - > Visible Unclipped MaskByIndex ! = table - > Visibl eMaskByIndex) ? + 1 : 0 ;
const int channels_total = channels_for_background + ( channels_for_row * freeze_row_multiplier ) + channels_for_dummy ;
table - > DrawSplitter . Split ( table - > InnerWindow - > DrawList , channels_total ) ;
table - > DummyDrawChannel = channels_for_dummy ? ( ImS8 ) ( channels_total - 1 ) : - 1 ;
@ -568,7 +568,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
table - > ColumnsAutoFitWidth = 0.0f ;
for ( int order_n = 0 ; order_n < table - > ColumnsCount ; order_n + + )
{
if ( ! ( table - > Activ eMaskByDisplayOrder & ( ( ImU64 ) 1 < < order_n ) ) )
if ( ! ( table - > Visibl eMaskByDisplayOrder & ( ( ImU64 ) 1 < < order_n ) ) )
continue ;
const int column_n = table - > DisplayOrderToIndex [ order_n ] ;
ImGuiTableColumn * column = & table - > Columns [ column_n ] ;
@ -626,11 +626,11 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
// CellSpacingX is >0.0f when there's no vertical border, in which case we add two extra CellSpacingX to make auto-fit look nice instead of cramped.
// We may want to expose this somehow.
table - > ColumnsAutoFitWidth + = spacing_auto_x * ( table - > Columns Activ eCount - 1 ) ;
table - > ColumnsAutoFitWidth + = spacing_auto_x * ( table - > Columns Visibl eCount - 1 ) ;
// 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 - > Columns Activ eCount - 1 ) ;
const float width_spacings = table - > CellSpacingX * ( table - > Columns Visibl eCount - 1 ) ;
float width_avail ;
if ( ( table - > Flags & ImGuiTableFlags_ScrollX ) & & table - > InnerWidth = = 0.0f )
width_avail = table - > InnerClipRect . GetWidth ( ) - width_spacings - 1.0f ;
@ -645,7 +645,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
table - > ColumnsTotalWidth = width_spacings ;
for ( int order_n = 0 ; order_n < table - > ColumnsCount ; order_n + + )
{
if ( ! ( table - > Activ eMaskByDisplayOrder & ( ( ImU64 ) 1 < < order_n ) ) )
if ( ! ( table - > Visibl eMaskByDisplayOrder & ( ( ImU64 ) 1 < < order_n ) ) )
continue ;
ImGuiTableColumn * column = & table - > Columns [ table - > DisplayOrderToIndex [ order_n ] ] ;
@ -658,15 +658,15 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
// [Resize Rule 2] Resizing from right-side of a weighted column before a fixed column froward sizing
// to left-side of fixed column. We also need to copy the NoResize flag..
if ( column - > Next Activ eColumn ! = - 1 )
if ( ImGuiTableColumn * next_column = & table - > Columns [ column - > Next Activ eColumn] )
if ( column - > Next Visibl eColumn ! = - 1 )
if ( ImGuiTableColumn * next_column = & table - > Columns [ column - > Next Visibl eColumn] )
if ( next_column - > Flags & ImGuiTableColumnFlags_WidthFixed )
column - > Flags | = ( next_column - > Flags & ImGuiTableColumnFlags_NoDirectResize_ ) ;
}
// [Resize Rule 1] The right-most activ e column is not resizable if there is at least one Stretch column
// (see comments in TableResizeColumn() . )
if ( column - > Next Activ eColumn = = - 1 & & table - > LeftMostStretchedColumnDisplayOrder ! = - 1 )
// [Resize Rule 1] The right-most Visibl e column is not resizable if there is at least one Stretch column
// (see comments in TableResizeColumn() )
if ( column - > Next Visibl eColumn = = - 1 & & table - > LeftMostStretchedColumnDisplayOrder ! = - 1 )
column - > Flags | = ImGuiTableColumnFlags_NoDirectResize_ ;
if ( ! ( column - > Flags & ImGuiTableColumnFlags_NoResize ) )
@ -684,15 +684,15 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
// Shrink widths when the total does not fit
// FIXME-TABLE: This is working but confuses/conflicts with manual resizing.
// FIXME-TABLE: Policy to shrink down below below ideal/requested width if there's no room?
g . ShrinkWidthBuffer . resize ( table - > Columns Activ eCount) ;
for ( int order_n = 0 , activ e_n = 0 ; order_n < table - > ColumnsCount ; order_n + + )
g . ShrinkWidthBuffer . resize ( table - > Columns Visibl eCount) ;
for ( int order_n = 0 , visibl e_n = 0 ; order_n < table - > ColumnsCount ; order_n + + )
{
if ( ! ( table - > Activ eMaskByDisplayOrder & ( ( ImU64 ) 1 < < order_n ) ) )
if ( ! ( table - > Visibl eMaskByDisplayOrder & ( ( ImU64 ) 1 < < order_n ) ) )
continue ;
const int column_n = table - > DisplayOrder [ order_n ] ;
g . ShrinkWidthBuffer [ activ e_n] . Index = column_n ;
g . ShrinkWidthBuffer [ activ e_n] . Width = table - > Columns [ column_n ] . WidthGiven ;
activ e_n+ + ;
g . ShrinkWidthBuffer [ visibl e_n] . Index = column_n ;
g . ShrinkWidthBuffer [ visibl e_n] . Width = table - > Columns [ column_n ] . WidthGiven ;
visibl e_n+ + ;
}
ShrinkWidths ( g . ShrinkWidthBuffer . Data , g . ShrinkWidthBuffer . Size , width_excess ) ;
for ( int n = 0 ; n < g . ShrinkWidthBuffer . Size ; n + + )
@ -710,7 +710,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
if ( width_remaining_for_stretched_columns > = 1.0f )
for ( int order_n = table - > ColumnsCount - 1 ; total_weights > 0.0f & & width_remaining_for_stretched_columns > = 1.0f & & order_n > = 0 ; order_n - - )
{
if ( ! ( table - > Activ eMaskByDisplayOrder & ( ( ImU64 ) 1 < < order_n ) ) )
if ( ! ( table - > Visibl eMaskByDisplayOrder & ( ( ImU64 ) 1 < < order_n ) ) )
continue ;
ImGuiTableColumn * column = & table - > Columns [ table - > DisplayOrderToIndex [ order_n ] ] ;
if ( ! ( column - > Flags & ImGuiTableColumnFlags_WidthStretch ) )
@ -721,7 +721,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
}
// Setup final position, offset and clipping rectangles
int activ e_n = 0 ;
int visibl e_n = 0 ;
float offset_x = ( table - > FreezeColumnsCount > 0 ) ? table - > OuterRect . Min . x : work_rect . Min . x ;
ImRect host_clip_rect = table - > InnerClipRect ;
for ( int order_n = 0 ; order_n < table - > ColumnsCount ; order_n + + )
@ -729,10 +729,10 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
const int column_n = table - > DisplayOrderToIndex [ order_n ] ;
ImGuiTableColumn * column = & table - > Columns [ column_n ] ;
if ( table - > FreezeColumnsCount > 0 & & table - > FreezeColumnsCount = = activ e_n)
if ( table - > FreezeColumnsCount > 0 & & table - > FreezeColumnsCount = = visibl e_n)
offset_x + = work_rect . Min . x - table - > OuterRect . Min . x ;
if ( ! ( table - > Activ eMaskByDisplayOrder & ( ( ImU64 ) 1 < < order_n ) ) )
if ( ! ( table - > Visibl eMaskByDisplayOrder & ( ( ImU64 ) 1 < < order_n ) ) )
{
// Hidden column: clear a few fields and we are done with it for the remainder of the function.
// We set a zero-width clip rect but set Min.y/Max.y properly to not interfere with the clipper.
@ -761,7 +761,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
// sure they are all visible. Because of this we also know that all of the columns will always fit in
// table->WorkRect and therefore in table->InnerRect (because ScrollX is off)
if ( ! ( table - > Flags & ImGuiTableFlags_NoKeepColumnsVisible ) )
max_x = table - > WorkRect . Max . x - ( table - > Columns ActiveCount - ( column - > IndexWithinActiv eSet + 1 ) ) * min_column_width ;
max_x = table - > WorkRect . Max . x - ( table - > Columns VisibleCount - ( column - > IndexWithinVisibl eSet + 1 ) ) * min_column_width ;
}
if ( offset_x + column - > WidthGiven > max_x )
column - > WidthGiven = ImMax ( max_x - offset_x , min_column_width ) ;
@ -781,7 +781,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
if ( column - > IsClipped )
{
// Columns with the _WidthAlwaysAutoResize sizing policy will never be updated then.
table - > Visible MaskByIndex & = ~ ( ( ImU64 ) 1 < < column_n ) ;
table - > Visible Unclipped MaskByIndex & = ~ ( ( ImU64 ) 1 < < column_n ) ;
}
else
{
@ -810,11 +810,11 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
column - > CannotSkipItemsQueue > > = 1 ;
}
if ( activ e_n < table - > FreezeColumnsCount )
if ( visibl e_n < table - > FreezeColumnsCount )
host_clip_rect . Min . x = ImMax ( host_clip_rect . Min . x , column - > MaxX + 2.0f ) ;
offset_x + = column - > WidthGiven + table - > CellSpacingX ;
activ e_n+ + ;
visibl e_n+ + ;
}
// Clear Resizable flag if none of our column are actually resizable (either via an explicit _NoResize flag,
@ -879,7 +879,7 @@ void ImGui::TableUpdateBorders(ImGuiTable* table)
for ( int order_n = 0 ; order_n < table - > ColumnsCount ; order_n + + )
{
if ( ! ( table - > Activ eMaskByDisplayOrder & ( ( ImU64 ) 1 < < order_n ) ) )
if ( ! ( table - > Visibl eMaskByDisplayOrder & ( ( ImU64 ) 1 < < order_n ) ) )
continue ;
const int column_n = table - > DisplayOrderToIndex [ order_n ] ;
@ -1033,7 +1033,7 @@ void ImGui::EndTable()
column - > ContentWidthHeadersIdeal = ( ImS16 ) ImMax ( 0.0f , column - > ContentMaxPosHeadersIdeal - ref_x_headers ) ;
// Add an extra 1 pixel so we can see the last column vertical line if it lies on the right-most edge.
if ( table - > Activ eMaskByIndex & ( ( ImU64 ) 1 < < column_n ) )
if ( table - > Visibl eMaskByIndex & ( ( ImU64 ) 1 < < column_n ) )
max_pos_x = ImMax ( max_pos_x , column - > MaxX + 1.0f ) ;
}
@ -1094,7 +1094,7 @@ void ImGui::TableDrawBorders(ImGuiTable* table)
{
for ( int order_n = 0 ; order_n < table - > ColumnsCount ; order_n + + )
{
if ( ! ( table - > Activ eMaskByDisplayOrder & ( ( ImU64 ) 1 < < order_n ) ) )
if ( ! ( table - > Visibl eMaskByDisplayOrder & ( ( ImU64 ) 1 < < order_n ) ) )
continue ;
const int column_n = table - > DisplayOrderToIndex [ order_n ] ;
@ -1103,7 +1103,7 @@ void ImGui::TableDrawBorders(ImGuiTable* table)
const bool is_resized = ( table - > ResizedColumn = = column_n ) & & ( table - > InstanceInteracted = = table - > InstanceCurrent ) ;
const bool is_resizable = ( column - > Flags & ( ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_NoDirectResize_ ) ) = = 0 ;
bool draw_right_border = ( column - > MaxX < = table - > InnerClipRect . Max . x ) | | ( is_resized | | is_hovered ) ;
if ( column - > Next Activ eColumn = = - 1 & & ! is_resizable )
if ( column - > Next Visibl eColumn = = - 1 & & ! is_resizable )
draw_right_border = false ;
if ( draw_right_border & & column - > MaxX > column - > ClipRect . Min . x ) // FIXME-TABLE FIXME-STYLE: Assume BorderSize==1, this is problematic if we want to increase the border size..
{
@ -1166,7 +1166,7 @@ static void TableUpdateColumnsWeightFromWidth(ImGuiTable* table)
for ( int column_n = 0 ; column_n < table - > ColumnsCount ; column_n + + )
{
ImGuiTableColumn * column = & table - > Columns [ column_n ] ;
if ( ! column - > Is Activ e | | ! ( column - > Flags & ImGuiTableColumnFlags_WidthStretch ) )
if ( ! column - > Is Visibl e | | ! ( column - > Flags & ImGuiTableColumnFlags_WidthStretch ) )
continue ;
visible_weight + = column - > ResizeWeight ;
visible_width + = column - > WidthRequested ;
@ -1177,7 +1177,7 @@ static void TableUpdateColumnsWeightFromWidth(ImGuiTable* table)
for ( int column_n = 0 ; column_n < table - > ColumnsCount ; column_n + + )
{
ImGuiTableColumn * column = & table - > Columns [ column_n ] ;
if ( ! column - > Is Activ e | | ! ( column - > Flags & ImGuiTableColumnFlags_WidthStretch ) )
if ( ! column - > Is Visibl e | | ! ( column - > Flags & ImGuiTableColumnFlags_WidthStretch ) )
continue ;
column - > ResizeWeight = ( column - > WidthRequested + 0.0f ) / visible_width ;
}
@ -1201,14 +1201,14 @@ void ImGui::TableSetColumnWidth(ImGuiTable* table, ImGuiTableColumn* column_0, f
float min_width = TableGetMinColumnWidth ( ) ;
float max_width_0 = FLT_MAX ;
if ( ! ( table - > Flags & ImGuiTableFlags_ScrollX ) )
max_width_0 = ( table - > WorkRect . Max . x - column_0 - > MinX ) - ( table - > Columns ActiveCount - ( column_0 - > IndexWithinActiv eSet + 1 ) ) * min_width ;
max_width_0 = ( table - > WorkRect . Max . x - column_0 - > MinX ) - ( table - > Columns VisibleCount - ( column_0 - > IndexWithinVisibl eSet + 1 ) ) * min_width ;
column_0_width = ImClamp ( column_0_width , min_width , max_width_0 ) ;
// Compare both requested and actual given width to avoid overwriting requested width when column is stuck (minimum size, bounded)
if ( column_0 - > WidthGiven = = column_0_width | | column_0 - > WidthRequested = = column_0_width )
return ;
ImGuiTableColumn * column_1 = ( column_0 - > Next Activ eColumn ! = - 1 ) ? & table - > Columns [ column_0 - > Next Activ eColumn] : NULL ;
ImGuiTableColumn * column_1 = ( column_0 - > Next Visibl eColumn ! = - 1 ) ? & table - > Columns [ column_0 - > Next Visibl eColumn] : NULL ;
// In this surprisingly not simple because of how we support mixing Fixed and Stretch columns.
// When forwarding resize from Wn| to Fn+1| we need to be considerate of the _NoResize flag on Fn+1.
@ -1315,7 +1315,7 @@ void ImGui::TableDrawMergeChannels(ImGuiTable* table)
// 1. Scan channels and take note of those which can be merged
for ( int order_n = 0 ; order_n < table - > ColumnsCount ; order_n + + )
{
if ( ! ( table - > Activ eMaskByDisplayOrder & ( ( ImU64 ) 1 < < order_n ) ) )
if ( ! ( table - > Visibl eMaskByDisplayOrder & ( ( ImU64 ) 1 < < order_n ) ) )
continue ;
const int column_n = table - > DisplayOrderToIndex [ order_n ] ;
ImGuiTableColumn * column = & table - > Columns [ column_n ] ;
@ -1485,7 +1485,7 @@ void ImGui::TableSetupColumn(const char* label, ImGuiTableColumnFlags flags,
{
// Init default visibility/sort state
if ( ( flags & ImGuiTableColumnFlags_DefaultHide ) & & ( table - > SettingsLoadedFlags & ImGuiTableFlags_Hideable ) = = 0 )
column - > Is Active = column - > IsActiv eNextFrame = false ;
column - > Is Visible = column - > IsVisibl eNextFrame = false ;
if ( flags & ImGuiTableColumnFlags_DefaultSort & & ( table - > SettingsLoadedFlags & ImGuiTableFlags_Sortable ) = = 0 )
{
column - > SortOrder = 0 ; // Multiple columns using _DefaultSort will be reordered when building the sort specs.
@ -1692,7 +1692,7 @@ void ImGui::TableBeginCell(ImGuiTable* table, int column_n)
window - > WorkRect . Max . x = column - > MaxX - table - > CellPaddingX2 ;
// To allow ImGuiListClipper to function we propagate our row height
if ( ! column - > Is Activ e)
if ( ! column - > Is Visibl e)
window - > DC . CursorPos . y = ImMax ( window - > DC . CursorPos . y , table - > RowPosY2 ) ;
window - > SkipItems = column - > SkipItems ;
@ -1752,7 +1752,7 @@ bool ImGui::TableNextCell()
}
int column_n = table - > CurrentColumn ;
return ( table - > Visible MaskByIndex & ( ( ImU64 ) 1 < < column_n ) ) ! = 0 ;
return ( table - > Visible Unclipped MaskByIndex & ( ( ImU64 ) 1 < < column_n ) ) ! = 0 ;
}
const char * ImGui : : TableGetColumnName ( int column_n )
@ -1766,6 +1766,7 @@ const char* ImGui::TableGetColumnName(int column_n)
return TableGetColumnName ( table , column_n ) ;
}
// We expose "Visible and Unclipped" to the user, vs our internal "Visible" state which is !Hidden
bool ImGui : : TableGetColumnIsVisible ( int column_n )
{
ImGuiContext & g = * GImGui ;
@ -1774,7 +1775,7 @@ bool ImGui::TableGetColumnIsVisible(int column_n)
return false ;
if ( column_n < 0 )
column_n = table - > CurrentColumn ;
return ( table - > Visible MaskByIndex & ( ( ImU64 ) 1 < < column_n ) ) ! = 0 ;
return ( table - > Visible Unclipped MaskByIndex & ( ( ImU64 ) 1 < < column_n ) ) ! = 0 ;
}
int ImGui : : TableGetColumnIndex ( )
@ -1801,7 +1802,7 @@ bool ImGui::TableSetColumnIndex(int column_idx)
TableBeginCell ( table , column_idx ) ;
}
return ( table - > Visible MaskByIndex & ( ( ImU64 ) 1 < < column_idx ) ) ! = 0 ;
return ( table - > Visible Unclipped MaskByIndex & ( ( ImU64 ) 1 < < column_idx ) ) ! = 0 ;
}
// Return the cell rectangle based on currently known height.
@ -1876,7 +1877,7 @@ void ImGui::TableDrawContextMenu(ImGuiTable* table, int selected_column_n)
{
if ( ImGuiTableColumn * selected_column = ( selected_column_n ! = - 1 ) ? & table - > Columns [ selected_column_n ] : NULL )
{
const bool can_resize = ! ( selected_column - > Flags & ( ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_WidthStretch ) ) & & selected_column - > Is Activ e;
const bool can_resize = ! ( selected_column - > Flags & ( ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_WidthStretch ) ) & & selected_column - > Is Visibl e;
if ( MenuItem ( " Size column to fit " , NULL , false , can_resize ) )
TableSetColumnAutofit ( table , selected_column_n ) ;
}
@ -1886,7 +1887,7 @@ void ImGui::TableDrawContextMenu(ImGuiTable* table, int selected_column_n)
for ( int column_n = 0 ; column_n < table - > ColumnsCount ; column_n + + )
{
ImGuiTableColumn * column = & table - > Columns [ column_n ] ;
if ( column - > Is Activ e)
if ( column - > Is Visibl e)
TableSetColumnAutofit ( table , column_n ) ;
}
}
@ -1918,10 +1919,10 @@ void ImGui::TableDrawContextMenu(ImGuiTable* table, int selected_column_n)
// Make sure we can't hide the last active column
bool menu_item_active = ( column - > Flags & ImGuiTableColumnFlags_NoHide ) ? false : true ;
if ( column - > Is Active & & table - > ColumnsActiv eCount < = 1 )
if ( column - > Is Visible & & table - > ColumnsVisibl eCount < = 1 )
menu_item_active = false ;
if ( MenuItem ( name , NULL , column - > Is Activ e, menu_item_active ) )
column - > Is ActiveNextFrame = ! column - > IsActiv e;
if ( MenuItem ( name , NULL , column - > Is Visibl e, menu_item_active ) )
column - > Is VisibleNextFrame = ! column - > IsVisibl e;
}
PopItemFlag ( ) ;
}
@ -1995,8 +1996,8 @@ void ImGui::TableAutoHeaders()
// FIXME-TABLE: This is not user-land code any more... perhaps instead we should expose hovered column.
// and allow some sort of row-centric IsItemHovered() for full flexibility?
float unused_x1 = table - > WorkRect . Min . x ;
if ( table - > RightMost Activ eColumn ! = - 1 )
unused_x1 = ImMax ( unused_x1 , table - > Columns [ table - > RightMost Activ eColumn] . MaxX ) ;
if ( table - > RightMost Visibl eColumn ! = - 1 )
unused_x1 = ImMax ( unused_x1 , table - > Columns [ table - > RightMost Visibl eColumn] . MaxX ) ;
if ( unused_x1 < table - > WorkRect . Max . x )
{
// FIXME: We inherit ClipRect/SkipItem from last submitted column (active or not), let's temporarily override it.
@ -2091,14 +2092,14 @@ void ImGui::TableHeader(const char* label)
// We don't reorder: through the frozen<>unfrozen line, or through a column that is marked with ImGuiTableColumnFlags_NoReorder.
if ( g . IO . MouseDelta . x < 0.0f & & g . IO . MousePos . x < cell_r . Min . x )
if ( ImGuiTableColumn * prev_column = ( column - > Prev Activ eColumn ! = - 1 ) ? & table - > Columns [ column - > Prev Activ eColumn] : NULL )
if ( ImGuiTableColumn * prev_column = ( column - > Prev Visibl eColumn ! = - 1 ) ? & table - > Columns [ column - > Prev Visibl eColumn] : NULL )
if ( ! ( ( column - > Flags | prev_column - > Flags ) & ImGuiTableColumnFlags_NoReorder ) )
if ( ( column - > IndexWithin Activ eSet < table - > FreezeColumnsRequest ) = = ( prev_column - > IndexWithin Activ eSet < table - > FreezeColumnsRequest ) )
if ( ( column - > IndexWithin Visibl eSet < table - > FreezeColumnsRequest ) = = ( prev_column - > IndexWithin Visibl eSet < table - > FreezeColumnsRequest ) )
table - > ReorderColumnDir = - 1 ;
if ( g . IO . MouseDelta . x > 0.0f & & g . IO . MousePos . x > cell_r . Max . x )
if ( ImGuiTableColumn * next_column = ( column - > Next Activ eColumn ! = - 1 ) ? & table - > Columns [ column - > Next Activ eColumn] : NULL )
if ( ImGuiTableColumn * next_column = ( column - > Next Visibl eColumn ! = - 1 ) ? & table - > Columns [ column - > Next Visibl eColumn] : NULL )
if ( ! ( ( column - > Flags | next_column - > Flags ) & ImGuiTableColumnFlags_NoReorder ) )
if ( ( column - > IndexWithin Activ eSet < table - > FreezeColumnsRequest ) = = ( next_column - > IndexWithin Activ eSet < table - > FreezeColumnsRequest ) )
if ( ( column - > IndexWithin Visibl eSet < table - > FreezeColumnsRequest ) = = ( next_column - > IndexWithin Visibl eSet < table - > FreezeColumnsRequest ) )
table - > ReorderColumnDir = + 1 ;
}
@ -2257,7 +2258,7 @@ void ImGui::TableSortSpecsSanitize(ImGuiTable* table)
for ( int column_n = 0 ; column_n < table - > ColumnsCount ; column_n + + )
{
ImGuiTableColumn * column = & table - > Columns [ column_n ] ;
if ( column - > SortOrder ! = - 1 & & ! column - > Is Activ e)
if ( column - > SortOrder ! = - 1 & & ! column - > Is Visibl e)
column - > SortOrder = - 1 ;
if ( column - > SortOrder = = - 1 )
continue ;
@ -2300,7 +2301,7 @@ void ImGui::TableSortSpecsSanitize(ImGuiTable* table)
for ( int column_n = 0 ; column_n < table - > ColumnsCount ; column_n + + )
{
ImGuiTableColumn * column = & table - > Columns [ column_n ] ;
if ( ! ( column - > Flags & ImGuiTableColumnFlags_NoSort ) & & column - > Is Activ e)
if ( ! ( column - > Flags & ImGuiTableColumnFlags_NoSort ) & & column - > Is Visibl e)
{
sort_order_count = 1 ;
column - > SortOrder = 0 ;
@ -2398,7 +2399,7 @@ void ImGui::TableSaveSettings(ImGuiTable* table)
column_settings - > DisplayOrder = column - > DisplayOrder ;
column_settings - > SortOrder = column - > SortOrder ;
column_settings - > SortDirection = column - > SortDirection ;
column_settings - > Visible = column - > Is Activ e;
column_settings - > Visible = column - > Is Visibl e;
// We skip saving some data in the .ini file when they are unnecessary to restore our state
// FIXME-TABLE: We don't have logic to easily compare SortOrder to DefaultSortOrder yet so it's always saved when present.
@ -2450,7 +2451,7 @@ void ImGui::TableLoadSettings(ImGuiTable* table)
column - > DisplayOrder = column_settings - > DisplayOrder ;
else
column - > DisplayOrder = ( ImS8 ) column_n ;
column - > Is Active = column - > IsActiv eNextFrame = column_settings - > Visible ;
column - > Is Visible = column - > IsVisibl eNextFrame = column_settings - > Visible ;
column - > SortOrder = column_settings - > SortOrder ;
column - > SortDirection = column_settings - > SortDirection ;
}
@ -2592,13 +2593,13 @@ void ImGui::DebugNodeTable(ImGuiTable* table)
ImGuiTableColumn * column = & table - > Columns [ n ] ;
const char * name = TableGetColumnName ( table , n ) ;
BulletText ( " Column %d order %d name '%s': +%.1f to +%.1f \n "
" Activ e: %d, Clipped: %d, DrawChannels: %d,%d\n "
" Visibl e: %d, Clipped: %d, DrawChannels: %d,%d\n "
" WidthGiven/Requested: %.1f/%.1f, Weight: %.2f \n "
" ContentWidth: RowsFrozen %d, RowsUnfrozen %d, HeadersUsed/Ideal %d/%d \n "
" SortOrder: %d, SortDir: %s \n "
" UserID: 0x%08X, Flags: 0x%04X: %s%s%s%s.. " ,
n , column - > DisplayOrder , name ? name : " NULL " , column - > MinX - table - > WorkRect . Min . x , column - > MaxX - table - > WorkRect . Min . x ,
column - > Is Activ e, column - > IsClipped , column - > DrawChannelRowsBeforeFreeze , column - > DrawChannelRowsAfterFreeze ,
column - > Is Visibl e, column - > IsClipped , column - > DrawChannelRowsBeforeFreeze , column - > DrawChannelRowsAfterFreeze ,
column - > WidthGiven , column - > WidthRequested , column - > ResizeWeight ,
column - > ContentWidthRowsFrozen , column - > ContentWidthRowsUnfrozen , column - > ContentWidthHeadersUsed , column - > ContentWidthHeadersIdeal ,
column - > SortOrder , ( column - > SortDirection = = ImGuiSortDirection_Ascending ) ? " Ascending " : ( column - > SortDirection = = ImGuiSortDirection_Descending ) ? " Descending " : " None " ,