Bug 1850635 [wpt PR 41704] - Implement parseHTMLUnsafe and setHTMLUnsafe, a=testonly
[gecko.git] / accessible / xul / XULListboxAccessible.h
blob2745b323d0943af25912e62de184b45fde2a4bf3
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"
14 namespace mozilla {
15 namespace a11y {
17 /**
18 * XULColumAccessible are accessible for list and tree columns elements
19 * (xul:treecols and xul:listheader).
21 class XULColumAccessible : public AccessibleWrap {
22 public:
23 XULColumAccessible(nsIContent* aContent, DocAccessible* aDoc);
25 // LocalAccessible
26 virtual a11y::role NativeRole() const override;
27 virtual uint64_t NativeState() const override;
30 /**
31 * XULColumnItemAccessible are accessibles for list and tree column elements
32 * (xul:treecol).
34 class XULColumnItemAccessible : public LeafAccessible {
35 public:
36 XULColumnItemAccessible(nsIContent* aContent, DocAccessible* aDoc);
38 // LocalAccessible
39 virtual a11y::role NativeRole() const override;
40 virtual uint64_t NativeState() const override;
42 // ActionAccessible
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 {
54 public:
55 XULListboxAccessible(nsIContent* aContent, DocAccessible* aDoc);
57 // TableAccessible
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; }
74 // LocalAccessible
75 virtual TableAccessible* AsTable() override { return this; }
76 virtual a11y::role NativeRole() const override;
77 virtual uint64_t NativeState() const override;
79 // Widgets
80 virtual bool IsWidget() const override;
81 virtual bool IsActiveWidget() const override;
82 virtual bool AreItemsOperable() const override;
84 virtual LocalAccessible* ContainerWidget() const override;
86 protected:
87 virtual ~XULListboxAccessible() {}
89 bool IsMulticolumn() const { return ColCount() > 1; }
92 /**
93 * Listitems -- used in listboxes
95 class XULListitemAccessible : public XULMenuitemAccessible {
96 public:
97 enum { eAction_Click = 0 };
99 NS_INLINE_DECL_REFCOUNTING_INHERITED(XULListitemAccessible,
100 XULMenuitemAccessible)
102 XULListitemAccessible(nsIContent* aContent, DocAccessible* aDoc);
104 // LocalAccessible
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;
110 // Actions
111 virtual void ActionNameAt(uint8_t index, nsAString& aName) override;
113 // Widgets
114 virtual LocalAccessible* ContainerWidget() const override;
116 protected:
117 virtual ~XULListitemAccessible();
119 // LocalAccessible
120 virtual ENameValueFlag NativeName(nsString& aName) const override;
122 // XULListitemAccessible
125 * Return listbox accessible for the listitem.
127 LocalAccessible* GetListAccessible() const;
129 private:
130 bool mIsCheckbox;
133 } // namespace a11y
134 } // namespace mozilla
136 #endif