1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-09-23 19:18:34 +02:00

MultiSelect: Cleanup unused comments/code.

This commit is contained in:
ocornut 2023-06-08 15:01:10 +02:00
parent ab9326f4ae
commit 0cf376348b
3 changed files with 2 additions and 12 deletions

View File

@ -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.

View File

@ -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<typename ITEM_TYPE>
int ApplyDeletionPreLoop(ImGuiMultiSelectIO* ms_io, ImVector<ITEM_TYPE>& 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);

View File

@ -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)