[2] | 1 | /****************************************************************************
|
---|
| 2 | **
|
---|
[846] | 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
[561] | 4 | ** All rights reserved.
|
---|
| 5 | ** Contact: Nokia Corporation (qt-info@nokia.com)
|
---|
[2] | 6 | **
|
---|
| 7 | ** This file is part of the QtGui module of the Qt Toolkit.
|
---|
| 8 | **
|
---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
| 10 | ** Commercial Usage
|
---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
| 14 | ** a written agreement between you and Nokia.
|
---|
| 15 | **
|
---|
| 16 | ** GNU Lesser General Public License Usage
|
---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
| 18 | ** General Public License version 2.1 as published by the Free Software
|
---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
| 20 | ** packaging of this file. Please review the following information to
|
---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
| 23 | **
|
---|
[561] | 24 | ** In addition, as a special exception, Nokia gives you certain additional
|
---|
| 25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
---|
[2] | 27 | **
|
---|
| 28 | ** GNU General Public License Usage
|
---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
| 32 | ** packaging of this file. Please review the following information to
|
---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
| 35 | **
|
---|
[561] | 36 | ** If you have questions regarding the use of this file, please contact
|
---|
| 37 | ** Nokia at qt-info@nokia.com.
|
---|
[2] | 38 | ** $QT_END_LICENSE$
|
---|
| 39 | **
|
---|
| 40 | ****************************************************************************/
|
---|
| 41 |
|
---|
| 42 | #ifndef QACCESSIBLE2_H
|
---|
| 43 | #define QACCESSIBLE2_H
|
---|
| 44 |
|
---|
| 45 | #include <QtGui/qaccessible.h>
|
---|
| 46 |
|
---|
| 47 | QT_BEGIN_HEADER
|
---|
| 48 |
|
---|
| 49 | QT_BEGIN_NAMESPACE
|
---|
| 50 |
|
---|
| 51 | QT_MODULE(Gui)
|
---|
| 52 |
|
---|
| 53 | #ifndef QT_NO_ACCESSIBILITY
|
---|
| 54 |
|
---|
| 55 | namespace QAccessible2
|
---|
| 56 | {
|
---|
| 57 | enum CoordinateType
|
---|
| 58 | {
|
---|
| 59 | RelativeToScreen = 0,
|
---|
| 60 | RelativeToParent = 1
|
---|
| 61 | };
|
---|
| 62 |
|
---|
| 63 | enum BoundaryType {
|
---|
| 64 | CharBoundary,
|
---|
| 65 | WordBoundary,
|
---|
| 66 | SentenceBoundary,
|
---|
| 67 | ParagraphBoundary,
|
---|
| 68 | LineBoundary,
|
---|
| 69 | NoBoundary
|
---|
| 70 | };
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | class Q_GUI_EXPORT QAccessible2Interface
|
---|
| 74 | {
|
---|
| 75 | public:
|
---|
| 76 | virtual ~QAccessible2Interface() {}
|
---|
| 77 | };
|
---|
| 78 |
|
---|
| 79 | // catch-all functions. If an accessible class doesn't implement interface T, return 0
|
---|
| 80 | inline QAccessible2Interface *qAccessibleValueCastHelper() { return 0; }
|
---|
| 81 | inline QAccessible2Interface *qAccessibleTextCastHelper() { return 0; }
|
---|
| 82 | inline QAccessible2Interface *qAccessibleEditableTextCastHelper() { return 0; }
|
---|
| 83 | inline QAccessible2Interface *qAccessibleTableCastHelper() { return 0; }
|
---|
[561] | 84 | inline QAccessible2Interface *qAccessibleActionCastHelper() { return 0; }
|
---|
| 85 | inline QAccessible2Interface *qAccessibleImageCastHelper() { return 0; }
|
---|
[2] | 86 |
|
---|
| 87 | #define Q_ACCESSIBLE_OBJECT \
|
---|
| 88 | public: \
|
---|
| 89 | QAccessible2Interface *interface_cast(QAccessible2::InterfaceType t) \
|
---|
| 90 | { \
|
---|
| 91 | switch (t) { \
|
---|
| 92 | case QAccessible2::TextInterface: \
|
---|
| 93 | return qAccessibleTextCastHelper(); \
|
---|
| 94 | case QAccessible2::EditableTextInterface: \
|
---|
| 95 | return qAccessibleEditableTextCastHelper(); \
|
---|
| 96 | case QAccessible2::ValueInterface: \
|
---|
| 97 | return qAccessibleValueCastHelper(); \
|
---|
| 98 | case QAccessible2::TableInterface: \
|
---|
| 99 | return qAccessibleTableCastHelper(); \
|
---|
[561] | 100 | case QAccessible2::ActionInterface: \
|
---|
| 101 | return qAccessibleActionCastHelper(); \
|
---|
| 102 | case QAccessible2::ImageInterface: \
|
---|
| 103 | return qAccessibleImageCastHelper(); \
|
---|
[2] | 104 | } \
|
---|
| 105 | return 0; \
|
---|
| 106 | } \
|
---|
| 107 | private:
|
---|
| 108 |
|
---|
| 109 | class Q_GUI_EXPORT QAccessibleTextInterface: public QAccessible2Interface
|
---|
| 110 | {
|
---|
| 111 | public:
|
---|
| 112 | inline QAccessible2Interface *qAccessibleTextCastHelper() { return this; }
|
---|
| 113 |
|
---|
| 114 | virtual ~QAccessibleTextInterface() {}
|
---|
| 115 |
|
---|
| 116 | virtual void addSelection(int startOffset, int endOffset) = 0;
|
---|
| 117 | virtual QString attributes(int offset, int *startOffset, int *endOffset) = 0;
|
---|
| 118 | virtual int cursorPosition() = 0;
|
---|
| 119 | virtual QRect characterRect(int offset, QAccessible2::CoordinateType coordType) = 0;
|
---|
| 120 | virtual int selectionCount() = 0;
|
---|
| 121 | virtual int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType) = 0;
|
---|
| 122 | virtual void selection(int selectionIndex, int *startOffset, int *endOffset) = 0;
|
---|
| 123 | virtual QString text(int startOffset, int endOffset) = 0;
|
---|
| 124 | virtual QString textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType,
|
---|
| 125 | int *startOffset, int *endOffset) = 0;
|
---|
| 126 | virtual QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
|
---|
| 127 | int *startOffset, int *endOffset) = 0;
|
---|
| 128 | virtual QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
|
---|
| 129 | int *startOffset, int *endOffset) = 0;
|
---|
| 130 | virtual void removeSelection(int selectionIndex) = 0;
|
---|
| 131 | virtual void setCursorPosition(int position) = 0;
|
---|
| 132 | virtual void setSelection(int selectionIndex, int startOffset, int endOffset) = 0;
|
---|
| 133 | virtual int characterCount() = 0;
|
---|
| 134 | virtual void scrollToSubstring(int startIndex, int endIndex) = 0;
|
---|
| 135 | };
|
---|
| 136 |
|
---|
| 137 | class Q_GUI_EXPORT QAccessibleEditableTextInterface: public QAccessible2Interface
|
---|
| 138 | {
|
---|
| 139 | public:
|
---|
| 140 | inline QAccessible2Interface *qAccessibleEditableTextCastHelper() { return this; }
|
---|
| 141 |
|
---|
| 142 | virtual ~QAccessibleEditableTextInterface() {}
|
---|
| 143 |
|
---|
| 144 | virtual void copyText(int startOffset, int endOffset) = 0;
|
---|
| 145 | virtual void deleteText(int startOffset, int endOffset) = 0;
|
---|
| 146 | virtual void insertText(int offset, const QString &text) = 0;
|
---|
| 147 | virtual void cutText(int startOffset, int endOffset) = 0;
|
---|
| 148 | virtual void pasteText(int offset) = 0;
|
---|
| 149 | virtual void replaceText(int startOffset, int endOffset, const QString &text) = 0;
|
---|
| 150 | virtual void setAttributes(int startOffset, int endOffset, const QString &attributes) = 0;
|
---|
| 151 | };
|
---|
| 152 |
|
---|
| 153 | class Q_GUI_EXPORT QAccessibleSimpleEditableTextInterface: public QAccessibleEditableTextInterface
|
---|
| 154 | {
|
---|
| 155 | public:
|
---|
| 156 | QAccessibleSimpleEditableTextInterface(QAccessibleInterface *accessibleInterface);
|
---|
| 157 |
|
---|
| 158 | void copyText(int startOffset, int endOffset);
|
---|
| 159 | void deleteText(int startOffset, int endOffset);
|
---|
| 160 | void insertText(int offset, const QString &text);
|
---|
| 161 | void cutText(int startOffset, int endOffset);
|
---|
| 162 | void pasteText(int offset);
|
---|
| 163 | void replaceText(int startOffset, int endOffset, const QString &text);
|
---|
| 164 | inline void setAttributes(int, int, const QString &) {}
|
---|
| 165 |
|
---|
| 166 | private:
|
---|
| 167 | QAccessibleInterface *iface;
|
---|
| 168 | };
|
---|
| 169 |
|
---|
| 170 | class Q_GUI_EXPORT QAccessibleValueInterface: public QAccessible2Interface
|
---|
| 171 | {
|
---|
| 172 | public:
|
---|
| 173 | inline QAccessible2Interface *qAccessibleValueCastHelper() { return this; }
|
---|
| 174 |
|
---|
| 175 | virtual ~QAccessibleValueInterface() {}
|
---|
| 176 |
|
---|
| 177 | virtual QVariant currentValue() = 0;
|
---|
| 178 | virtual void setCurrentValue(const QVariant &value) = 0;
|
---|
| 179 | virtual QVariant maximumValue() = 0;
|
---|
| 180 | virtual QVariant minimumValue() = 0;
|
---|
| 181 | };
|
---|
| 182 |
|
---|
| 183 | class Q_GUI_EXPORT QAccessibleTableInterface: public QAccessible2Interface
|
---|
| 184 | {
|
---|
| 185 | public:
|
---|
| 186 | inline QAccessible2Interface *qAccessibleTableCastHelper() { return this; }
|
---|
| 187 |
|
---|
| 188 | virtual QAccessibleInterface *accessibleAt(int row, int column) = 0;
|
---|
| 189 | virtual QAccessibleInterface *caption() = 0;
|
---|
| 190 | virtual int childIndex(int rowIndex, int columnIndex) = 0;
|
---|
| 191 | virtual QString columnDescription(int column) = 0;
|
---|
| 192 | virtual int columnSpan(int row, int column) = 0;
|
---|
| 193 | virtual QAccessibleInterface *columnHeader() = 0;
|
---|
| 194 | virtual int columnIndex(int childIndex) = 0;
|
---|
| 195 | virtual int columnCount() = 0;
|
---|
| 196 | virtual int rowCount() = 0;
|
---|
| 197 | virtual int selectedColumnCount() = 0;
|
---|
| 198 | virtual int selectedRowCount() = 0;
|
---|
| 199 | virtual QString rowDescription(int row) = 0;
|
---|
| 200 | virtual int rowSpan(int row, int column) = 0;
|
---|
| 201 | virtual QAccessibleInterface *rowHeader() = 0;
|
---|
| 202 | virtual int rowIndex(int childIndex) = 0;
|
---|
| 203 | virtual int selectedRows(int maxRows, QList<int> *rows) = 0;
|
---|
| 204 | virtual int selectedColumns(int maxColumns, QList<int> *columns) = 0;
|
---|
| 205 | virtual QAccessibleInterface *summary() = 0;
|
---|
| 206 | virtual bool isColumnSelected(int column) = 0;
|
---|
| 207 | virtual bool isRowSelected(int row) = 0;
|
---|
| 208 | virtual bool isSelected(int row, int column) = 0;
|
---|
| 209 | virtual void selectRow(int row) = 0;
|
---|
| 210 | virtual void selectColumn(int column) = 0;
|
---|
| 211 | virtual void unselectRow(int row) = 0;
|
---|
| 212 | virtual void unselectColumn(int column) = 0;
|
---|
| 213 | virtual void cellAtIndex(int index, int *row, int *column, int *rowSpan,
|
---|
| 214 | int *columnSpan, bool *isSelected) = 0;
|
---|
| 215 | };
|
---|
| 216 |
|
---|
[561] | 217 | class Q_GUI_EXPORT QAccessibleActionInterface : public QAccessible2Interface
|
---|
| 218 | {
|
---|
| 219 | public:
|
---|
| 220 | inline QAccessible2Interface *qAccessibleActionCastHelper() { return this; }
|
---|
| 221 |
|
---|
| 222 | virtual int actionCount() = 0;
|
---|
| 223 | virtual void doAction(int actionIndex) = 0;
|
---|
| 224 | virtual QString description(int actionIndex) = 0;
|
---|
| 225 | virtual QString name(int actionIndex) = 0;
|
---|
| 226 | virtual QString localizedName(int actionIndex) = 0;
|
---|
| 227 | virtual QStringList keyBindings(int actionIndex) = 0;
|
---|
| 228 | };
|
---|
| 229 |
|
---|
| 230 | class Q_GUI_EXPORT QAccessibleImageInterface : public QAccessible2Interface
|
---|
| 231 | {
|
---|
| 232 | public:
|
---|
| 233 | inline QAccessible2Interface *qAccessibleImageCastHelper() { return this; }
|
---|
| 234 |
|
---|
| 235 | virtual QString imageDescription() = 0;
|
---|
| 236 | virtual QSize imageSize() = 0;
|
---|
| 237 | virtual QRect imagePosition(QAccessible2::CoordinateType coordType) = 0;
|
---|
| 238 | };
|
---|
| 239 |
|
---|
[2] | 240 | #endif // QT_NO_ACCESSIBILITY
|
---|
| 241 |
|
---|
| 242 | QT_END_NAMESPACE
|
---|
| 243 |
|
---|
| 244 | QT_END_HEADER
|
---|
| 245 |
|
---|
| 246 | #endif
|
---|