2 ==============================================================================
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
7 JUCE is an open source library subject to commercial or open-source
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
23 ==============================================================================
29 #define UIA_FullDescriptionPropertyId 30159
30 #define UIA_IsDialogPropertyId 30174
32 class AccessibilityNativeHandle
: public ComBaseClassHelper
<IRawElementProviderSimple
,
33 ComTypes::IRawElementProviderFragment
,
34 ComTypes::IRawElementProviderFragmentRoot
>
37 explicit AccessibilityNativeHandle (AccessibilityHandler
& handler
);
39 //==============================================================================
40 void invalidateElement() noexcept
{ valid
= false; }
41 bool isElementValid() const noexcept
{ return valid
; }
43 const AccessibilityHandler
& getHandler() { return accessibilityHandler
; }
45 //==============================================================================
46 JUCE_COMRESULT
QueryInterface (REFIID refId
, void** result
) override
;
48 //==============================================================================
49 JUCE_COMRESULT
get_HostRawElementProvider (IRawElementProviderSimple
** provider
) override
;
50 JUCE_COMRESULT
get_ProviderOptions (ProviderOptions
* options
) override
;
51 JUCE_COMRESULT
GetPatternProvider (PATTERNID pId
, IUnknown
** provider
) override
;
52 JUCE_COMRESULT
GetPropertyValue (PROPERTYID propertyId
, VARIANT
* pRetVal
) override
;
54 JUCE_COMRESULT
Navigate (ComTypes::NavigateDirection direction
, ComTypes::IRawElementProviderFragment
** pRetVal
) override
;
55 JUCE_COMRESULT
GetRuntimeId (SAFEARRAY
** pRetVal
) override
;
56 JUCE_COMRESULT
get_BoundingRectangle (ComTypes::UiaRect
* pRetVal
) override
;
57 JUCE_COMRESULT
GetEmbeddedFragmentRoots (SAFEARRAY
** pRetVal
) override
;
58 JUCE_COMRESULT
SetFocus() override
;
59 JUCE_COMRESULT
get_FragmentRoot (ComTypes::IRawElementProviderFragmentRoot
** pRetVal
) override
;
61 JUCE_COMRESULT
ElementProviderFromPoint (double x
, double y
, ComTypes::IRawElementProviderFragment
** pRetVal
) override
;
62 JUCE_COMRESULT
GetFocus (ComTypes::IRawElementProviderFragment
** pRetVal
) override
;
65 //==============================================================================
66 String
getElementName() const;
67 bool isFragmentRoot() const { return accessibilityHandler
.getComponent().isOnDesktop(); }
69 //==============================================================================
70 AccessibilityHandler
& accessibilityHandler
;
73 std::array
<int, 2> rtid
{ UiaAppendRuntimeId
, ++idCounter
};
76 //==============================================================================
77 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AccessibilityNativeHandle
)