Tables: Fix scrolling with more than 32 columns (3058). Fix limit of 63 columms instead of 64. Added BitArray.

This commit is contained in:
ocornut
2020-03-13 18:58:55 +01:00
parent d37cef40f2
commit 054c67079a
2 changed files with 38 additions and 18 deletions

View File

@ -476,6 +476,20 @@ inline void ImBitArraySetBitRange(ImU32* arr, int n, int n2)
}
}
// Helper: ImBitArray class (wrapper over ImBitArray functions)
// Store 1-bit per value. NOT CLEARED by constructor.
template<int BITCOUNT>
struct IMGUI_API ImBitArray
{
ImU32 Storage[(BITCOUNT + 31) >> 5];
ImBitArray() { }
void ClearBits() { memset(Storage, 0, sizeof(Storage)); }
bool TestBit(int n) const { IM_ASSERT(n < BITCOUNT); return ImBitArrayTestBit(Storage, n); }
void SetBit(int n) { IM_ASSERT(n < BITCOUNT); ImBitArraySetBit(Storage, n); }
void ClearBit(int n) { IM_ASSERT(n < BITCOUNT); ImBitArrayClearBit(Storage, n); }
void SetBitRange(int n1, int n2) { ImBitArraySetBitRange(Storage, n1, n2); }
};
// Helper: ImBitVector
// Store 1-bit per value.
struct IMGUI_API ImBitVector
@ -1820,8 +1834,9 @@ struct ImGuiTabBar
#ifdef IMGUI_HAS_TABLE
#define IM_COL32_DISABLE IM_COL32(0,0,0,1) // Special sentinel code
#define IMGUI_TABLE_MAX_COLUMNS 64 // sizeof(ImU64) * 8. This is solely because we frequently encode columns set in a ImU64.
#define IM_COL32_DISABLE IM_COL32(0,0,0,1) // Special sentinel code
#define IMGUI_TABLE_MAX_COLUMNS 64 // sizeof(ImU64) * 8. This is solely because we frequently encode columns set in a ImU64.
#define IMGUI_TABLE_MAX_DRAW_CHANNELS (2 + 64 * 2) // See TableUpdateDrawChannels()
// [Internal] sizeof() ~ 100
struct ImGuiTableColumn