Bumping manifests a=b2g-bump
[gecko.git] / accessible / xul / XULListboxAccessible.h
blobe3e5ba8bb9df01b936ae7de4e062e2c6eafed5ad
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;
19 namespace mozilla {
20 namespace a11y {
22 /**
23 * XULColumAccessible are accessible for list and tree columns elements
24 * (xul:treecols and xul:listcols).
26 class XULColumAccessible : public AccessibleWrap
28 public:
29 XULColumAccessible(nsIContent* aContent, DocAccessible* aDoc);
31 // Accessible
32 virtual a11y::role NativeRole() MOZ_OVERRIDE;
33 virtual uint64_t NativeState() MOZ_OVERRIDE;
36 /**
37 * XULColumnItemAccessible are accessibles for list and tree column elements
38 * (xul:listcol and xul:treecol).
40 class XULColumnItemAccessible : public LeafAccessible
42 public:
43 XULColumnItemAccessible(nsIContent* aContent, DocAccessible* aDoc);
45 // Accessible
46 virtual a11y::role NativeRole() MOZ_OVERRIDE;
47 virtual uint64_t NativeState() MOZ_OVERRIDE;
49 // ActionAccessible
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
63 public:
64 XULListboxAccessible(nsIContent* aContent, DocAccessible* aDoc);
66 // TableAccessible
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; }
84 // Accessible
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;
90 // Widgets
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;
97 protected:
98 virtual ~XULListboxAccessible() {}
100 bool IsMulticolumn() { return ColCount() > 1; }
104 * Listitems -- used in listboxes
106 class XULListitemAccessible : public XULMenuitemAccessible
108 public:
109 enum { eAction_Click = 0 };
111 NS_DECL_ISUPPORTS_INHERITED
113 XULListitemAccessible(nsIContent* aContent, DocAccessible* aDoc);
115 // Accessible
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;
122 // Actions
123 virtual void ActionNameAt(uint8_t index, nsAString& aName) MOZ_OVERRIDE;
125 // Widgets
126 virtual Accessible* ContainerWidget() const MOZ_OVERRIDE;
128 protected:
129 virtual ~XULListitemAccessible();
131 // Accessible
132 virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
134 // XULListitemAccessible
137 * Return listbox accessible for the listitem.
139 Accessible* GetListAccessible() const;
141 private:
142 bool mIsCheckbox;
146 * Class represents xul:listcell.
148 class XULListCellAccessible : public HyperTextAccessibleWrap,
149 public TableCellAccessible
151 public:
152 XULListCellAccessible(nsIContent* aContent, DocAccessible* aDoc);
154 // nsISupports
155 NS_DECL_ISUPPORTS_INHERITED
157 // Accessible
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;
169 protected:
170 virtual ~XULListCellAccessible() {}
173 } // namespace a11y
174 } // namespace mozilla
176 #endif