ImGuiStorage_Storage;// [Internal] Selection set. Think of this as similar to e.g. std::set<ImGuiID>. Prefer not accessing directly: iterate with GetNextSelectedItem().
intSize;// Number of selected items (== number of 1 in the Storage), maintained by this helper.
intSize;// Number of selected items, maintained by this helper.
void*UserData;// User data for use by adapter function // e.g. selection.UserData = (void*)my_items;
ImGuiID(*AdapterIndexToStorageId)(ImGuiSelectionBasicStorage*self,intidx);// e.g. selection.AdapterIndexToStorageId = [](ImGuiSelectionBasicStorage* self, int idx) { return ((MyItems**)self->UserData)[idx]->ID; };
storage->BuildSortByKey();// When done selecting: sort everything
else
ImGuiSelectionBasicStorage_Compact(selection);// When done unselecting: compact by removing all zero values (might be done lazily when iterating selection?)
IM_ASSERT(selection->Size==storage->Data.Size);
}
// Apply requests coming from BeginMultiSelect() and EndMultiSelect().
// - Enable 'Demo->Tools->Debug Log->Selection' to see selection requests as they happen.
// - Honoring SetRange requests requires that you can iterate/interpolate between RangeFirstItem and RangeLastItem.
IM_ASSERT(ms_io->ItemsCount!=-1&&"Missing value for items_count in BeginMultiSelect() call!");
IM_ASSERT(AdapterIndexToStorageId!=NULL);
// This is optimized/specialized to cope nicely with very large selections (e.g. 1 million items)
// - A simpler version could call SetItemSelected() directly instead of ImGuiSelectionBasicStorage_BatchSetItemSelected() + ImGuiSelectionBasicStorage_BatchFinish().
// - Optimized select can append unsorted, then sort in a second pass. Optimized unselect can clear in-place then compact in a second pass.
// - (A more optimal version wouldn't even use ImGuiStorage but directly a ImVector<ImGuiID> to reduce bandwidth, but this is a reasonable trade off to reuse code)