1 /***************************************************************************
2 * Copyright (C) 2012 by Amandeep Singh <aman.dedman@gmail.com> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #ifndef KITEMLISTVIEWACCESSIBLE_H
21 #define KITEMLISTVIEWACCESSIBLE_H
23 #ifndef QT_NO_ACCESSIBILITY
25 #include <QtCore/qpointer.h>
26 #include <QtGui/qaccessible.h>
27 #include <QtGui/qaccessible2.h>
28 #include <QtGui/qaccessiblewidget.h>
29 #include <QtGui/qaccessibleobject.h>
32 class KItemListContainer
;
34 class KItemListViewAccessible
: public QAccessibleTable2Interface
, public QAccessibleObjectEx
39 explicit KItemListViewAccessible(KItemListView
* view
);
41 Role
role(int child
) const;
42 State
state(int child
) const;
43 QString
text(Text t
, int child
) const;
44 QRect
rect(int child
) const;
46 int childAt(int x
, int y
) const;
47 int childCount() const;
48 int indexOfChild(const QAccessibleInterface
*) const;
50 int navigate(RelationFlag relation
, int index
, QAccessibleInterface
** interface
) const;
51 Relation
relationTo(int child
, const QAccessibleInterface
* other
, int otherChild
) const;
54 int userActionCount(int child
) const;
55 QString
actionText(int action
, Text t
, int child
) const;
56 bool doAction(int action
, int child
, const QVariantList
& params
);
58 QVariant
invokeMethodEx(Method
, int, const QVariantList
&);
61 virtual QAccessibleTable2CellInterface
* cellAt(int row
, int column
) const;
62 virtual QAccessibleInterface
* caption() const;
63 virtual QAccessibleInterface
* summary() const;
64 virtual QString
columnDescription(int column
) const;
65 virtual QString
rowDescription(int row
) const;
66 virtual int columnCount() const;
67 virtual int rowCount() const;
68 virtual QAccessible2::TableModelChange
modelChange() const;
69 virtual void rowsInserted(const QModelIndex
&, int, int) {}
70 virtual void rowsRemoved(const QModelIndex
&, int, int) {}
71 virtual void columnsInserted(const QModelIndex
&, int, int) {}
72 virtual void columnsRemoved(const QModelIndex
&, int, int) {}
73 virtual void rowsMoved(const QModelIndex
&, int, int, const QModelIndex
&, int) {}
74 virtual void columnsMoved(const QModelIndex
&, int, int, const QModelIndex
&, int) {}
77 virtual int selectedCellCount() const;
78 virtual int selectedColumnCount() const;
79 virtual int selectedRowCount() const;
80 virtual QList
<QAccessibleTable2CellInterface
*> selectedCells() const;
81 virtual QList
<int> selectedColumns() const;
82 virtual QList
<int> selectedRows() const;
83 virtual bool isColumnSelected(int column
) const;
84 virtual bool isRowSelected(int row
) const;
85 virtual bool selectRow(int row
);
86 virtual bool selectColumn(int column
);
87 virtual bool unselectRow(int row
);
88 virtual bool unselectColumn(int column
);
90 KItemListView
* view() const;
93 virtual void modelReset();
95 * Create an QAccessibleTable2CellInterface representing the table
96 * cell at the @index. Index is 0-based.
98 inline QAccessibleTable2CellInterface
* cell(int index
) const;
99 inline QAccessible::Role
cellRole() const;
102 class KItemListAccessibleCell
: public QAccessibleTable2CellInterface
105 KItemListAccessibleCell(KItemListView
* view
, int m_index
);
107 QObject
* object() const;
108 Role
role(int) const;
109 State
state(int) const;
110 QRect
rect(int) const;
111 bool isValid() const;
112 int childAt(int, int) const;
113 int childCount() const;
114 int indexOfChild(const QAccessibleInterface
*) const;
115 QString
text(Text t
, int child
) const;
116 void setText(Text t
, int child
, const QString
& text
);
117 int navigate(RelationFlag relation
, int m_index
, QAccessibleInterface
** interface
) const;
118 Relation
relationTo(int child
, const QAccessibleInterface
* other
, int otherChild
) const;
119 bool isExpandable() const;
122 int userActionCount(int child
) const;
123 QString
actionText(int action
, Text t
, int child
) const;
124 bool doAction(int action
, int child
, const QVariantList
& params
);
128 virtual int columnExtent() const;
129 virtual QList
<QAccessibleInterface
*> columnHeaderCells() const;
130 virtual int columnIndex() const;
131 virtual int rowExtent() const;
132 virtual QList
<QAccessibleInterface
*> rowHeaderCells() const;
133 virtual int rowIndex() const;
134 virtual bool isSelected() const;
135 virtual void rowColumnExtents(int* row
, int* column
, int* rowExtents
, int* columnExtents
, bool* selected
) const;
136 virtual QAccessibleTable2Interface
* table() const;
138 inline int index() const;
141 QPointer
<KItemListView
> m_view
;
145 class KItemListContainerAccessible
: public QAccessibleWidgetEx
150 explicit KItemListContainerAccessible(KItemListContainer
* container
);
151 virtual ~KItemListContainerAccessible();
153 int childCount() const;
154 int indexOfChild(const QAccessibleInterface
* child
) const;
155 int navigate(RelationFlag relation
, int entry
, QAccessibleInterface
** target
) const;
158 const KItemListContainer
* container() const;
161 #endif // QT_NO_ACCESSIBILITY