diff --git a/imgui.h b/imgui.h index 98e6c2b34..1ac315d70 100644 --- a/imgui.h +++ b/imgui.h @@ -2777,7 +2777,7 @@ struct ImGuiMultiSelectIO bool RequestClear; // ms:w, app:r / / ms:w, app:r // 1. Request app/user to clear selection. bool RequestSelectAll; // ms:w, app:r / / ms:w, app:r // 2. Request app/user to select all. bool RequestSetRange; // / / ms:w, app:r // 3. Request app/user to select/unselect [RangeSrcItem..RangeDstItem] items, based on RangeSelected. In practice, only EndMultiSelect() request this, app code can read after BeginMultiSelect() and it will always be false. - void* RequestFocusItem; // app:w / app:r / app:r // (If using deletion) 4. Request user to focus item. This is actually only manipulated in user-space, but we provide storage to facilitate implemention of deletion idiom (see demo). + void* RequestFocusItem; // app:w / app:r / app:r // (If using deletion) 4. Request user to focus item. This is actually only manipulated in user-space, but we provide storage to facilitate implementing a deletion idiom (see demo). // STATE/ARGUMENTS ---------// BEGIN / LOOP / END void* RangeSrcItem; // ms:w / app:r / ms:w, app:r // Begin: Last known SetNextItemSelectionUserData() value for RangeSrcItem. End: parameter from RequestSetRange request. void* RangeDstItem; // / / ms:w, app:r // End: parameter from RequestSetRange request. diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 76255107c..27aa35694 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -2818,7 +2818,7 @@ struct ExampleSelection // Call after BeginMultiSelect(). // - Calculate and set ms_io->RequestFocusItem, which we will focus during the loop. // - We cannot provide this logic in core Dear ImGui because we don't have access to selection data. - // - Essentially this would be a ms_io->RequestNextFocusBeforeDeletion + // - Return value is stored into 'ms_io->RequestFocusItem' which is provided as a convenience for this idiom (but not used by core imgui) // - Important: This only works if the item ID are stable: aka not depend on their index, but on e.g. item id/ptr. template int ApplyDeletionPreLoop(ImGuiMultiSelectIO* ms_io, ImVector& items) @@ -3132,7 +3132,6 @@ static void ShowDemoWindowMultiSelect() // FIXME-MULTISELECT: Shortcut(). Hard to demo this? May be helpful to send a helper/optional "delete" signal. // FIXME-MULTISELECT: may turn into 'ms_io->RequestDelete' -> need HasSelection passed. - // FIXME-MULTISELECT: Test with intermediary modal dialog. const bool want_delete = selection.QueueDeletion || ((selection.GetSize() > 0) && ImGui::IsWindowFocused() && ImGui::IsKeyPressed(ImGuiKey_Delete)); if (want_delete) selection.ApplyDeletionPreLoop(ms_io, items); diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 712e709d5..8ffbd27c3 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -7158,7 +7158,6 @@ ImGuiMultiSelectIO* ImGui::BeginMultiSelect(ImGuiMultiSelectFlags flags) storage->Window = window; ms->Storage = storage; - // FIXME-MULTISELECT: Set for the purpose of user calling RangeSrcPassedBy // FIXME-MULTISELECT: Index vs Pointers. // We want EndIO's NavIdItem/NavIdSelected to match BeginIO's one, so the value never changes after EndMultiSelect() ms->BeginIO.RangeSrcItem = ms->EndIO.RangeSrcItem = storage->RangeSrcItem; @@ -7168,14 +7167,6 @@ ImGuiMultiSelectIO* ImGui::BeginMultiSelect(ImGuiMultiSelectFlags flags) if (!ms->IsFocused) return &ms->BeginIO; // This is cleared at this point. - /* - if ((flags & ImGuiMultiSelectFlags_NoMultiSelect) == 0) - { - ms->BeginIO.RangeSrcItem = ms->EndIO.RangeSrcItem = range_ref; - ms->BeginIO.RangeSelected = ms->EndIO.RangeSelected = range_ref_is_selected; - } - */ - // Auto clear when using Navigation to move within the selection // (we compare FocusScopeId so it possible to use multiple selections inside a same window) if (g.NavJustMovedToId != 0 && g.NavJustMovedToFocusScopeId == ms->FocusScopeId && g.NavJustMovedToHasSelectionData)