1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

iOS Accessibility: Allow navigating tables by rows

This commit is contained in:
reuk 2022-01-31 16:56:00 +00:00
parent 793f1bf2ee
commit 53600d2d9e
2 changed files with 13 additions and 1 deletions

View file

@ -438,7 +438,7 @@ private:
static id getAccessibilityDataTableCellElementForRowColumn (id self, SEL, NSUInteger row, NSUInteger column)
{
if (auto* tableInterface = getTableInterface (self))
if (auto* tableInterface = getEnclosingInterface (getHandler (self), &AccessibilityHandler::getTableInterface))
if (auto* cellHandler = tableInterface->getCellHandler ((int) row, (int) column))
return (id) cellHandler->getNativeImplementation();

View file

@ -71,6 +71,18 @@ protected:
static AccessibilityTableInterface* getTableInterface (id self) noexcept { return getInterface (self, &AccessibilityHandler::getTableInterface); }
static AccessibilityCellInterface* getCellInterface (id self) noexcept { return getInterface (self, &AccessibilityHandler::getCellInterface); }
template <typename MemberFn>
static auto getEnclosingInterface (AccessibilityHandler* handler, MemberFn fn) noexcept -> decltype ((std::declval<AccessibilityHandler>().*fn)())
{
if (handler == nullptr)
return nullptr;
if (auto* interface = (handler->*fn)())
return interface;
return getEnclosingInterface (handler->getParent(), fn);
}
static bool hasEditableText (AccessibilityHandler& handler) noexcept
{
return handler.getRole() == AccessibilityRole::editableText