mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
WebBrowserComponent: Windows: Add accessibility integration
This commit is contained in:
parent
6ef45eb20c
commit
7657efd227
12 changed files with 381 additions and 29 deletions
|
|
@ -28,6 +28,63 @@ namespace juce
|
|||
|
||||
AccessibilityHandler* AccessibilityHandler::currentlyFocusedHandler = nullptr;
|
||||
|
||||
class NativeChildHandler
|
||||
{
|
||||
public:
|
||||
static NativeChildHandler& getInstance()
|
||||
{
|
||||
static NativeChildHandler instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void* getNativeChild (Component& component) const
|
||||
{
|
||||
if (auto it = nativeChildForComponent.find (&component);
|
||||
it != nativeChildForComponent.end())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Component* getComponent (void* nativeChild) const
|
||||
{
|
||||
if (auto it = componentForNativeChild.find (nativeChild);
|
||||
it != componentForNativeChild.end())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void setNativeChild (Component& component, void* nativeChild)
|
||||
{
|
||||
clearComponent (component);
|
||||
|
||||
if (nativeChild != nullptr)
|
||||
{
|
||||
nativeChildForComponent[&component] = nativeChild;
|
||||
componentForNativeChild[nativeChild] = &component;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
NativeChildHandler() = default;
|
||||
|
||||
void clearComponent (Component& component)
|
||||
{
|
||||
if (auto* nativeChild = getNativeChild (component))
|
||||
componentForNativeChild.erase (nativeChild);
|
||||
|
||||
nativeChildForComponent.erase (&component);
|
||||
}
|
||||
|
||||
std::map<void*, Component*> componentForNativeChild;
|
||||
std::map<Component*, void*> nativeChildForComponent;
|
||||
};
|
||||
|
||||
AccessibilityHandler::AccessibilityHandler (Component& comp,
|
||||
AccessibilityRole accessibilityRole,
|
||||
AccessibilityActions accessibilityActions,
|
||||
|
|
@ -322,6 +379,21 @@ std::unique_ptr<AccessibilityHandler::AccessibilityNativeImpl> AccessibilityHand
|
|||
#endif
|
||||
}
|
||||
|
||||
void* AccessibilityHandler::getNativeChildForComponent (Component& component)
|
||||
{
|
||||
return NativeChildHandler::getInstance().getNativeChild (component);
|
||||
}
|
||||
|
||||
Component* AccessibilityHandler::getComponentForNativeChild (void* nativeChild)
|
||||
{
|
||||
return NativeChildHandler::getInstance().getComponent (nativeChild);
|
||||
}
|
||||
|
||||
void AccessibilityHandler::setNativeChildForComponent (Component& component, void* nativeChild)
|
||||
{
|
||||
NativeChildHandler::getInstance().setNativeChild (component, nativeChild);
|
||||
}
|
||||
|
||||
#if ! JUCE_NATIVE_ACCESSIBILITY_INCLUDED
|
||||
void AccessibilityHandler::notifyAccessibilityEvent (AccessibilityEvent) const {}
|
||||
void AccessibilityHandler::postAnnouncement (const String&, AnnouncementPriority) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue