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 : * Author: Eric D Vaughan (evaughan@netscape.com)
24 : *
25 : * Alternatively, the contents of this file may be used under the terms of
26 : * either of the GNU General Public License Version 2 or later (the "GPL"),
27 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 : * in which case the provisions of the GPL or the LGPL are applicable instead
29 : * of those above. If you wish to allow use of your version of this file only
30 : * under the terms of either the GPL or the LGPL, and not to allow others to
31 : * use your version of this file under the terms of the MPL, indicate your
32 : * decision by deleting the provisions above and replace them with the notice
33 : * and other provisions required by the GPL or the LGPL. If you do not delete
34 : * the provisions above, a recipient may use your version of this file under
35 : * the terms of any one of the MPL, the GPL or the LGPL.
36 : *
37 : * ***** END LICENSE BLOCK ***** */
38 :
39 : #ifndef _nsHTMLFormControlAccessible_H_
40 : #define _nsHTMLFormControlAccessible_H_
41 :
42 : #include "nsFormControlAccessible.h"
43 : #include "nsHyperTextAccessibleWrap.h"
44 :
45 : /**
46 : * Accessible for HTML progress element.
47 : */
48 : typedef ProgressMeterAccessible<1> HTMLProgressMeterAccessible;
49 :
50 : /**
51 : * Accessible for HTML input@type="checkbox".
52 : */
53 : class nsHTMLCheckboxAccessible : public nsFormControlAccessible
54 0 : {
55 :
56 : public:
57 : enum { eAction_Click = 0 };
58 :
59 : nsHTMLCheckboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
60 :
61 : // nsIAccessible
62 : NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
63 : NS_IMETHOD DoAction(PRUint8 index);
64 :
65 : // nsAccessible
66 : virtual mozilla::a11y::role NativeRole();
67 : virtual PRUint64 NativeState();
68 :
69 : // ActionAccessible
70 : virtual PRUint8 ActionCount();
71 :
72 : // Widgets
73 : virtual bool IsWidget() const;
74 : };
75 :
76 :
77 : /**
78 : * Accessible for HTML input@type="radio" element.
79 : */
80 : class nsHTMLRadioButtonAccessible : public nsRadioButtonAccessible
81 0 : {
82 :
83 : public:
84 : nsHTMLRadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
85 :
86 : // nsAccessible
87 : virtual PRUint64 NativeState();
88 : virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
89 : PRInt32 *aSetSize);
90 : };
91 :
92 :
93 : /**
94 : * Accessible for HTML input@type="button", @type="submit", @type="image"
95 : * and HTML button elements.
96 : */
97 : class nsHTMLButtonAccessible : public nsHyperTextAccessibleWrap
98 0 : {
99 :
100 : public:
101 : enum { eAction_Click = 0 };
102 :
103 : nsHTMLButtonAccessible(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 nsresult GetNameInternal(nsAString& aName);
111 : virtual mozilla::a11y::role NativeRole();
112 : virtual PRUint64 State();
113 : virtual PRUint64 NativeState();
114 :
115 : // ActionAccessible
116 : virtual PRUint8 ActionCount();
117 :
118 : // Widgets
119 : virtual bool IsWidget() const;
120 : };
121 :
122 :
123 : /**
124 : * Accessible for HTML input@type="text" element.
125 : */
126 : class nsHTMLTextFieldAccessible : public nsHyperTextAccessibleWrap
127 0 : {
128 :
129 : public:
130 : enum { eAction_Click = 0 };
131 :
132 : nsHTMLTextFieldAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
133 :
134 : NS_DECL_ISUPPORTS_INHERITED
135 :
136 : // nsIAccessible
137 : NS_IMETHOD GetValue(nsAString& _retval);
138 : NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
139 : NS_IMETHOD DoAction(PRUint8 index);
140 :
141 : // nsHyperTextAccessible
142 : virtual already_AddRefed<nsIEditor> GetEditor() const;
143 :
144 : // nsAccessible
145 : virtual void ApplyARIAState(PRUint64* aState);
146 : virtual nsresult GetNameInternal(nsAString& aName);
147 : virtual mozilla::a11y::role NativeRole();
148 : virtual PRUint64 State();
149 : virtual PRUint64 NativeState();
150 :
151 : // ActionAccessible
152 : virtual PRUint8 ActionCount();
153 :
154 : // Widgets
155 : virtual bool IsWidget() const;
156 : virtual nsAccessible* ContainerWidget() const;
157 : };
158 :
159 :
160 : /**
161 : * Accessible for input@type="file" element.
162 : */
163 : class nsHTMLFileInputAccessible : public nsHyperTextAccessibleWrap
164 0 : {
165 : public:
166 : nsHTMLFileInputAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
167 :
168 : // nsAccessible
169 : virtual mozilla::a11y::role NativeRole();
170 : virtual nsresult HandleAccEvent(AccEvent* aAccEvent);
171 : };
172 :
173 : /**
174 : * Accessible for HTML fieldset element.
175 : */
176 : class nsHTMLGroupboxAccessible : public nsHyperTextAccessibleWrap
177 0 : {
178 : public:
179 : nsHTMLGroupboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
180 :
181 : // nsAccessible
182 : virtual nsresult GetNameInternal(nsAString& aName);
183 : virtual mozilla::a11y::role NativeRole();
184 : virtual Relation RelationByType(PRUint32 aType);
185 :
186 : protected:
187 : nsIContent* GetLegend();
188 : };
189 :
190 :
191 : /**
192 : * Accessible for HTML legend element.
193 : */
194 : class nsHTMLLegendAccessible : public nsHyperTextAccessibleWrap
195 0 : {
196 : public:
197 : nsHTMLLegendAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
198 :
199 : // nsAccessible
200 : virtual mozilla::a11y::role NativeRole();
201 : virtual Relation RelationByType(PRUint32 aType);
202 : };
203 :
204 : /**
205 : * Accessible for HTML5 figure element.
206 : */
207 : class nsHTMLFigureAccessible : public nsHyperTextAccessibleWrap
208 0 : {
209 : public:
210 : nsHTMLFigureAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
211 :
212 : // nsAccessible
213 : virtual nsresult GetAttributesInternal(nsIPersistentProperties* aAttributes);
214 : virtual nsresult GetNameInternal(nsAString& aName);
215 : virtual mozilla::a11y::role NativeRole();
216 : virtual Relation RelationByType(PRUint32 aType);
217 :
218 : protected:
219 : nsIContent* Caption() const;
220 : };
221 :
222 :
223 : /**
224 : * Accessible for HTML5 figcaption element.
225 : */
226 : class nsHTMLFigcaptionAccessible : public nsHyperTextAccessibleWrap
227 0 : {
228 : public:
229 : nsHTMLFigcaptionAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
230 :
231 : // nsAccessible
232 : virtual mozilla::a11y::role NativeRole();
233 : virtual Relation RelationByType(PRUint32 aType);
234 : };
235 :
236 : #endif
|