1 : /* -*- Mode: C++; tab-width: 4; 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> (original author)
24 : * Kyle Yuan <kyle.yuan@sun.com>
25 : * Alexander Surkov <surkov.alexander@gmail.com>
26 : *
27 : * Alternatively, the contents of this file may be used under the terms of
28 : * either of the GNU General Public License Version 2 or later (the "GPL"),
29 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 : * in which case the provisions of the GPL or the LGPL are applicable instead
31 : * of those above. If you wish to allow use of your version of this file only
32 : * under the terms of either the GPL or the LGPL, and not to allow others to
33 : * use your version of this file under the terms of the MPL, indicate your
34 : * decision by deleting the provisions above and replace them with the notice
35 : * and other provisions required by the GPL or the LGPL. If you do not delete
36 : * the provisions above, a recipient may use your version of this file under
37 : * the terms of any one of the MPL, the GPL or the LGPL.
38 : *
39 : * ***** END LICENSE BLOCK ***** */
40 : #ifndef __nsXULListboxAccessible_h__
41 : #define __nsXULListboxAccessible_h__
42 :
43 : #include "nsIAccessibleTable.h"
44 :
45 : #include "nsCOMPtr.h"
46 : #include "nsXULMenuAccessible.h"
47 : #include "nsBaseWidgetAccessible.h"
48 : #include "XULSelectControlAccessible.h"
49 :
50 : class nsIWeakReference;
51 :
52 : /**
53 : * nsXULColumnsAccessible are accessible for list and tree columns elements
54 : * (xul:treecols and xul:listcols).
55 : */
56 : class nsXULColumnsAccessible : public nsAccessibleWrap
57 0 : {
58 : public:
59 : nsXULColumnsAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
60 :
61 : // nsAccessible
62 : virtual mozilla::a11y::role NativeRole();
63 : virtual PRUint64 NativeState();
64 : };
65 :
66 : /**
67 : * nsXULColumnAccessible are accessibles for list and tree column elements
68 : * (xul:listcol and xul:treecol).
69 : */
70 : class nsXULColumnItemAccessible : public nsLeafAccessible
71 0 : {
72 : public:
73 : nsXULColumnItemAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
74 :
75 : // nsIAccessible
76 : NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
77 : NS_IMETHOD DoAction(PRUint8 aIndex);
78 :
79 : // nsAccessible
80 : virtual mozilla::a11y::role NativeRole();
81 : virtual PRUint64 NativeState();
82 :
83 : // ActionAccessible
84 : virtual PRUint8 ActionCount();
85 :
86 : enum { eAction_Click = 0 };
87 : };
88 :
89 : /*
90 : * A class the represents the XUL Listbox widget.
91 : */
92 : class nsXULListboxAccessible : public XULSelectControlAccessible,
93 : public nsIAccessibleTable
94 : {
95 : public:
96 : nsXULListboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
97 0 : virtual ~nsXULListboxAccessible() {}
98 :
99 : NS_DECL_ISUPPORTS_INHERITED
100 : NS_DECL_NSIACCESSIBLETABLE
101 :
102 : // nsIAccessible
103 : NS_IMETHOD GetValue(nsAString& aValue);
104 :
105 : // nsAccessible
106 : virtual mozilla::a11y::role NativeRole();
107 : virtual PRUint64 NativeState();
108 :
109 : // Widgets
110 : virtual bool IsWidget() const;
111 : virtual bool IsActiveWidget() const;
112 : virtual bool AreItemsOperable() const;
113 :
114 : virtual nsAccessible* ContainerWidget() const;
115 :
116 : protected:
117 : bool IsMulticolumn();
118 : };
119 :
120 : /**
121 : * Listitems -- used in listboxes
122 : */
123 : class nsXULListitemAccessible : public nsXULMenuitemAccessible
124 : {
125 : public:
126 : enum { eAction_Click = 0 };
127 :
128 : NS_DECL_ISUPPORTS_INHERITED
129 :
130 : nsXULListitemAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
131 0 : virtual ~nsXULListitemAccessible() {}
132 :
133 : // nsIAccessible
134 : NS_IMETHOD GetActionName(PRUint8 index, nsAString& aName);
135 : // Don't use XUL menuitems's description attribute
136 :
137 : // nsAccessible
138 : virtual void Description(nsString& aDesc);
139 : virtual nsresult GetNameInternal(nsAString& aName);
140 : virtual mozilla::a11y::role NativeRole();
141 : virtual PRUint64 NativeState();
142 : virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
143 : PRInt32 *aSetSize);
144 : virtual bool CanHaveAnonChildren();
145 :
146 : // Widgets
147 : virtual nsAccessible* ContainerWidget() const;
148 :
149 : protected:
150 : /**
151 : * Return listbox accessible for the listitem.
152 : */
153 : nsAccessible *GetListAccessible();
154 :
155 : private:
156 : bool mIsCheckbox;
157 : };
158 :
159 : /**
160 : * Class represents xul:listcell.
161 : */
162 : class nsXULListCellAccessible : public nsHyperTextAccessibleWrap,
163 : public nsIAccessibleTableCell
164 0 : {
165 : public:
166 : nsXULListCellAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
167 :
168 : // nsISupports
169 : NS_DECL_ISUPPORTS_INHERITED
170 :
171 : // nsIAccessibleTableCell
172 : NS_DECL_NSIACCESSIBLETABLECELL
173 :
174 : // nsAccessible
175 : virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
176 : virtual mozilla::a11y::role NativeRole();
177 : };
178 :
179 : #endif
|