mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-27 02:20:05 +00:00
Accessibility: Throttle TreeView/ListBox Viewport move AccessibilityEvent::structureChanged notifications
This commit is contained in:
parent
521faf2dc6
commit
e2aa2a2048
2 changed files with 23 additions and 7 deletions
|
|
@ -274,7 +274,8 @@ public:
|
|||
|
||||
|
||||
//==============================================================================
|
||||
class ListBox::ListViewport : public Viewport
|
||||
class ListBox::ListViewport : public Viewport,
|
||||
private Timer
|
||||
{
|
||||
public:
|
||||
ListViewport (ListBox& lb) : owner (lb)
|
||||
|
|
@ -319,8 +320,7 @@ public:
|
|||
if (auto* m = owner.getModel())
|
||||
m->listWasScrolled();
|
||||
|
||||
if (auto* handler = owner.getAccessibilityHandler())
|
||||
handler->notifyAccessibilityEvent (AccessibilityEvent::structureChanged);
|
||||
startTimer (50);
|
||||
}
|
||||
|
||||
void updateVisibleArea (const bool makeSureItUpdatesContent)
|
||||
|
|
@ -456,6 +456,14 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
void timerCallback() override
|
||||
{
|
||||
stopTimer();
|
||||
|
||||
if (auto* handler = owner.getAccessibilityHandler())
|
||||
handler->notifyAccessibilityEvent (AccessibilityEvent::structureChanged);
|
||||
}
|
||||
|
||||
ListBox& owner;
|
||||
OwnedArray<RowComponent> rows;
|
||||
int firstIndex = 0, firstWholeIndex = 0, lastWholeIndex = 0;
|
||||
|
|
|
|||
|
|
@ -621,7 +621,8 @@ private:
|
|||
};
|
||||
|
||||
//==============================================================================
|
||||
class TreeView::TreeViewport : public Viewport
|
||||
class TreeView::TreeViewport : public Viewport,
|
||||
private Timer
|
||||
{
|
||||
public:
|
||||
TreeViewport() = default;
|
||||
|
|
@ -645,9 +646,7 @@ public:
|
|||
lastX = newVisibleArea.getX();
|
||||
updateComponents (hasScrolledSideways);
|
||||
|
||||
if (auto* tree = getParentComponent())
|
||||
if (auto* handler = tree->getAccessibilityHandler())
|
||||
handler->notifyAccessibilityEvent (AccessibilityEvent::structureChanged);
|
||||
startTimer (50);
|
||||
}
|
||||
|
||||
ContentComponent* getContentComp() const noexcept
|
||||
|
|
@ -665,6 +664,15 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
void timerCallback() override
|
||||
{
|
||||
stopTimer();
|
||||
|
||||
if (auto* tree = getParentComponent())
|
||||
if (auto* handler = tree->getAccessibilityHandler())
|
||||
handler->notifyAccessibilityEvent (AccessibilityEvent::structureChanged);
|
||||
}
|
||||
|
||||
int lastX = -1;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TreeViewport)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue