Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / accessible / ipc / ProxyAccessible.h
blobf66839197bb061d7d2934901f13e9926f06e4c29
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_a11y_ProxyAccessible_h
8 #define mozilla_a11y_ProxyAccessible_h
10 #include "mozilla/a11y/Role.h"
11 #include "nsString.h"
12 #include "nsTArray.h"
14 namespace mozilla {
15 namespace a11y {
17 class Attribute;
18 class DocAccessibleParent;
20 class ProxyAccessible
22 public:
24 ProxyAccessible(uint64_t aID, ProxyAccessible* aParent,
25 DocAccessibleParent* aDoc, role aRole) :
26 mParent(aParent), mDoc(aDoc), mWrapper(0), mID(aID), mRole(aRole),
27 mOuterDoc(false)
29 MOZ_COUNT_CTOR(ProxyAccessible);
31 ~ProxyAccessible()
33 MOZ_COUNT_DTOR(ProxyAccessible);
34 MOZ_ASSERT(!mWrapper);
37 void AddChildAt(uint32_t aIdx, ProxyAccessible* aChild)
38 { mChildren.InsertElementAt(aIdx, aChild); }
40 uint32_t ChildrenCount() const { return mChildren.Length(); }
42 void Shutdown();
44 void SetChildDoc(DocAccessibleParent*);
46 /**
47 * Remove The given child.
49 void RemoveChild(ProxyAccessible* aChild)
50 { mChildren.RemoveElement(aChild); }
52 /**
53 * Return the proxy for the parent of the wrapped accessible.
55 ProxyAccessible* Parent() const { return mParent; }
57 /**
58 * Get the role of the accessible we're proxying.
60 role Role() const { return mRole; }
63 * Return the states for the proxied accessible.
65 uint64_t State() const;
68 * Set aName to the name of the proxied accessible.
70 void Name(nsString& aName) const;
72 /**
73 * Set aDesc to the description of the proxied accessible.
75 void Description(nsString& aDesc) const;
77 /**
78 * Get the set of attributes on the proxied accessible.
80 void Attributes(nsTArray<Attribute> *aAttrs) const;
82 /**
83 * Allow the platform to store a pointers worth of data on us.
85 uintptr_t GetWrapper() const { return mWrapper; }
86 void SetWrapper(uintptr_t aWrapper) { mWrapper = aWrapper; }
89 * Return the ID of the accessible being proxied.
91 uint64_t ID() const { return mID; }
93 protected:
94 explicit ProxyAccessible(DocAccessibleParent* aThisAsDoc) :
95 mParent(nullptr), mDoc(aThisAsDoc), mWrapper(0), mID(0),
96 mRole(roles::DOCUMENT)
97 { MOZ_COUNT_CTOR(ProxyAccessible); }
99 protected:
100 ProxyAccessible* mParent;
102 private:
103 nsTArray<ProxyAccessible*> mChildren;
104 DocAccessibleParent* mDoc;
105 uintptr_t mWrapper;
106 uint64_t mID;
107 role mRole : 31;
108 bool mOuterDoc : 1;
114 #endif