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;
120 virtual QVariant minimumStepSize() const = 0;
123 class Q_GUI_EXPORT QAccessibleTableCellInterface
126 virtual ~QAccessibleTableCellInterface() {}
128 // Returns the number of columns occupied by this cell accessible.
129 virtual int columnExtent() const = 0;
131 // Returns the column headers as an array of cell accessibles.
132 virtual QList<QAccessibleInterface*> columnHeaderCells() const = 0;
134 // Translates this cell accessible into the corresponding column index.
135 virtual int columnIndex() const = 0;
136 // Returns the number of rows occupied by this cell accessible.
137 virtual int rowExtent() const = 0;
138 // Returns the row headers as an array of cell accessibles.
139 virtual QList<QAccessibleInterface*> rowHeaderCells() const = 0;
140 // Translates this cell accessible into the corresponding row index.
141 virtual int rowIndex() const = 0;
142 // Returns a boolean value indicating whether this cell is selected.
143 virtual bool isSelected() const = 0;
145 // Gets the row and column indexes and extents of this cell accessible and whether or not it is selected.
146 // ### Is this really needed??
148 // ### Maybe change to QSize cellSize(), we already have accessors for the row, column and selected
149 virtual void rowColumnExtents(int *row, int *column, int *rowExtents, int *columnExtents, bool *selected) const = 0;
150 // Returns a reference to the accessbile of the containing table.
151 virtual QAccessibleInterface* table() const = 0;
154 class Q_GUI_EXPORT QAccessibleTableInterface
157 virtual ~QAccessibleTableInterface() {}
159 // Returns the cell at the specified row and column in the table.
160 virtual QAccessibleInterface *cellAt (int row, int column) const = 0;
161 // Returns the caption for the table.
162 virtual QAccessibleInterface *caption() const = 0;
163 // Returns the description text of the specified column in the table.
164 virtual QString columnDescription(int column) const = 0;
165 // Returns the total number of columns in table.
166 virtual int columnCount() const = 0;
167 // Returns the total number of rows in table.
168 virtual int rowCount() const = 0;
169 // Returns the total number of selected cells.
170 virtual int selectedCellCount() const = 0;
171 // Returns the total number of selected columns.
172 virtual int selectedColumnCount() const = 0;
173 // Returns the total number of selected rows.
174 virtual int selectedRowCount() const = 0;
175 // Returns the description text of the specified row in the table.
176 virtual QString rowDescription(int row) const = 0;
177 // Returns a list of accessibles currently selected.
178 virtual QList<QAccessibleInterface*> selectedCells() const = 0;
179 // Returns a list of column indexes currently selected (0 based).
180 virtual QList<int> selectedColumns() const = 0;
181 // Returns a list of row indexes currently selected (0 based).
182 virtual QList<int> selectedRows() const = 0;
183 // Returns the summary description of the table.
184 virtual QAccessibleInterface *summary() const = 0;
185 // Returns a boolean value indicating whether the specified column is completely selected.
186 virtual bool isColumnSelected(int column) const = 0;
187 // Returns a boolean value indicating whether the specified row is completely selected.
188 virtual bool isRowSelected(int row) const = 0;
189 // Selects a row and unselects all previously selected rows.
190 virtual bool selectRow(int row) = 0;
191 // Selects a column and unselects all previously selected columns.
192 virtual bool selectColumn(int column) = 0;
193 // Unselects one row, leaving other selected rows selected (if any).
194 virtual bool unselectRow(int row) = 0;
195 // Unselects one column, leaving other selected columns selected (if any).
196 virtual bool unselectColumn(int column) = 0;
199 friend class QAbstractItemView;
200 friend class QAbstractItemViewPrivate;
203 class Q_GUI_EXPORT QAccessibleActionInterface
205 Q_DECLARE_TR_FUNCTIONS(QAccessibleActionInterface)
207 virtual ~QAccessibleActionInterface() {}
209 virtual QStringList actionNames() const = 0;
210 virtual QString localizedActionName(const QString &name) const;
211 virtual QString localizedActionDescription(const QString &name) const;
212 virtual void doAction(const QString &actionName) = 0;
213 virtual QStringList keyBindingsForAction(const QString &actionName) const = 0;
215 static const QString &pressAction();
216 static const QString &increaseAction();
217 static const QString &decreaseAction();
218 static const QString &showMenuAction();
219 static const QString &setFocusAction();
220 static const QString &toggleAction();
223 class Q_GUI_EXPORT QAccessibleImageInterface
226 virtual ~QAccessibleImageInterface() {}
228 virtual QString imageDescription() const = 0;
229 virtual QSize imageSize() const = 0;
230 virtual QRect imagePosition() const = 0;
233 #endif // QT_NO_ACCESSIBILITY