mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-16 00:54:19 +00:00
MultiSelect: added ImGuiSelectionExternalStorage helper. Simplify bool demo.
This commit is contained in:
parent
f9caf4447a
commit
db4898cb91
3 changed files with 39 additions and 22 deletions
|
|
@ -7854,6 +7854,22 @@ void ImGuiSelectionBasicStorage::ApplyRequests(ImGuiMultiSelectIO* ms_io)
|
|||
}
|
||||
}
|
||||
|
||||
// Apply requests coming from BeginMultiSelect() and EndMultiSelect().
|
||||
// We also pull 'ms_io->ItemsCount' as passed for BeginMultiSelect() for consistency with ImGuiSelectionBasicStorage
|
||||
// This makes no assumption about underlying storage.
|
||||
void ImGuiSelectionExternalStorage::ApplyRequests(ImGuiMultiSelectIO* ms_io)
|
||||
{
|
||||
IM_ASSERT(AdapterSetItemSelected);
|
||||
for (ImGuiSelectionRequest& req : ms_io->Requests)
|
||||
{
|
||||
if (req.Type == ImGuiSelectionRequestType_SetAll)
|
||||
for (int idx = 0; idx < ms_io->ItemsCount; idx++)
|
||||
AdapterSetItemSelected(this, idx, req.Selected);
|
||||
if (req.Type == ImGuiSelectionRequestType_SetRange)
|
||||
for (int idx = (int)req.RangeFirstItem; idx <= (int)req.RangeLastItem; idx++)
|
||||
AdapterSetItemSelected(this, idx, req.Selected);
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// [SECTION] Widgets: ListBox
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue