#define IMGUI_HAS_MULTI_SELECT // Multi-Select/Range-Select WIP branch // <-- This is currently _not_ in the top of imgui.h to prevent merge conflicts.
// Flags for BeginMultiSelect().
// This system is designed to allow mouse/keyboard multi-selection, including support for range-selection (SHIFT + click) which is difficult to re-implement manually.
// If you disable multi-selection with ImGuiMultiSelectFlags_NoMultiSelect (which is provided for consistency and flexibility), the whole BeginMultiSelect() system
// becomes largely overkill as you can handle single-selection in a simpler manner by just calling Selectable() and reacting on clicks yourself.
// This system is designed to allow mouse/keyboard multi-selection, including support for range-selection (SHIFT + click),
// which is difficult to re-implement manually. If you disable multi-selection with ImGuiMultiSelectFlags_NoMultiSelect
// (which is provided for consistency and flexibility), the whole BeginMultiSelect() system becomes largely overkill as
// you can handle single-selection in a simpler manner by just calling Selectable() and reacting on clicks yourself.
enumImGuiMultiSelectFlags_
{
ImGuiMultiSelectFlags_None=0,
ImGuiMultiSelectFlags_NoMultiSelect=1<<0,
ImGuiMultiSelectFlags_NoUnselect=1<<1,// Disable unselecting items with CTRL+Click, CTRL+Space etc.
ImGuiMultiSelectFlags_NoSelectAll=1<<2,// Disable CTRL+A shortcut to set RequestSelectAll
voidSelectAll(intcount){Storage.Data.resize(count);for(intn=0;n<count;n++)Storage.Data[n]=ImGuiStoragePair((ImGuiID)n,1);SelectedCount=count;}// This could be using SetRange() but this is faster.
// Demonstrate holding/updating multi-selection data and using the BeginMultiSelect/EndMultiSelect API to support range-selection and clipping.
// In this demo we use ImGuiStorage (simple key->value storage) to avoid external dependencies but it's probably not optimal.
// In your real code you could use e.g std::unordered_set<> or your own data structure for storing selection.
// If you don't mind being limited to one view over your objects, the simplest way is to use an intrusive selection (e.g. store bool inside object, as used in examples above).
// Otherwise external set/hash/map/interval trees (storing indices, etc.) may be appropriate.