1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_a11y_XULListboxAccessible_h__
7 #define mozilla_a11y_XULListboxAccessible_h__
9 #include "BaseAccessibles.h"
10 #include "TableAccessible.h"
11 #include "TableCellAccessible.h"
12 #include "xpcAccessibleTable.h"
13 #include "xpcAccessibleTableCell.h"
14 #include "XULMenuAccessible.h"
15 #include "XULSelectControlAccessible.h"
17 class nsIWeakReference
;
23 * XULColumAccessible are accessible for list and tree columns elements
24 * (xul:treecols and xul:listcols).
26 class XULColumAccessible
: public AccessibleWrap
29 XULColumAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
32 virtual a11y::role
NativeRole() MOZ_OVERRIDE
;
33 virtual uint64_t NativeState() MOZ_OVERRIDE
;
37 * XULColumnItemAccessible are accessibles for list and tree column elements
38 * (xul:listcol and xul:treecol).
40 class XULColumnItemAccessible
: public LeafAccessible
43 XULColumnItemAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
46 virtual a11y::role
NativeRole() MOZ_OVERRIDE
;
47 virtual uint64_t NativeState() MOZ_OVERRIDE
;
50 virtual uint8_t ActionCount() MOZ_OVERRIDE
;
51 virtual void ActionNameAt(uint8_t aIndex
, nsAString
& aName
) MOZ_OVERRIDE
;
52 virtual bool DoAction(uint8_t aIndex
) MOZ_OVERRIDE
;
54 enum { eAction_Click
= 0 };
58 * A class the represents the XUL Listbox widget.
60 class XULListboxAccessible
: public XULSelectControlAccessible
,
61 public TableAccessible
64 XULListboxAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
67 virtual uint32_t ColCount() MOZ_OVERRIDE
;
68 virtual uint32_t RowCount() MOZ_OVERRIDE
;
69 virtual Accessible
* CellAt(uint32_t aRowIndex
, uint32_t aColumnIndex
) MOZ_OVERRIDE
;
70 virtual bool IsColSelected(uint32_t aColIdx
) MOZ_OVERRIDE
;
71 virtual bool IsRowSelected(uint32_t aRowIdx
) MOZ_OVERRIDE
;
72 virtual bool IsCellSelected(uint32_t aRowIdx
, uint32_t aColIdx
) MOZ_OVERRIDE
;
73 virtual uint32_t SelectedCellCount() MOZ_OVERRIDE
;
74 virtual uint32_t SelectedColCount() MOZ_OVERRIDE
;
75 virtual uint32_t SelectedRowCount() MOZ_OVERRIDE
;
76 virtual void SelectedCells(nsTArray
<Accessible
*>* aCells
) MOZ_OVERRIDE
;
77 virtual void SelectedCellIndices(nsTArray
<uint32_t>* aCells
) MOZ_OVERRIDE
;
78 virtual void SelectedColIndices(nsTArray
<uint32_t>* aCols
) MOZ_OVERRIDE
;
79 virtual void SelectedRowIndices(nsTArray
<uint32_t>* aRows
) MOZ_OVERRIDE
;
80 virtual void SelectRow(uint32_t aRowIdx
) MOZ_OVERRIDE
;
81 virtual void UnselectRow(uint32_t aRowIdx
) MOZ_OVERRIDE
;
82 virtual Accessible
* AsAccessible() MOZ_OVERRIDE
{ return this; }
85 virtual void Value(nsString
& aValue
) MOZ_OVERRIDE
;
86 virtual TableAccessible
* AsTable() MOZ_OVERRIDE
{ return this; }
87 virtual a11y::role
NativeRole() MOZ_OVERRIDE
;
88 virtual uint64_t NativeState() MOZ_OVERRIDE
;
91 virtual bool IsWidget() const MOZ_OVERRIDE
;
92 virtual bool IsActiveWidget() const MOZ_OVERRIDE
;
93 virtual bool AreItemsOperable() const MOZ_OVERRIDE
;
95 virtual Accessible
* ContainerWidget() const MOZ_OVERRIDE
;
98 virtual ~XULListboxAccessible() {}
100 bool IsMulticolumn() { return ColCount() > 1; }
104 * Listitems -- used in listboxes
106 class XULListitemAccessible
: public XULMenuitemAccessible
109 enum { eAction_Click
= 0 };
111 NS_DECL_ISUPPORTS_INHERITED
113 XULListitemAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
116 virtual void Description(nsString
& aDesc
) MOZ_OVERRIDE
;
117 virtual a11y::role
NativeRole() MOZ_OVERRIDE
;
118 virtual uint64_t NativeState() MOZ_OVERRIDE
;
119 virtual uint64_t NativeInteractiveState() const MOZ_OVERRIDE
;
120 virtual bool CanHaveAnonChildren() MOZ_OVERRIDE
;
123 virtual void ActionNameAt(uint8_t index
, nsAString
& aName
) MOZ_OVERRIDE
;
126 virtual Accessible
* ContainerWidget() const MOZ_OVERRIDE
;
129 virtual ~XULListitemAccessible();
132 virtual ENameValueFlag
NativeName(nsString
& aName
) MOZ_OVERRIDE
;
134 // XULListitemAccessible
137 * Return listbox accessible for the listitem.
139 Accessible
* GetListAccessible() const;
146 * Class represents xul:listcell.
148 class XULListCellAccessible
: public HyperTextAccessibleWrap
,
149 public TableCellAccessible
152 XULListCellAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
155 NS_DECL_ISUPPORTS_INHERITED
158 virtual TableCellAccessible
* AsTableCell() MOZ_OVERRIDE
{ return this; }
159 virtual already_AddRefed
<nsIPersistentProperties
> NativeAttributes() MOZ_OVERRIDE
;
160 virtual a11y::role
NativeRole() MOZ_OVERRIDE
;
162 // TableCellAccessible
163 virtual TableAccessible
* Table() const MOZ_OVERRIDE
;
164 virtual uint32_t ColIdx() const MOZ_OVERRIDE
;
165 virtual uint32_t RowIdx() const MOZ_OVERRIDE
;
166 virtual void ColHeaderCells(nsTArray
<Accessible
*>* aHeaderCells
) MOZ_OVERRIDE
;
167 virtual bool Selected() MOZ_OVERRIDE
;
170 virtual ~XULListCellAccessible() {}
174 } // namespace mozilla