1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is mozilla.org code.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * Netscape Communications Corporation.
19 : * Portions created by the Initial Developer are Copyright (C) 1998
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : * Aaron Leventhal (aaronl@netscape.com)
24 : * Kyle Yuan (kyle.yuan@sun.com)
25 : *
26 : * Alternatively, the contents of this file may be used under the terms of
27 : * either of the GNU General Public License Version 2 or later (the "GPL"),
28 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 : * in which case the provisions of the GPL or the LGPL are applicable instead
30 : * of those above. If you wish to allow use of your version of this file only
31 : * under the terms of either the GPL or the LGPL, and not to allow others to
32 : * use your version of this file under the terms of the MPL, indicate your
33 : * decision by deleting the provisions above and replace them with the notice
34 : * and other provisions required by the GPL or the LGPL. If you do not delete
35 : * the provisions above, a recipient may use your version of this file under
36 : * the terms of any one of the MPL, the GPL or the LGPL.
37 : *
38 : * ***** END LICENSE BLOCK ***** */
39 :
40 : #ifndef _nsXULFormControlAccessible_H_
41 : #define _nsXULFormControlAccessible_H_
42 :
43 : // NOTE: alphabetically ordered
44 : #include "nsAccessibleWrap.h"
45 : #include "nsFormControlAccessible.h"
46 : #include "nsHyperTextAccessibleWrap.h"
47 : #include "XULSelectControlAccessible.h"
48 :
49 : /**
50 : * Used for XUL progressmeter element.
51 : */
52 : typedef ProgressMeterAccessible<100> XULProgressMeterAccessible;
53 :
54 : /**
55 : * Used for XUL button.
56 : *
57 : * @note Don't inherit from nsFormControlAccessible - it doesn't allow children
58 : * and a button can have a dropmarker child.
59 : */
60 : class nsXULButtonAccessible : public nsAccessibleWrap
61 0 : {
62 : public:
63 : enum { eAction_Click = 0 };
64 : nsXULButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
65 :
66 : // nsISupports
67 : NS_DECL_ISUPPORTS_INHERITED
68 :
69 : // nsIAccessible
70 : NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
71 : NS_IMETHOD DoAction(PRUint8 index);
72 :
73 : // nsAccessible
74 : virtual mozilla::a11y::role NativeRole();
75 : virtual PRUint64 NativeState();
76 :
77 : // ActionAccessible
78 : virtual PRUint8 ActionCount();
79 :
80 : // Widgets
81 : virtual bool IsWidget() const;
82 : virtual bool IsActiveWidget() const;
83 : virtual bool AreItemsOperable() const;
84 : virtual nsAccessible* ContainerWidget() const;
85 :
86 : protected:
87 :
88 : // nsAccessible
89 : virtual void CacheChildren();
90 :
91 : // nsXULButtonAccessible
92 : bool ContainsMenu();
93 : };
94 :
95 :
96 : /**
97 : * Used for XUL checkbox element.
98 : */
99 : class nsXULCheckboxAccessible : public nsFormControlAccessible
100 0 : {
101 : public:
102 : enum { eAction_Click = 0 };
103 : nsXULCheckboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
104 :
105 : // nsIAccessible
106 : NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
107 : NS_IMETHOD DoAction(PRUint8 index);
108 :
109 : // nsAccessible
110 : virtual mozilla::a11y::role NativeRole();
111 : virtual PRUint64 NativeState();
112 :
113 : // ActionAccessible
114 : virtual PRUint8 ActionCount();
115 : };
116 :
117 : /**
118 : * Used for XUL dropmarker element.
119 : */
120 : class nsXULDropmarkerAccessible : public nsFormControlAccessible
121 0 : {
122 : public:
123 : enum { eAction_Click = 0 };
124 : nsXULDropmarkerAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
125 :
126 : // nsIAccessible
127 : NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
128 : NS_IMETHOD DoAction(PRUint8 index);
129 :
130 : // nsAccessible
131 : virtual mozilla::a11y::role NativeRole();
132 : virtual PRUint64 NativeState();
133 :
134 : // ActionAccessible
135 : virtual PRUint8 ActionCount();
136 :
137 : private:
138 : bool DropmarkerOpen(bool aToggleOpen);
139 : };
140 :
141 : /**
142 : * Used for XUL groupbox element.
143 : */
144 : class nsXULGroupboxAccessible : public nsAccessibleWrap
145 0 : {
146 : public:
147 : nsXULGroupboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
148 :
149 : // nsAccessible
150 : virtual mozilla::a11y::role NativeRole();
151 : virtual nsresult GetNameInternal(nsAString& aName);
152 : virtual Relation RelationByType(PRUint32 aRelationType);
153 : };
154 :
155 : /**
156 : * Used for XUL radio element (radio button).
157 : */
158 : class nsXULRadioButtonAccessible : public nsRadioButtonAccessible
159 0 : {
160 :
161 : public:
162 : nsXULRadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
163 :
164 : // nsAccessible
165 : virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
166 : PRInt32 *aSetSize);
167 : virtual PRUint64 NativeState();
168 :
169 : // Widgets
170 : virtual nsAccessible* ContainerWidget() const;
171 : };
172 :
173 : /**
174 : * Used for XUL radiogroup element.
175 : */
176 : class nsXULRadioGroupAccessible : public XULSelectControlAccessible
177 0 : {
178 : public:
179 : nsXULRadioGroupAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
180 :
181 : // nsAccessible
182 : virtual mozilla::a11y::role NativeRole();
183 : virtual PRUint64 NativeState();
184 :
185 : // Widgets
186 : virtual bool IsWidget() const;
187 : virtual bool IsActiveWidget() const;
188 : virtual bool AreItemsOperable() const;
189 : };
190 :
191 : /**
192 : * Used for XUL statusbar element.
193 : */
194 : class nsXULStatusBarAccessible : public nsAccessibleWrap
195 0 : {
196 : public:
197 : nsXULStatusBarAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
198 :
199 : // nsAccessible
200 : virtual mozilla::a11y::role NativeRole();
201 : };
202 :
203 : /**
204 : * Used for XUL toolbarbutton element.
205 : */
206 : class nsXULToolbarButtonAccessible : public nsXULButtonAccessible
207 0 : {
208 : public:
209 : nsXULToolbarButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
210 :
211 : // nsAccessible
212 : virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
213 : PRInt32 *aSetSize);
214 :
215 : // nsXULToolbarButtonAccessible
216 : static bool IsSeparator(nsAccessible *aAccessible);
217 : };
218 :
219 : /**
220 : * Used for XUL toolbar element.
221 : */
222 : class nsXULToolbarAccessible : public nsAccessibleWrap
223 0 : {
224 : public:
225 : nsXULToolbarAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
226 :
227 : // nsAccessible
228 : virtual mozilla::a11y::role NativeRole();
229 : virtual nsresult GetNameInternal(nsAString& aName);
230 : };
231 :
232 : /**
233 : * Used for XUL toolbarseparator element.
234 : */
235 : class nsXULToolbarSeparatorAccessible : public nsLeafAccessible
236 0 : {
237 : public:
238 : nsXULToolbarSeparatorAccessible(nsIContent* aContent,
239 : nsDocAccessible* aDoc);
240 :
241 : // nsAccessible
242 : virtual mozilla::a11y::role NativeRole();
243 : virtual PRUint64 NativeState();
244 : };
245 :
246 : /**
247 : * Used for XUL textbox element.
248 : */
249 : class nsXULTextFieldAccessible : public nsHyperTextAccessibleWrap
250 0 : {
251 : public:
252 : enum { eAction_Click = 0 };
253 :
254 : nsXULTextFieldAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
255 :
256 : NS_DECL_ISUPPORTS_INHERITED
257 :
258 : // nsIAccessible
259 : NS_IMETHOD GetValue(nsAString& aValue);
260 : NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
261 : NS_IMETHOD DoAction(PRUint8 index);
262 :
263 : // nsHyperTextAccessible
264 : virtual already_AddRefed<nsIEditor> GetEditor() const;
265 :
266 : // nsAccessible
267 : virtual void ApplyARIAState(PRUint64* aState);
268 : virtual mozilla::a11y::role NativeRole();
269 : virtual PRUint64 NativeState();
270 : virtual bool CanHaveAnonChildren();
271 :
272 : // ActionAccessible
273 : virtual PRUint8 ActionCount();
274 :
275 : protected:
276 : // nsAccessible
277 : virtual void CacheChildren();
278 :
279 : // nsHyperTextAccessible
280 : virtual already_AddRefed<nsFrameSelection> FrameSelection();
281 :
282 : // nsXULTextFieldAccessible
283 : already_AddRefed<nsIContent> GetInputField() const;
284 : };
285 :
286 :
287 : #endif
288 :
|