The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
3.5KB

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