accessible/src/base/AccCollector.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #ifndef mozilla_a11y_AccCollector_h__
michael@0 6 #define mozilla_a11y_AccCollector_h__
michael@0 7
michael@0 8 #include "Filters.h"
michael@0 9
michael@0 10 #include "nsTArray.h"
michael@0 11
michael@0 12 namespace mozilla {
michael@0 13 namespace a11y {
michael@0 14
michael@0 15 class Accessible;
michael@0 16
michael@0 17 /**
michael@0 18 * Collect accessible children complying with filter function. Provides quick
michael@0 19 * access to accessible by index.
michael@0 20 */
michael@0 21 class AccCollector
michael@0 22 {
michael@0 23 public:
michael@0 24 AccCollector(Accessible* aRoot, filters::FilterFuncPtr aFilterFunc);
michael@0 25 virtual ~AccCollector();
michael@0 26
michael@0 27 /**
michael@0 28 * Return accessible count within the collection.
michael@0 29 */
michael@0 30 uint32_t Count();
michael@0 31
michael@0 32 /**
michael@0 33 * Return an accessible from the collection at the given index.
michael@0 34 */
michael@0 35 Accessible* GetAccessibleAt(uint32_t aIndex);
michael@0 36
michael@0 37 /**
michael@0 38 * Return index of the given accessible within the collection.
michael@0 39 */
michael@0 40 virtual int32_t GetIndexAt(Accessible* aAccessible);
michael@0 41
michael@0 42 protected:
michael@0 43 /**
michael@0 44 * Ensure accessible at the given index is stored and return it.
michael@0 45 */
michael@0 46 Accessible* EnsureNGetObject(uint32_t aIndex);
michael@0 47
michael@0 48 /**
michael@0 49 * Ensure index for the given accessible is stored and return it.
michael@0 50 */
michael@0 51 int32_t EnsureNGetIndex(Accessible* aAccessible);
michael@0 52
michael@0 53 /**
michael@0 54 * Append the object to collection.
michael@0 55 */
michael@0 56 virtual void AppendObject(Accessible* aAccessible);
michael@0 57
michael@0 58 filters::FilterFuncPtr mFilterFunc;
michael@0 59 Accessible* mRoot;
michael@0 60 uint32_t mRootChildIdx;
michael@0 61
michael@0 62 nsTArray<Accessible*> mObjects;
michael@0 63
michael@0 64 private:
michael@0 65 AccCollector();
michael@0 66 AccCollector(const AccCollector&);
michael@0 67 AccCollector& operator =(const AccCollector&);
michael@0 68 };
michael@0 69
michael@0 70 /**
michael@0 71 * Collect embedded objects. Provide quick access to accessible by index and
michael@0 72 * vice versa.
michael@0 73 */
michael@0 74 class EmbeddedObjCollector : public AccCollector
michael@0 75 {
michael@0 76 public:
michael@0 77 virtual ~EmbeddedObjCollector() { }
michael@0 78
michael@0 79 public:
michael@0 80 virtual int32_t GetIndexAt(Accessible* aAccessible);
michael@0 81
michael@0 82 protected:
michael@0 83 // Make sure it's used by Accessible class only.
michael@0 84 EmbeddedObjCollector(Accessible* aRoot) :
michael@0 85 AccCollector(aRoot, filters::GetEmbeddedObject) { }
michael@0 86
michael@0 87 virtual void AppendObject(Accessible* aAccessible);
michael@0 88
michael@0 89 friend class Accessible;
michael@0 90 };
michael@0 91
michael@0 92 } // namespace a11y
michael@0 93 } // namespace mozilla
michael@0 94
michael@0 95 #endif

mercurial