accessible/src/xul/XULTreeGridAccessible.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_XULTreeGridAccessible_h__
michael@0 7 #define mozilla_a11y_XULTreeGridAccessible_h__
michael@0 8
michael@0 9 #include "XULTreeAccessible.h"
michael@0 10 #include "TableAccessible.h"
michael@0 11 #include "TableCellAccessible.h"
michael@0 12 #include "xpcAccessibleTable.h"
michael@0 13 #include "xpcAccessibleTableCell.h"
michael@0 14
michael@0 15 namespace mozilla {
michael@0 16 namespace a11y {
michael@0 17
michael@0 18 /**
michael@0 19 * Represents accessible for XUL tree in the case when it has multiple columns.
michael@0 20 */
michael@0 21 class XULTreeGridAccessible : public XULTreeAccessible,
michael@0 22 public xpcAccessibleTable,
michael@0 23 public nsIAccessibleTable,
michael@0 24 public TableAccessible
michael@0 25 {
michael@0 26 public:
michael@0 27 XULTreeGridAccessible(nsIContent* aContent, DocAccessible* aDoc,
michael@0 28 nsTreeBodyFrame* aTreeFrame) :
michael@0 29 XULTreeAccessible(aContent, aDoc, aTreeFrame), xpcAccessibleTable(this)
michael@0 30 { mGenericTypes |= eTable; }
michael@0 31
michael@0 32 // nsISupports
michael@0 33 NS_DECL_ISUPPORTS_INHERITED
michael@0 34
michael@0 35 // nsIAccessibleTable
michael@0 36 NS_FORWARD_NSIACCESSIBLETABLE(xpcAccessibleTable::)
michael@0 37
michael@0 38 // TableAccessible
michael@0 39 virtual uint32_t ColCount();
michael@0 40 virtual uint32_t RowCount();
michael@0 41 virtual Accessible* CellAt(uint32_t aRowIndex, uint32_t aColumnIndex);
michael@0 42 virtual void ColDescription(uint32_t aColIdx, nsString& aDescription);
michael@0 43 virtual bool IsColSelected(uint32_t aColIdx);
michael@0 44 virtual bool IsRowSelected(uint32_t aRowIdx);
michael@0 45 virtual bool IsCellSelected(uint32_t aRowIdx, uint32_t aColIdx);
michael@0 46 virtual uint32_t SelectedCellCount();
michael@0 47 virtual uint32_t SelectedColCount();
michael@0 48 virtual uint32_t SelectedRowCount();
michael@0 49 virtual void SelectedCells(nsTArray<Accessible*>* aCells);
michael@0 50 virtual void SelectedCellIndices(nsTArray<uint32_t>* aCells);
michael@0 51 virtual void SelectedColIndices(nsTArray<uint32_t>* aCols);
michael@0 52 virtual void SelectedRowIndices(nsTArray<uint32_t>* aRows);
michael@0 53 virtual void SelectRow(uint32_t aRowIdx);
michael@0 54 virtual void UnselectRow(uint32_t aRowIdx);
michael@0 55 virtual Accessible* AsAccessible() { return this; }
michael@0 56
michael@0 57 // Accessible
michael@0 58 virtual void Shutdown();
michael@0 59 virtual TableAccessible* AsTable() { return this; }
michael@0 60 virtual a11y::role NativeRole();
michael@0 61
michael@0 62 protected:
michael@0 63
michael@0 64 // XULTreeAccessible
michael@0 65 virtual already_AddRefed<Accessible>
michael@0 66 CreateTreeItemAccessible(int32_t aRow) const MOZ_OVERRIDE;
michael@0 67 };
michael@0 68
michael@0 69
michael@0 70 /**
michael@0 71 * Represents accessible for XUL tree item in the case when XUL tree has
michael@0 72 * multiple columns.
michael@0 73 */
michael@0 74 class XULTreeGridRowAccessible : public XULTreeItemAccessibleBase
michael@0 75 {
michael@0 76 public:
michael@0 77 using Accessible::GetChildAt;
michael@0 78
michael@0 79 XULTreeGridRowAccessible(nsIContent* aContent, DocAccessible* aDoc,
michael@0 80 Accessible* aParent, nsITreeBoxObject* aTree,
michael@0 81 nsITreeView* aTreeView, int32_t aRow);
michael@0 82
michael@0 83 // nsISupports and cycle collection
michael@0 84 NS_DECL_ISUPPORTS_INHERITED
michael@0 85 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULTreeGridRowAccessible,
michael@0 86 XULTreeItemAccessibleBase)
michael@0 87
michael@0 88 // Accessible
michael@0 89 virtual void Shutdown();
michael@0 90 virtual a11y::role NativeRole();
michael@0 91 virtual ENameValueFlag Name(nsString& aName);
michael@0 92 virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
michael@0 93 EWhichChildAtPoint aWhichChild);
michael@0 94
michael@0 95 virtual Accessible* GetChildAt(uint32_t aIndex) const MOZ_OVERRIDE;
michael@0 96 virtual uint32_t ChildCount() const MOZ_OVERRIDE;
michael@0 97
michael@0 98 // XULTreeItemAccessibleBase
michael@0 99 virtual Accessible* GetCellAccessible(nsITreeColumn* aColumn) const MOZ_OVERRIDE;
michael@0 100 virtual void RowInvalidated(int32_t aStartColIdx, int32_t aEndColIdx);
michael@0 101
michael@0 102 protected:
michael@0 103
michael@0 104 // Accessible
michael@0 105 virtual void CacheChildren();
michael@0 106
michael@0 107 // XULTreeItemAccessibleBase
michael@0 108 mutable AccessibleHashtable mAccessibleCache;
michael@0 109 };
michael@0 110
michael@0 111
michael@0 112 /**
michael@0 113 * Represents an accessible for XUL tree cell in the case when XUL tree has
michael@0 114 * multiple columns.
michael@0 115 */
michael@0 116
michael@0 117 #define XULTREEGRIDCELLACCESSIBLE_IMPL_CID \
michael@0 118 { /* 84588ad4-549c-4196-a932-4c5ca5de5dff */ \
michael@0 119 0x84588ad4, \
michael@0 120 0x549c, \
michael@0 121 0x4196, \
michael@0 122 { 0xa9, 0x32, 0x4c, 0x5c, 0xa5, 0xde, 0x5d, 0xff } \
michael@0 123 }
michael@0 124
michael@0 125 class XULTreeGridCellAccessible : public LeafAccessible,
michael@0 126 public nsIAccessibleTableCell,
michael@0 127 public TableCellAccessible,
michael@0 128 public xpcAccessibleTableCell
michael@0 129 {
michael@0 130 public:
michael@0 131
michael@0 132 XULTreeGridCellAccessible(nsIContent* aContent, DocAccessible* aDoc,
michael@0 133 XULTreeGridRowAccessible* aRowAcc,
michael@0 134 nsITreeBoxObject* aTree, nsITreeView* aTreeView,
michael@0 135 int32_t aRow, nsITreeColumn* aColumn);
michael@0 136
michael@0 137 // nsISupports
michael@0 138 NS_DECL_ISUPPORTS_INHERITED
michael@0 139 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULTreeGridCellAccessible,
michael@0 140 LeafAccessible)
michael@0 141
michael@0 142 // nsIAccessible
michael@0 143
michael@0 144 NS_IMETHOD GetBounds(int32_t* aX, int32_t* aY,
michael@0 145 int32_t* aWidth, int32_t* aHeight);
michael@0 146
michael@0 147 NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName);
michael@0 148 NS_IMETHOD DoAction(uint8_t aIndex);
michael@0 149
michael@0 150 // nsIAccessibleTableCell
michael@0 151 NS_FORWARD_NSIACCESSIBLETABLECELL(xpcAccessibleTableCell::)
michael@0 152
michael@0 153 // Accessible
michael@0 154 virtual TableCellAccessible* AsTableCell() { return this; }
michael@0 155 virtual void Shutdown();
michael@0 156 virtual ENameValueFlag Name(nsString& aName);
michael@0 157 virtual Accessible* FocusedChild();
michael@0 158 virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
michael@0 159 virtual int32_t IndexInParent() const;
michael@0 160 virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
michael@0 161 virtual a11y::role NativeRole();
michael@0 162 virtual uint64_t NativeState();
michael@0 163 virtual uint64_t NativeInteractiveState() const;
michael@0 164
michael@0 165 // ActionAccessible
michael@0 166 virtual uint8_t ActionCount();
michael@0 167
michael@0 168 // TableCellAccessible
michael@0 169 virtual TableAccessible* Table() const MOZ_OVERRIDE;
michael@0 170 virtual uint32_t ColIdx() const MOZ_OVERRIDE;
michael@0 171 virtual uint32_t RowIdx() const MOZ_OVERRIDE;
michael@0 172 virtual void ColHeaderCells(nsTArray<Accessible*>* aHeaderCells) MOZ_OVERRIDE;
michael@0 173 virtual void RowHeaderCells(nsTArray<Accessible*>* aCells) MOZ_OVERRIDE { }
michael@0 174 virtual bool Selected() MOZ_OVERRIDE;
michael@0 175
michael@0 176 // XULTreeGridCellAccessible
michael@0 177 NS_DECLARE_STATIC_IID_ACCESSOR(XULTREEGRIDCELLACCESSIBLE_IMPL_CID)
michael@0 178
michael@0 179 /**
michael@0 180 * Fire name or state change event if the accessible text or value has been
michael@0 181 * changed.
michael@0 182 * @return true if name has changed
michael@0 183 */
michael@0 184 bool CellInvalidated();
michael@0 185
michael@0 186 protected:
michael@0 187 // Accessible
michael@0 188 virtual Accessible* GetSiblingAtOffset(int32_t aOffset,
michael@0 189 nsresult* aError = nullptr) const;
michael@0 190 virtual void DispatchClickEvent(nsIContent* aContent, uint32_t aActionIndex);
michael@0 191
michael@0 192 // XULTreeGridCellAccessible
michael@0 193
michael@0 194 /**
michael@0 195 * Return true if value of cell can be modified.
michael@0 196 */
michael@0 197 bool IsEditable() const;
michael@0 198
michael@0 199 enum { eAction_Click = 0 };
michael@0 200
michael@0 201 nsCOMPtr<nsITreeBoxObject> mTree;
michael@0 202 nsITreeView* mTreeView;
michael@0 203
michael@0 204 int32_t mRow;
michael@0 205 nsCOMPtr<nsITreeColumn> mColumn;
michael@0 206
michael@0 207 nsString mCachedTextEquiv;
michael@0 208 };
michael@0 209
michael@0 210 NS_DEFINE_STATIC_IID_ACCESSOR(XULTreeGridCellAccessible,
michael@0 211 XULTREEGRIDCELLACCESSIBLE_IMPL_CID)
michael@0 212
michael@0 213 } // namespace a11y
michael@0 214 } // namespace mozilla
michael@0 215
michael@0 216 #endif

mercurial