|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* vim:expandtab:shiftwidth=2:tabstop=2: |
|
3 */ |
|
4 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
5 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
7 |
|
8 #ifndef mozilla_a11y_ApplicationAccessible_h__ |
|
9 #define mozilla_a11y_ApplicationAccessible_h__ |
|
10 |
|
11 #include "AccessibleWrap.h" |
|
12 #include "nsIAccessibleApplication.h" |
|
13 |
|
14 #include "nsIMutableArray.h" |
|
15 #include "nsIXULAppInfo.h" |
|
16 |
|
17 namespace mozilla { |
|
18 namespace a11y { |
|
19 |
|
20 /** |
|
21 * ApplicationAccessible is for the whole application of Mozilla. |
|
22 * Only one instance of ApplicationAccessible exists for one Mozilla instance. |
|
23 * And this one should be created when Mozilla Startup (if accessibility |
|
24 * feature has been enabled) and destroyed when Mozilla Shutdown. |
|
25 * |
|
26 * All the accessibility objects for toplevel windows are direct children of |
|
27 * the ApplicationAccessible instance. |
|
28 */ |
|
29 |
|
30 class ApplicationAccessible : public AccessibleWrap, |
|
31 public nsIAccessibleApplication |
|
32 { |
|
33 public: |
|
34 |
|
35 ApplicationAccessible(); |
|
36 |
|
37 // nsISupports |
|
38 NS_DECL_ISUPPORTS_INHERITED |
|
39 |
|
40 // nsIAccessible |
|
41 NS_IMETHOD GetRootDocument(nsIAccessibleDocument** aRootDocument); |
|
42 NS_IMETHOD ScrollTo(uint32_t aScrollType); |
|
43 NS_IMETHOD ScrollToPoint(uint32_t aCoordinateType, int32_t aX, int32_t aY); |
|
44 NS_IMETHOD GetLanguage(nsAString& aLanguage); |
|
45 NS_IMETHOD GetParent(nsIAccessible **aParent); |
|
46 NS_IMETHOD GetNextSibling(nsIAccessible **aNextSibling); |
|
47 NS_IMETHOD GetPreviousSibling(nsIAccessible **aPreviousSibling); |
|
48 NS_IMETHOD GetBounds(int32_t *aX, int32_t *aY, |
|
49 int32_t *aWidth, int32_t *aHeight); |
|
50 NS_IMETHOD SetSelected(bool aIsSelected); |
|
51 NS_IMETHOD TakeSelection(); |
|
52 NS_IMETHOD TakeFocus(); |
|
53 NS_IMETHOD GetActionName(uint8_t aIndex, nsAString &aName); |
|
54 NS_IMETHOD GetActionDescription(uint8_t aIndex, nsAString &aDescription); |
|
55 NS_IMETHOD DoAction(uint8_t aIndex); |
|
56 |
|
57 // nsIAccessibleApplication |
|
58 NS_DECL_NSIACCESSIBLEAPPLICATION |
|
59 |
|
60 // Accessible |
|
61 virtual void Shutdown(); |
|
62 virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE; |
|
63 virtual GroupPos GroupPosition(); |
|
64 virtual ENameValueFlag Name(nsString& aName); |
|
65 virtual void ApplyARIAState(uint64_t* aState) const; |
|
66 virtual void Description(nsString& aDescription); |
|
67 virtual void Value(nsString& aValue); |
|
68 virtual mozilla::a11y::role NativeRole(); |
|
69 virtual uint64_t State(); |
|
70 virtual uint64_t NativeState(); |
|
71 virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; |
|
72 |
|
73 virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY, |
|
74 EWhichChildAtPoint aWhichChild); |
|
75 virtual Accessible* FocusedChild(); |
|
76 |
|
77 virtual void InvalidateChildren(); |
|
78 |
|
79 // ActionAccessible |
|
80 virtual uint8_t ActionCount(); |
|
81 virtual KeyBinding AccessKey() const; |
|
82 |
|
83 protected: |
|
84 |
|
85 // Accessible |
|
86 virtual void CacheChildren(); |
|
87 virtual Accessible* GetSiblingAtOffset(int32_t aOffset, |
|
88 nsresult *aError = nullptr) const; |
|
89 |
|
90 private: |
|
91 nsCOMPtr<nsIXULAppInfo> mAppInfo; |
|
92 }; |
|
93 |
|
94 } // namespace a11y |
|
95 } // namespace mozilla |
|
96 |
|
97 #endif |
|
98 |