Skip to content

Commit 79c9eaa

Browse files
committed
Tables: Internals: renamed Visible to Enabled to avoid confusion with visibility checks.
1 parent 5ef7b83 commit 79c9eaa

File tree

2 files changed

+100
-101
lines changed

2 files changed

+100
-101
lines changed

imgui_internal.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,15 +1917,15 @@ struct ImGuiTableColumn
19171917
float ContentMaxXHeadersUsed; // Contents maximum position for headers rows (regardless of freezing). TableHeader() automatically softclip itself + report ideal desired size, to avoid creating extraneous draw calls
19181918
float ContentMaxXHeadersIdeal;
19191919
ImS16 NameOffset; // Offset into parent ColumnsNames[]
1920-
bool IsVisible; // Is the column not marked Hidden by the user? (even if off view, e.g. clipped by scrolling).
1921-
bool IsVisibleNextFrame;
1920+
bool IsEnabled; // Is the column not marked Hidden by the user? (even if off view, e.g. clipped by scrolling).
1921+
bool IsEnabledNextFrame;
19221922
bool IsClipped; // Is not actually in view (e.g. not overlapping the host window clipping rectangle).
19231923
bool IsSkipItems; // Do we want item submissions to this column to be ignored early on.
19241924
ImS8 NavLayerCurrent; // ImGuiNavLayer in 1 byte
19251925
ImS8 DisplayOrder; // Index within Table's IndexToDisplayOrder[] (column may be reordered by users)
1926-
ImS8 IndexWithinVisibleSet; // Index within visible set (<= IndexToDisplayOrder)
1927-
ImS8 PrevVisibleColumn; // Index of prev visible column within Columns[], -1 if first visible column
1928-
ImS8 NextVisibleColumn; // Index of next visible column within Columns[], -1 if last visible column
1926+
ImS8 IndexWithinEnabledSet; // Index within enabled/visible set (<= IndexToDisplayOrder)
1927+
ImS8 PrevEnabledColumn; // Index of prev enabled/visible column within Columns[], -1 if first enabled/visible column
1928+
ImS8 NextEnabledColumn; // Index of next enabled/visible column within Columns[], -1 if last enabled/visible column
19291929
ImS8 SortOrder; // Index of this column within sort specs, -1 if not sorting on this column, 0 for single-sort, may be >0 on multi-sort
19301930
ImS8 SortDirection; // ImGuiSortDirection_Ascending or ImGuiSortDirection_Descending
19311931
ImU8 AutoFitQueue; // Queue of 8 values for the next 8 frames to request auto-fit
@@ -1939,9 +1939,9 @@ struct ImGuiTableColumn
19391939
memset(this, 0, sizeof(*this));
19401940
StretchWeight = WidthRequest = -1.0f;
19411941
NameOffset = -1;
1942-
IsVisible = IsVisibleNextFrame = true;
1943-
DisplayOrder = IndexWithinVisibleSet = -1;
1944-
PrevVisibleColumn = NextVisibleColumn = -1;
1942+
IsEnabled = IsEnabledNextFrame = true;
1943+
DisplayOrder = IndexWithinEnabledSet = -1;
1944+
PrevEnabledColumn = NextEnabledColumn = -1;
19451945
SortOrder = -1;
19461946
SortDirection = ImGuiSortDirection_None;
19471947
DrawChannelCurrent = DrawChannelFrozen = DrawChannelUnfrozen = (ImU8)-1;
@@ -1964,9 +1964,9 @@ struct ImGuiTable
19641964
ImSpan<ImGuiTableColumn> Columns; // Point within RawData[]
19651965
ImSpan<ImS8> DisplayOrderToIndex; // Point within RawData[]. Store display order of columns (when not reordered, the values are 0...Count-1)
19661966
ImSpan<ImGuiTableCellData> RowCellData; // Point within RawData[]. Store cells background requests for current row.
1967-
ImU64 VisibleMaskByIndex; // Column Index -> IsVisible map (== not hidden by user/api) in a format adequate for iterating column without touching cold data
1968-
ImU64 VisibleMaskByDisplayOrder; // Column DisplayOrder -> IsVisible map
1969-
ImU64 VisibleUnclippedMaskByIndex;// Visible and not Clipped, aka "actually visible" "not hidden by some scrolling"
1967+
ImU64 EnabledMaskByIndex; // Column Index -> IsEnabled map (== not hidden by user/api) in a format adequate for iterating column without touching cold data
1968+
ImU64 EnabledMaskByDisplayOrder; // Column DisplayOrder -> IsEnabled map
1969+
ImU64 EnabledUnclippedMaskByIndex;// Enabled and not Clipped, aka "actually visible" "not hidden by some scrolling"
19701970
ImGuiTableFlags SettingsLoadedFlags; // Which data were loaded from the .ini file (e.g. when order is not altered we won't save order)
19711971
int SettingsOffset; // Offset in g.SettingsTables
19721972
int LastFrameActive;
@@ -2021,8 +2021,8 @@ struct ImGuiTable
20212021
ImVector<ImGuiTableSortSpecsColumn> SortSpecsData; // FIXME-OPT: Fixed-size array / small-vector pattern, optimize for single sort spec
20222022
ImGuiTableSortSpecs SortSpecs; // Public facing sorts specs, this is what we return in TableGetSortSpecs()
20232023
ImS8 SortSpecsCount;
2024-
ImS8 ColumnsVisibleCount; // Number of non-hidden columns (<= ColumnsCount)
2025-
ImS8 ColumnsVisibleFixedCount; // Number of non-hidden columns (<= ColumnsCount)
2024+
ImS8 ColumnsEnabledCount; // Number of enabled columns (<= ColumnsCount)
2025+
ImS8 ColumnsEnabledFixedCount; // Number of enabled columns (<= ColumnsCount)
20262026
ImS8 DeclColumnsCount; // Count calls to TableSetupColumn()
20272027
ImS8 HoveredColumnBody; // Index of column whose visible region is being hovered. Important: == ColumnsCount when hovering empty region after the right-most column!
20282028
ImS8 HoveredColumnBorder; // Index of column whose right-border is being hovered (for resizing).
@@ -2032,7 +2032,7 @@ struct ImGuiTable
20322032
ImS8 HeldHeaderColumn; // Index of column header being held.
20332033
ImS8 ReorderColumn; // Index of column being reordered. (not cleared)
20342034
ImS8 ReorderColumnDir; // -1 or +1
2035-
ImS8 RightMostVisibleColumn; // Index of right-most non-hidden column.
2035+
ImS8 RightMostEnabledColumn; // Index of right-most non-hidden column.
20362036
ImS8 LeftMostStretchedColumnDisplayOrder; // Display order of left-most stretched column.
20372037
ImS8 ContextPopupColumn; // Column right-clicked on, of -1 if opening context menu from a neutral/empty spot
20382038
ImS8 FreezeRowsRequest; // Requested frozen rows count
@@ -2070,7 +2070,7 @@ struct ImGuiTableColumnSettings
20702070
ImS8 DisplayOrder;
20712071
ImS8 SortOrder;
20722072
ImU8 SortDirection : 2;
2073-
ImU8 IsVisible : 1;
2073+
ImU8 IsEnabled : 1; // "Visible" in ini file
20742074
ImU8 IsStretch : 1;
20752075

20762076
ImGuiTableColumnSettings()
@@ -2080,7 +2080,7 @@ struct ImGuiTableColumnSettings
20802080
Index = -1;
20812081
DisplayOrder = SortOrder = -1;
20822082
SortDirection = ImGuiSortDirection_None;
2083-
IsVisible = 1;
2083+
IsEnabled = 1;
20842084
IsStretch = 0;
20852085
}
20862086
};
@@ -2273,8 +2273,8 @@ namespace ImGui
22732273
// Tables: Candidates for public api
22742274
IMGUI_API void TableOpenContextMenu(int column_n = -1);
22752275
IMGUI_API void TableSetColumnWidth(int column_n, float width);
2276-
IMGUI_API bool TableGetColumnIsHidden(int column_n);
2277-
IMGUI_API void TableSetColumnIsHidden(int column_n, bool hidden);
2276+
IMGUI_API bool TableGetColumnIsEnabled(int column_n = -1); // Return false when column is disabled (hidden) by user (e.g. via context menu, or _DefaultHide flag)
2277+
IMGUI_API void TableSetColumnIsEnabled(int column_n, bool enabled);
22782278
IMGUI_API void TableSetColumnSortDirection(int column_n, ImGuiSortDirection sort_direction, bool append_to_sort_specs);
22792279
IMGUI_API void TablePushBackgroundChannel();
22802280
IMGUI_API void TablePopBackgroundChannel();

0 commit comments

Comments
 (0)