ia2AccessibleRelation.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* vim:expandtab:shiftwidth=2:tabstop=2:
  3. */
  4. /* This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  7. #ifndef _NS_ACCESSIBLE_RELATION_WRAP_H
  8. #define _NS_ACCESSIBLE_RELATION_WRAP_H
  9. #include "Accessible.h"
  10. #include "IUnknownImpl.h"
  11. #include <utility>
  12. #include "nsTArray.h"
  13. #include "AccessibleRelation.h"
  14. namespace mozilla {
  15. namespace a11y {
  16. class ia2AccessibleRelation final : public IAccessibleRelation
  17. {
  18. public:
  19. ia2AccessibleRelation(RelationType aType, Relation* aRel);
  20. ia2AccessibleRelation(RelationType aType,
  21. nsTArray<RefPtr<Accessible>>&& aTargets) :
  22. mType(aType), mTargets(Move(aTargets)) {}
  23. // IUnknown
  24. DECL_IUNKNOWN
  25. // IAccessibleRelation
  26. virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_relationType(
  27. /* [retval][out] */ BSTR *relationType);
  28. virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_localizedRelationType(
  29. /* [retval][out] */ BSTR *localizedRelationType);
  30. virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nTargets(
  31. /* [retval][out] */ long *nTargets);
  32. virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_target(
  33. /* [in] */ long targetIndex,
  34. /* [retval][out] */ IUnknown **target);
  35. virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_targets(
  36. /* [in] */ long maxTargets,
  37. /* [length_is][size_is][out] */ IUnknown **target,
  38. /* [retval][out] */ long *nTargets);
  39. inline bool HasTargets() const
  40. { return mTargets.Length(); }
  41. private:
  42. ia2AccessibleRelation();
  43. ia2AccessibleRelation(const ia2AccessibleRelation&);
  44. ia2AccessibleRelation& operator = (const ia2AccessibleRelation&);
  45. RelationType mType;
  46. nsTArray<RefPtr<Accessible> > mTargets;
  47. };
  48. /**
  49. * Gecko to IAccessible2 relation types map.
  50. */
  51. const WCHAR *const IA2_RELATION_NULL = L"";
  52. #define RELATIONTYPE(geckoType, name, atkType, msaaType, ia2Type) \
  53. std::pair<RelationType, const WCHAR *const>(RelationType::geckoType, ia2Type),
  54. static const std::pair<RelationType, const WCHAR *const> sRelationTypePairs[] = {
  55. #include "RelationTypeMap.h"
  56. };
  57. #undef RELATIONTYPE
  58. } // namespace a11y
  59. } // namespace mozilla
  60. #endif