accessible/src/generic/ARIAGridAccessible.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef MOZILLA_A11Y_ARIAGridAccessible_h_
michael@0 7 #define MOZILLA_A11Y_ARIAGridAccessible_h_
michael@0 8
michael@0 9 #include "nsIAccessibleTable.h"
michael@0 10
michael@0 11 #include "HyperTextAccessibleWrap.h"
michael@0 12 #include "TableAccessible.h"
michael@0 13 #include "TableCellAccessible.h"
michael@0 14 #include "xpcAccessibleTable.h"
michael@0 15 #include "xpcAccessibleTableCell.h"
michael@0 16
michael@0 17 namespace mozilla {
michael@0 18 namespace a11y {
michael@0 19
michael@0 20 /**
michael@0 21 * Accessible for ARIA grid and treegrid.
michael@0 22 */
michael@0 23 class ARIAGridAccessible : public AccessibleWrap,
michael@0 24 public xpcAccessibleTable,
michael@0 25 public nsIAccessibleTable,
michael@0 26 public TableAccessible
michael@0 27 {
michael@0 28 public:
michael@0 29 ARIAGridAccessible(nsIContent* aContent, DocAccessible* aDoc);
michael@0 30
michael@0 31 // nsISupports
michael@0 32 NS_DECL_ISUPPORTS_INHERITED
michael@0 33
michael@0 34 // nsIAccessibleTable
michael@0 35 NS_FORWARD_NSIACCESSIBLETABLE(xpcAccessibleTable::)
michael@0 36
michael@0 37 // Accessible
michael@0 38 virtual TableAccessible* AsTable() { return this; }
michael@0 39 virtual void Shutdown();
michael@0 40
michael@0 41 // TableAccessible
michael@0 42 virtual uint32_t ColCount();
michael@0 43 virtual uint32_t RowCount();
michael@0 44 virtual Accessible* CellAt(uint32_t aRowIndex, uint32_t aColumnIndex);
michael@0 45 virtual bool IsColSelected(uint32_t aColIdx);
michael@0 46 virtual bool IsRowSelected(uint32_t aRowIdx);
michael@0 47 virtual bool IsCellSelected(uint32_t aRowIdx, uint32_t aColIdx);
michael@0 48 virtual uint32_t SelectedCellCount();
michael@0 49 virtual uint32_t SelectedColCount();
michael@0 50 virtual uint32_t SelectedRowCount();
michael@0 51 virtual void SelectedCells(nsTArray<Accessible*>* aCells);
michael@0 52 virtual void SelectedCellIndices(nsTArray<uint32_t>* aCells);
michael@0 53 virtual void SelectedColIndices(nsTArray<uint32_t>* aCols);
michael@0 54 virtual void SelectedRowIndices(nsTArray<uint32_t>* aRows);
michael@0 55 virtual void SelectCol(uint32_t aColIdx);
michael@0 56 virtual void SelectRow(uint32_t aRowIdx);
michael@0 57 virtual void UnselectCol(uint32_t aColIdx);
michael@0 58 virtual void UnselectRow(uint32_t aRowIdx);
michael@0 59 virtual Accessible* AsAccessible() { return this; }
michael@0 60
michael@0 61 protected:
michael@0 62
michael@0 63 /**
michael@0 64 * Return true if the given row index is valid.
michael@0 65 */
michael@0 66 bool IsValidRow(int32_t aRow);
michael@0 67
michael@0 68 /**
michael@0 69 * Retrn true if the given column index is valid.
michael@0 70 */
michael@0 71 bool IsValidColumn(int32_t aColumn);
michael@0 72
michael@0 73 /**
michael@0 74 * Return row accessible at the given row index.
michael@0 75 */
michael@0 76 Accessible* GetRowAt(int32_t aRow);
michael@0 77
michael@0 78 /**
michael@0 79 * Return cell accessible at the given column index in the row.
michael@0 80 */
michael@0 81 Accessible* GetCellInRowAt(Accessible* aRow, int32_t aColumn);
michael@0 82
michael@0 83 /**
michael@0 84 * Set aria-selected attribute value on DOM node of the given accessible.
michael@0 85 *
michael@0 86 * @param aAccessible [in] accessible
michael@0 87 * @param aIsSelected [in] new value of aria-selected attribute
michael@0 88 * @param aNotify [in, optional] specifies if DOM should be notified
michael@0 89 * about attribute change (used internally).
michael@0 90 */
michael@0 91 nsresult SetARIASelected(Accessible* aAccessible, bool aIsSelected,
michael@0 92 bool aNotify = true);
michael@0 93 };
michael@0 94
michael@0 95
michael@0 96 /**
michael@0 97 * Accessible for ARIA gridcell and rowheader/columnheader.
michael@0 98 */
michael@0 99 class ARIAGridCellAccessible : public HyperTextAccessibleWrap,
michael@0 100 public nsIAccessibleTableCell,
michael@0 101 public TableCellAccessible,
michael@0 102 public xpcAccessibleTableCell
michael@0 103 {
michael@0 104 public:
michael@0 105 ARIAGridCellAccessible(nsIContent* aContent, DocAccessible* aDoc);
michael@0 106
michael@0 107 // nsISupports
michael@0 108 NS_DECL_ISUPPORTS_INHERITED
michael@0 109
michael@0 110 // nsIAccessibleTableCell
michael@0 111 NS_FORWARD_NSIACCESSIBLETABLECELL(xpcAccessibleTableCell::)
michael@0 112
michael@0 113 // Accessible
michael@0 114 virtual TableCellAccessible* AsTableCell() { return this; }
michael@0 115 virtual void Shutdown();
michael@0 116 virtual void ApplyARIAState(uint64_t* aState) const;
michael@0 117 virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
michael@0 118
michael@0 119 protected:
michael@0 120
michael@0 121 /**
michael@0 122 * Return a containing row.
michael@0 123 */
michael@0 124 Accessible* Row() const
michael@0 125 {
michael@0 126 Accessible* row = Parent();
michael@0 127 return row && row->Role() == roles::ROW ? row : nullptr;
michael@0 128 }
michael@0 129
michael@0 130 /**
michael@0 131 * Return a table for the given row.
michael@0 132 */
michael@0 133 Accessible* TableFor(Accessible* aRow) const;
michael@0 134
michael@0 135 /**
michael@0 136 * Return index of the given row.
michael@0 137 */
michael@0 138 int32_t RowIndexFor(Accessible* aRow) const;
michael@0 139
michael@0 140 // TableCellAccessible
michael@0 141 virtual TableAccessible* Table() const MOZ_OVERRIDE;
michael@0 142 virtual uint32_t ColIdx() const MOZ_OVERRIDE;
michael@0 143 virtual uint32_t RowIdx() const MOZ_OVERRIDE;
michael@0 144 virtual bool Selected() MOZ_OVERRIDE;
michael@0 145 };
michael@0 146
michael@0 147 } // namespace a11y
michael@0 148 } // namespace mozilla
michael@0 149
michael@0 150 #endif

mercurial