1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-09 23:54:20 +00:00

MultiSelect: Comments, tweaks.

+ Alignment to reduce noise on next commit.
This commit is contained in:
ocornut 2023-08-07 12:34:20 +02:00
parent 847b1dde8c
commit 140a2f0565
3 changed files with 44 additions and 39 deletions

View file

@ -2796,7 +2796,8 @@ struct ExampleSelection
void SetRange(int a, int b, bool v) { if (b < a) { int tmp = b; b = a; a = tmp; } for (int n = a; n <= b; n++) SetSelected(n, v); }
void SelectAll(int count) { Storage.Data.resize(count); for (int idx = 0; idx < count; idx++) Storage.Data[idx] = ImGuiStoragePair((ImGuiID)idx, 1); SelectionSize = count; } // This could be using SetRange(), but it this way is faster.
// Apply requests coming from BeginMultiSelect() and EndMultiSelect(). Must be done in this order! Order->SelectAll->SetRange.
// Apply requests coming from BeginMultiSelect() and EndMultiSelect(). Must be done in this order! Clear->SelectAll->SetRange.
// Enable 'Debug Log->Selection' to see selection requests as they happen.
void ApplyRequests(ImGuiMultiSelectIO* ms_io, int items_count)
{
if (ms_io->RequestClear) { Clear(); }
@ -2934,6 +2935,8 @@ static void ShowDemoWindowMultiSelect()
{
static ExampleSelection selection;
ImGui::Text("Tips: Use 'Debug Log->Selection' to see selection requests as they happen.");
ImGui::Text("Supported features:");
ImGui::BulletText("Keyboard navigation (arrows, page up/down, home/end, space).");
ImGui::BulletText("Ctrl modifier to preserve and toggle selection.");