ia2AccessibleRelation.h (2286B)
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 8 #ifndef _NS_ACCESSIBLE_RELATION_WRAP_H 9 #define _NS_ACCESSIBLE_RELATION_WRAP_H 10 11 #include "MsaaAccessible.h" 12 #include "IUnknownImpl.h" 13 14 #include <utility> 15 #include "nsTArray.h" 16 17 #include "mozilla/a11y/RelationType.h" 18 #include "mozilla/a11y/Accessible.h" 19 #include "AccessibleRelation.h" 20 21 namespace mozilla { 22 namespace a11y { 23 24 class ia2AccessibleRelation final : public IAccessibleRelation { 25 public: 26 ia2AccessibleRelation(RelationType aType, Relation* aRel); 27 28 // IUnknown 29 DECL_IUNKNOWN 30 31 // IAccessibleRelation 32 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_relationType( 33 /* [retval][out] */ BSTR* relationType); 34 35 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_localizedRelationType( 36 /* [retval][out] */ BSTR* localizedRelationType); 37 38 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nTargets( 39 /* [retval][out] */ long* nTargets); 40 41 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_target( 42 /* [in] */ long targetIndex, 43 /* [retval][out] */ IUnknown** target); 44 45 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_targets( 46 /* [in] */ long maxTargets, 47 /* [length_is][size_is][out] */ IUnknown** target, 48 /* [retval][out] */ long* nTargets); 49 50 inline bool HasTargets() const { return mTargets.Length(); } 51 52 private: 53 ia2AccessibleRelation(); 54 ia2AccessibleRelation(const ia2AccessibleRelation&); 55 ia2AccessibleRelation& operator=(const ia2AccessibleRelation&); 56 57 RelationType mType; 58 nsTArray<RefPtr<IUnknown>> mTargets; 59 }; 60 61 /** 62 * Gecko to IAccessible2 relation types map. 63 */ 64 65 const WCHAR* const IA2_RELATION_NULL = L""; 66 67 #define RELATIONTYPE(geckoType, name, atkType, msaaType, ia2Type) \ 68 std::pair<RelationType, const WCHAR* const>(RelationType::geckoType, ia2Type), 69 70 static const std::pair<RelationType, const WCHAR* const> sRelationTypePairs[] = 71 { 72 #include "RelationTypeMap.h" 73 }; 74 75 #undef RELATIONTYPE 76 77 } // namespace a11y 78 } // namespace mozilla 79 80 #endif