1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_a11y_AccCollector_h__
6 #define mozilla_a11y_AccCollector_h__
18 * Collect accessible children complying with filter function. Provides quick
19 * access to accessible by index.
24 AccCollector(Accessible
* aRoot
, filters::FilterFuncPtr aFilterFunc
);
25 virtual ~AccCollector();
28 * Return accessible count within the collection.
33 * Return an accessible from the collection at the given index.
35 Accessible
* GetAccessibleAt(uint32_t aIndex
);
38 * Return index of the given accessible within the collection.
40 virtual int32_t GetIndexAt(Accessible
* aAccessible
);
44 * Ensure accessible at the given index is stored and return it.
46 Accessible
* EnsureNGetObject(uint32_t aIndex
);
49 * Ensure index for the given accessible is stored and return it.
51 int32_t EnsureNGetIndex(Accessible
* aAccessible
);
54 * Append the object to collection.
56 virtual void AppendObject(Accessible
* aAccessible
);
58 filters::FilterFuncPtr mFilterFunc
;
60 uint32_t mRootChildIdx
;
62 nsTArray
<Accessible
*> mObjects
;
66 AccCollector(const AccCollector
&);
67 AccCollector
& operator =(const AccCollector
&);
71 * Collect embedded objects. Provide quick access to accessible by index and
74 class EmbeddedObjCollector MOZ_FINAL
: public AccCollector
77 virtual ~EmbeddedObjCollector() { }
80 virtual int32_t GetIndexAt(Accessible
* aAccessible
);
83 // Make sure it's used by Accessible class only.
84 EmbeddedObjCollector(Accessible
* aRoot
) :
85 AccCollector(aRoot
, filters::GetEmbeddedObject
) { }
87 virtual void AppendObject(Accessible
* aAccessible
);
89 friend class Accessible
;
93 } // namespace mozilla