1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim:expandtab:shiftwidth=2:tabstop=2:
3 : */
4 : /* ***** BEGIN LICENSE BLOCK *****
5 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 : *
7 : * The contents of this file are subject to the Mozilla Public License Version
8 : * 1.1 (the "License"); you may not use this file except in compliance with
9 : * the License. You may obtain a copy of the License at
10 : * http://www.mozilla.org/MPL/
11 : *
12 : * Software distributed under the License is distributed on an "AS IS" basis,
13 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 : * for the specific language governing rights and limitations under the
15 : * License.
16 : *
17 : * The Original Code is mozilla.org code.
18 : *
19 : * The Initial Developer of the Original Code is
20 : * Mozilla Foundation.
21 : * Portions created by the Initial Developer are Copyright (C) 2007
22 : * the Initial Developer. All Rights Reserved.
23 : *
24 : * Contributor(s):
25 : * Bolian Yin <bolian.yin@sun.com>
26 : * Ginn Chen <ginn.chen@sun.com>
27 : * Alexander Surkov <surkov.alexander@gmail.com>
28 : *
29 : * Alternatively, the contents of this file may be used under the terms of
30 : * either the GNU General Public License Version 2 or later (the "GPL"), or
31 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
32 : * in which case the provisions of the GPL or the LGPL are applicable instead
33 : * of those above. If you wish to allow use of your version of this file only
34 : * under the terms of either the GPL or the LGPL, and not to allow others to
35 : * use your version of this file under the terms of the MPL, indicate your
36 : * decision by deleting the provisions above and replace them with the notice
37 : * and other provisions required by the GPL or the LGPL. If you do not delete
38 : * the provisions above, a recipient may use your version of this file under
39 : * the terms of any one of the MPL, the GPL or the LGPL.
40 : *
41 : * ***** END LICENSE BLOCK ***** */
42 :
43 : #ifndef __NS_APPLICATION_ACCESSIBLE_H__
44 : #define __NS_APPLICATION_ACCESSIBLE_H__
45 :
46 : #include "nsAccessibleWrap.h"
47 : #include "nsIAccessibleApplication.h"
48 :
49 : #include "nsIMutableArray.h"
50 : #include "nsIXULAppInfo.h"
51 :
52 : /**
53 : * nsApplicationAccessible is for the whole application of Mozilla.
54 : * Only one instance of nsApplicationAccessible exists for one Mozilla instance.
55 : * And this one should be created when Mozilla Startup (if accessibility
56 : * feature has been enabled) and destroyed when Mozilla Shutdown.
57 : *
58 : * All the accessibility objects for toplevel windows are direct children of
59 : * the nsApplicationAccessible instance.
60 : */
61 :
62 : class nsApplicationAccessible: public nsAccessibleWrap,
63 : public nsIAccessibleApplication
64 0 : {
65 : public:
66 :
67 : nsApplicationAccessible();
68 :
69 : // nsISupports
70 : NS_DECL_ISUPPORTS_INHERITED
71 :
72 : // nsIAccessible
73 : NS_SCRIPTABLE NS_IMETHOD GetDOMNode(nsIDOMNode** aDOMNode);
74 : NS_SCRIPTABLE NS_IMETHOD GetDocument(nsIAccessibleDocument** aDocument);
75 : NS_SCRIPTABLE NS_IMETHOD GetRootDocument(nsIAccessibleDocument** aRootDocument);
76 : NS_SCRIPTABLE NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML);
77 : NS_SCRIPTABLE NS_IMETHOD ScrollTo(PRUint32 aScrollType);
78 : NS_SCRIPTABLE NS_IMETHOD ScrollToPoint(PRUint32 aCoordinateType, PRInt32 aX, PRInt32 aY);
79 : NS_SCRIPTABLE NS_IMETHOD GetLanguage(nsAString& aLanguage);
80 : NS_IMETHOD GetParent(nsIAccessible **aParent);
81 : NS_IMETHOD GetNextSibling(nsIAccessible **aNextSibling);
82 : NS_IMETHOD GetPreviousSibling(nsIAccessible **aPreviousSibling);
83 : NS_IMETHOD GetName(nsAString &aName);
84 : NS_IMETHOD GetValue(nsAString &aValue);
85 : NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
86 : NS_IMETHOD GroupPosition(PRInt32 *aGroupLevel, PRInt32 *aSimilarItemsInGroup,
87 : PRInt32 *aPositionInGroup);
88 : NS_IMETHOD GetBounds(PRInt32 *aX, PRInt32 *aY,
89 : PRInt32 *aWidth, PRInt32 *aHeight);
90 : NS_IMETHOD SetSelected(bool aIsSelected);
91 : NS_IMETHOD TakeSelection();
92 : NS_IMETHOD TakeFocus();
93 : NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString &aName);
94 : NS_IMETHOD GetActionDescription(PRUint8 aIndex, nsAString &aDescription);
95 : NS_IMETHOD DoAction(PRUint8 aIndex);
96 :
97 : // nsIAccessibleApplication
98 : NS_DECL_NSIACCESSIBLEAPPLICATION
99 :
100 : // nsAccessNode
101 : virtual bool IsDefunct() const;
102 : virtual bool Init();
103 : virtual void Shutdown();
104 : virtual bool IsPrimaryForNode() const;
105 :
106 : // nsAccessible
107 : virtual void ApplyARIAState(PRUint64* aState);
108 : virtual void Description(nsString& aDescription);
109 : virtual mozilla::a11y::role NativeRole();
110 : virtual PRUint64 State();
111 : virtual PRUint64 NativeState();
112 : virtual Relation RelationByType(PRUint32 aRelType);
113 :
114 : virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
115 : EWhichChildAtPoint aWhichChild);
116 : virtual nsAccessible* FocusedChild();
117 :
118 : virtual void InvalidateChildren();
119 :
120 : // ActionAccessible
121 : virtual PRUint8 ActionCount();
122 : virtual KeyBinding AccessKey() const;
123 :
124 : protected:
125 :
126 : // nsAccessible
127 : virtual void CacheChildren();
128 : virtual nsAccessible* GetSiblingAtOffset(PRInt32 aOffset,
129 : nsresult *aError = nsnull) const;
130 :
131 : private:
132 : nsCOMPtr<nsIXULAppInfo> mAppInfo;
133 : };
134 :
135 : #endif
136 :
|