1 /****************************************************************************
3 ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
6 ** This file is part of the QtGui module of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
40 ****************************************************************************/
42 #ifndef QACCESSIBLE2_H
43 #define QACCESSIBLE2_H
45 #include <QtGui/qaccessible.h>
46 #include <QtCore/qcoreapplication.h>
53 #ifndef QT_NO_ACCESSIBILITY
55 namespace QAccessible2
67 class Q_GUI_EXPORT QAccessibleTextInterface
70 virtual ~QAccessibleTextInterface() {}
72 virtual void selection(int selectionIndex, int *startOffset, int *endOffset) const = 0;
73 virtual int selectionCount() const = 0;
74 virtual void addSelection(int startOffset, int endOffset) = 0;
75 virtual void removeSelection(int selectionIndex) = 0;
76 virtual void setSelection(int selectionIndex, int startOffset, int endOffset) = 0;
79 virtual int cursorPosition() const = 0;
80 virtual void setCursorPosition(int position) = 0;
83 virtual QString text(int startOffset, int endOffset) const = 0;
84 virtual QString textBeforeOffset(int offset, QAccessible2::BoundaryType boundaryType,
85 int *startOffset, int *endOffset) const;
86 virtual QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
87 int *startOffset, int *endOffset) const;
88 virtual QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
89 int *startOffset, int *endOffset) const;
90 virtual int characterCount() const = 0;
92 // character <-> geometry
93 virtual QRect characterRect(int offset) const = 0;
94 virtual int offsetAtPoint(const QPoint &point) const = 0;
96 virtual void scrollToSubstring(int startIndex, int endIndex) = 0;
97 virtual QString attributes(int offset, int *startOffset, int *endOffset) const = 0;
100 class Q_GUI_EXPORT QAccessibleEditableTextInterface
103 virtual ~QAccessibleEditableTextInterface() {}
105 virtual void deleteText(int startOffset, int endOffset) = 0;
106 virtual void insertText(int offset, const QString &text) = 0;
107 virtual void replaceText(int startOffset, int endOffset, const QString &text) = 0;
110 class Q_GUI_EXPORT QAccessibleValueInterface
114 virtual ~QAccessibleValueInterface() {}
116 virtual QVariant currentValue() const = 0;
117 virtual void setCurrentValue(const QVariant &value) = 0;
118 virtual QVariant maximumValue() const = 0;
119 virtual QVariant minimumValue() const = 0;
122 class Q_GUI_EXPORT QAccessibleTableCellInterface
125 virtual ~QAccessibleTableCellInterface() {}
127 // Returns the number of columns occupied by this cell accessible.
128 virtual int columnExtent() const = 0;
130 // Returns the column headers as an array of cell accessibles.
131 virtual QList<QAccessibleInterface*> columnHeaderCells() const = 0;
133 // Translates this cell accessible into the corresponding column index.
134 virtual int columnIndex() const = 0;
135 // Returns the number of rows occupied by this cell accessible.
136 virtual int rowExtent() const = 0;
137 // Returns the row headers as an array of cell accessibles.
138 virtual QList<QAccessibleInterface*> rowHeaderCells() const = 0;
139 // Translates this cell accessible into the corresponding row index.
140 virtual int rowIndex() const = 0;
141 // Returns a boolean value indicating whether this cell is selected.
142 virtual bool isSelected() const = 0;
144 // Gets the row and column indexes and extents of this cell accessible and whether or not it is selected.
145 // ### Is this really needed??
147 // ### Maybe change to QSize cellSize(), we already have accessors for the row, column and selected
148 virtual void rowColumnExtents(int *row, int *column, int *rowExtents, int *columnExtents, bool *selected) const = 0;
149 // Returns a reference to the accessbile of the containing table.
150 virtual QAccessibleInterface* table() const = 0;
153 class Q_GUI_EXPORT QAccessibleTableInterface
156 virtual ~QAccessibleTableInterface() {}
158 // Returns the cell at the specified row and column in the table.
159 virtual QAccessibleInterface *cellAt (int row, int column) const = 0;
160 // Returns the caption for the table.
161 virtual QAccessibleInterface *caption() const = 0;
162 // Returns the description text of the specified column in the table.
163 virtual QString columnDescription(int column) const = 0;
164 // Returns the total number of columns in table.
165 virtual int columnCount() const = 0;
166 // Returns the total number of rows in table.
167 virtual int rowCount() const = 0;
168 // Returns the total number of selected cells.
169 virtual int selectedCellCount() const = 0;
170 // Returns the total number of selected columns.
171 virtual int selectedColumnCount() const = 0;
172 // Returns the total number of selected rows.
173 virtual int selectedRowCount() const = 0;
174 // Returns the description text of the specified row in the table.
175 virtual QString rowDescription(int row) const = 0;
176 // Returns a list of accessibles currently selected.
177 virtual QList<QAccessibleInterface*> selectedCells() const = 0;
178 // Returns a list of column indexes currently selected (0 based).
179 virtual QList<int> selectedColumns() const = 0;
180 // Returns a list of row indexes currently selected (0 based).
181 virtual QList<int> selectedRows() const = 0;
182 // Returns the summary description of the table.
183 virtual QAccessibleInterface *summary() const = 0;
184 // Returns a boolean value indicating whether the specified column is completely selected.
185 virtual bool isColumnSelected(int column) const = 0;
186 // Returns a boolean value indicating whether the specified row is completely selected.
187 virtual bool isRowSelected(int row) const = 0;
188 // Selects a row and unselects all previously selected rows.
189 virtual bool selectRow(int row) = 0;
190 // Selects a column and unselects all previously selected columns.
191 virtual bool selectColumn(int column) = 0;
192 // Unselects one row, leaving other selected rows selected (if any).
193 virtual bool unselectRow(int row) = 0;
194 // Unselects one column, leaving other selected columns selected (if any).
195 virtual bool unselectColumn(int column) = 0;
198 friend class QAbstractItemView;
199 friend class QAbstractItemViewPrivate;
202 class Q_GUI_EXPORT QAccessibleActionInterface
204 Q_DECLARE_TR_FUNCTIONS(QAccessibleActionInterface)
206 virtual ~QAccessibleActionInterface() {}
208 virtual QStringList actionNames() const = 0;
209 virtual QString localizedActionName(const QString &name) const;
210 virtual QString localizedActionDescription(const QString &name) const;
211 virtual void doAction(const QString &actionName) = 0;
212 virtual QStringList keyBindingsForAction(const QString &actionName) const = 0;
214 static const QString &pressAction();
215 static const QString &increaseAction();
216 static const QString &decreaseAction();
217 static const QString &showMenuAction();
218 static const QString &setFocusAction();
219 static const QString &toggleAction();
222 class Q_GUI_EXPORT QAccessibleImageInterface
225 virtual ~QAccessibleImageInterface() {}
227 virtual QString imageDescription() const = 0;
228 virtual QSize imageSize() const = 0;
229 virtual QRect imagePosition() const = 0;
232 #endif // QT_NO_ACCESSIBILITY