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 "mozilla/a11y/TableAccessible.h"
11 #include "XULMenuAccessible.h"
12 #include "XULSelectControlAccessible.h"
18 * XULColumAccessible are accessible for list and tree columns elements
19 * (xul:treecols and xul:listheader).
21 class XULColumAccessible
: public AccessibleWrap
{
23 XULColumAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
26 virtual a11y::role
NativeRole() const override
;
27 virtual uint64_t NativeState() const override
;
31 * XULColumnItemAccessible are accessibles for list and tree column elements
34 class XULColumnItemAccessible
: public LeafAccessible
{
36 XULColumnItemAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
39 virtual a11y::role
NativeRole() const override
;
40 virtual uint64_t NativeState() const override
;
43 virtual bool HasPrimaryAction() const override
;
44 virtual void ActionNameAt(uint8_t aIndex
, nsAString
& aName
) override
;
46 enum { eAction_Click
= 0 };
50 * A class the represents the XUL Listbox widget.
52 class XULListboxAccessible
: public XULSelectControlAccessible
,
53 public TableAccessible
{
55 XULListboxAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
58 virtual uint32_t ColCount() const override
;
59 virtual uint32_t RowCount() override
;
60 virtual LocalAccessible
* CellAt(uint32_t aRowIndex
,
61 uint32_t aColumnIndex
) override
;
62 virtual bool IsColSelected(uint32_t aColIdx
) override
;
63 virtual bool IsRowSelected(uint32_t aRowIdx
) override
;
64 virtual bool IsCellSelected(uint32_t aRowIdx
, uint32_t aColIdx
) override
;
65 virtual uint32_t SelectedCellCount() override
;
66 virtual uint32_t SelectedColCount() override
;
67 virtual uint32_t SelectedRowCount() override
;
68 virtual void SelectedCells(nsTArray
<Accessible
*>* aCells
) override
;
69 virtual void SelectedCellIndices(nsTArray
<uint32_t>* aCells
) override
;
70 virtual void SelectedColIndices(nsTArray
<uint32_t>* aCols
) override
;
71 virtual void SelectedRowIndices(nsTArray
<uint32_t>* aRows
) override
;
72 virtual LocalAccessible
* AsAccessible() override
{ return this; }
75 virtual TableAccessible
* AsTable() override
{ return this; }
76 virtual a11y::role
NativeRole() const override
;
77 virtual uint64_t NativeState() const override
;
80 virtual bool IsWidget() const override
;
81 virtual bool IsActiveWidget() const override
;
82 virtual bool AreItemsOperable() const override
;
84 virtual LocalAccessible
* ContainerWidget() const override
;
87 virtual ~XULListboxAccessible() {}
89 bool IsMulticolumn() const { return ColCount() > 1; }
93 * Listitems -- used in listboxes
95 class XULListitemAccessible
: public XULMenuitemAccessible
{
97 enum { eAction_Click
= 0 };
99 NS_INLINE_DECL_REFCOUNTING_INHERITED(XULListitemAccessible
,
100 XULMenuitemAccessible
)
102 XULListitemAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
105 virtual void Description(nsString
& aDesc
) const override
;
106 virtual a11y::role
NativeRole() const override
;
107 virtual uint64_t NativeState() const override
;
108 virtual uint64_t NativeInteractiveState() const override
;
111 virtual void ActionNameAt(uint8_t index
, nsAString
& aName
) override
;
114 virtual LocalAccessible
* ContainerWidget() const override
;
117 virtual ~XULListitemAccessible();
120 virtual ENameValueFlag
NativeName(nsString
& aName
) const override
;
122 // XULListitemAccessible
125 * Return listbox accessible for the listitem.
127 LocalAccessible
* GetListAccessible() const;
134 } // namespace mozilla