Bumping manifests a=b2g-bump
[gecko.git] / accessible / generic / BaseAccessibles.h
bloba6e1e6319bbde33d09b20e8d936cf0e34e5a84e4
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_a11y_BaseAccessibles_h__
7 #define mozilla_a11y_BaseAccessibles_h__
9 #include "AccessibleWrap.h"
10 #include "HyperTextAccessibleWrap.h"
12 class nsIContent;
14 /**
15 * This file contains a number of classes that are used as base
16 * classes for the different accessibility implementations of
17 * the HTML and XUL widget sets. --jgaunt
20 namespace mozilla {
21 namespace a11y {
23 /**
24 * Leaf version of DOM Accessible -- has no children
26 class LeafAccessible : public AccessibleWrap
28 public:
30 LeafAccessible(nsIContent* aContent, DocAccessible* aDoc);
32 // nsISupports
33 NS_DECL_ISUPPORTS_INHERITED
35 // Accessible
36 virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
37 EWhichChildAtPoint aWhichChild);
38 virtual bool InsertChildAt(uint32_t aIndex, Accessible* aChild) MOZ_OVERRIDE MOZ_FINAL;
39 virtual bool RemoveChild(Accessible* aChild) MOZ_OVERRIDE MOZ_FINAL;
41 protected:
42 virtual ~LeafAccessible() {}
44 // Accessible
45 virtual void CacheChildren();
48 /**
49 * Used for text or image accessible nodes contained by link accessibles or
50 * accessibles for nodes with registered click event handler. It knows how to
51 * report the state of the host link (traveled or not) and can activate (click)
52 * the host accessible programmatically.
54 class LinkableAccessible : public AccessibleWrap
56 public:
57 enum { eAction_Jump = 0 };
59 LinkableAccessible(nsIContent* aContent, DocAccessible* aDoc);
61 NS_DECL_ISUPPORTS_INHERITED
63 // nsIAccessible
64 NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName);
65 NS_IMETHOD DoAction(uint8_t index);
66 NS_IMETHOD TakeFocus();
68 // Accessible
69 virtual void Shutdown();
70 virtual void Value(nsString& aValue);
71 virtual uint64_t NativeLinkState() const;
73 // ActionAccessible
74 virtual uint8_t ActionCount();
75 virtual KeyBinding AccessKey() const;
77 // HyperLinkAccessible
78 virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex);
80 protected:
81 virtual ~LinkableAccessible() {}
83 // Accessible
84 virtual void BindToParent(Accessible* aParent, uint32_t aIndexInParent);
85 virtual void UnbindFromParent();
87 /**
88 * Parent accessible that provides an action for this linkable accessible.
90 Accessible* mActionAcc;
91 bool mIsLink;
92 bool mIsOnclick;
95 /**
96 * A simple accessible that gets its enumerated role passed into constructor.
98 class EnumRoleAccessible : public AccessibleWrap
100 public:
101 EnumRoleAccessible(nsIContent* aContent, DocAccessible* aDoc,
102 a11y::role aRole);
104 NS_DECL_ISUPPORTS_INHERITED
106 // Accessible
107 virtual a11y::role NativeRole();
109 protected:
110 virtual ~EnumRoleAccessible() { }
112 a11y::role mRole;
117 * A wrapper accessible around native accessible to connect it with
118 * crossplatform accessible tree.
120 class DummyAccessible : public AccessibleWrap
122 public:
123 DummyAccessible() : AccessibleWrap(nullptr, nullptr) { }
124 virtual ~DummyAccessible() { }
126 virtual uint64_t NativeState() MOZ_OVERRIDE MOZ_FINAL;
127 virtual uint64_t NativeInteractiveState() const MOZ_OVERRIDE MOZ_FINAL;
128 virtual uint64_t NativeLinkState() const MOZ_OVERRIDE MOZ_FINAL;
129 virtual bool NativelyUnavailable() const MOZ_OVERRIDE MOZ_FINAL;
130 virtual void ApplyARIAState(uint64_t* aState) const MOZ_OVERRIDE MOZ_FINAL;
133 } // namespace a11y
134 } // namespace mozilla
136 #endif