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"
18 class DocAccessibleParent
;
24 ProxyAccessible(uint64_t aID
, ProxyAccessible
* aParent
,
25 DocAccessibleParent
* aDoc
, role aRole
) :
26 mParent(aParent
), mDoc(aDoc
), mWrapper(0), mID(aID
), mRole(aRole
),
29 MOZ_COUNT_CTOR(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(); }
44 void SetChildDoc(DocAccessibleParent
*);
47 * Remove The given child.
49 void RemoveChild(ProxyAccessible
* aChild
)
50 { mChildren
.RemoveElement(aChild
); }
53 * Return the proxy for the parent of the wrapped accessible.
55 ProxyAccessible
* Parent() const { return mParent
; }
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;
73 * Set aDesc to the description of the proxied accessible.
75 void Description(nsString
& aDesc
) const;
78 * Get the set of attributes on the proxied accessible.
80 void Attributes(nsTArray
<Attribute
> *aAttrs
) const;
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
; }
94 explicit ProxyAccessible(DocAccessibleParent
* aThisAsDoc
) :
95 mParent(nullptr), mDoc(aThisAsDoc
), mWrapper(0), mID(0),
96 mRole(roles::DOCUMENT
)
97 { MOZ_COUNT_CTOR(ProxyAccessible
); }
100 ProxyAccessible
* mParent
;
103 nsTArray
<ProxyAccessible
*> mChildren
;
104 DocAccessibleParent
* mDoc
;