From 8dfb916e9a112b2277b4a06e270c357cc5ca7803 Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 25 May 2021 16:43:22 +0100 Subject: [PATCH] ListBox: Send AccessibilityEvent::rowSelectionChanged events --- .../juce_gui_basics/widgets/juce_ListBox.cpp | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/modules/juce_gui_basics/widgets/juce_ListBox.cpp b/modules/juce_gui_basics/widgets/juce_ListBox.cpp index e1ab899943..17d565b9c6 100644 --- a/modules/juce_gui_basics/widgets/juce_ListBox.cpp +++ b/modules/juce_gui_basics/widgets/juce_ListBox.cpp @@ -594,8 +594,14 @@ void ListBox::updateContent() viewport->updateVisibleArea (isVisible()); viewport->resized(); - if (selectionChanged && model != nullptr) - model->selectedRowsChanged (lastRowSelected); + if (selectionChanged) + { + if (model != nullptr) + model->selectedRowsChanged (lastRowSelected); + + if (auto* handler = getAccessibilityHandler()) + handler->notifyAccessibilityEvent (AccessibilityEvent::rowSelectionChanged); + } } //============================================================================== @@ -630,6 +636,9 @@ void ListBox::selectRowInternal (const int row, lastRowSelected = row; model->selectedRowsChanged (row); + + if (auto* handler = getAccessibilityHandler()) + handler->notifyAccessibilityEvent (AccessibilityEvent::rowSelectionChanged); } else { @@ -650,6 +659,9 @@ void ListBox::deselectRow (const int row) viewport->updateContents(); model->selectedRowsChanged (lastRowSelected); + + if (auto* handler = getAccessibilityHandler()) + handler->notifyAccessibilityEvent (AccessibilityEvent::rowSelectionChanged); } } @@ -666,6 +678,9 @@ void ListBox::setSelectedRows (const SparseSet& setOfRowsToBeSelected, if (model != nullptr && sendNotificationEventToModel == sendNotification) model->selectedRowsChanged (lastRowSelected); + + if (auto* handler = getAccessibilityHandler()) + handler->notifyAccessibilityEvent (AccessibilityEvent::rowSelectionChanged); } SparseSet ListBox::getSelectedRows() const @@ -709,6 +724,9 @@ void ListBox::deselectAllRows() if (model != nullptr) model->selectedRowsChanged (lastRowSelected); + + if (auto* handler = getAccessibilityHandler()) + handler->notifyAccessibilityEvent (AccessibilityEvent::rowSelectionChanged); } }