|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the QtGui module of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
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 ** |
|
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. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
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; } |
|
84 inline QAccessible2Interface *qAccessibleActionCastHelper() { return 0; } |
|
85 |
|
86 #define Q_ACCESSIBLE_OBJECT \ |
|
87 public: \ |
|
88 QAccessible2Interface *interface_cast(QAccessible2::InterfaceType t) \ |
|
89 { \ |
|
90 switch (t) { \ |
|
91 case QAccessible2::TextInterface: \ |
|
92 return qAccessibleTextCastHelper(); \ |
|
93 case QAccessible2::EditableTextInterface: \ |
|
94 return qAccessibleEditableTextCastHelper(); \ |
|
95 case QAccessible2::ValueInterface: \ |
|
96 return qAccessibleValueCastHelper(); \ |
|
97 case QAccessible2::TableInterface: \ |
|
98 return qAccessibleTableCastHelper(); \ |
|
99 case QAccessible2::ActionInterface: \ |
|
100 return qAccessibleActionCastHelper(); \ |
|
101 } \ |
|
102 return 0; \ |
|
103 } \ |
|
104 private: |
|
105 |
|
106 class Q_GUI_EXPORT QAccessibleTextInterface: public QAccessible2Interface |
|
107 { |
|
108 public: |
|
109 inline QAccessible2Interface *qAccessibleTextCastHelper() { return this; } |
|
110 |
|
111 virtual ~QAccessibleTextInterface() {} |
|
112 |
|
113 virtual void addSelection(int startOffset, int endOffset) = 0; |
|
114 virtual QString attributes(int offset, int *startOffset, int *endOffset) = 0; |
|
115 virtual int cursorPosition() = 0; |
|
116 virtual QRect characterRect(int offset, QAccessible2::CoordinateType coordType) = 0; |
|
117 virtual int selectionCount() = 0; |
|
118 virtual int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType) = 0; |
|
119 virtual void selection(int selectionIndex, int *startOffset, int *endOffset) = 0; |
|
120 virtual QString text(int startOffset, int endOffset) = 0; |
|
121 virtual QString textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType, |
|
122 int *startOffset, int *endOffset) = 0; |
|
123 virtual QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType, |
|
124 int *startOffset, int *endOffset) = 0; |
|
125 virtual QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType, |
|
126 int *startOffset, int *endOffset) = 0; |
|
127 virtual void removeSelection(int selectionIndex) = 0; |
|
128 virtual void setCursorPosition(int position) = 0; |
|
129 virtual void setSelection(int selectionIndex, int startOffset, int endOffset) = 0; |
|
130 virtual int characterCount() = 0; |
|
131 virtual void scrollToSubstring(int startIndex, int endIndex) = 0; |
|
132 }; |
|
133 |
|
134 class Q_GUI_EXPORT QAccessibleEditableTextInterface: public QAccessible2Interface |
|
135 { |
|
136 public: |
|
137 inline QAccessible2Interface *qAccessibleEditableTextCastHelper() { return this; } |
|
138 |
|
139 virtual ~QAccessibleEditableTextInterface() {} |
|
140 |
|
141 virtual void copyText(int startOffset, int endOffset) = 0; |
|
142 virtual void deleteText(int startOffset, int endOffset) = 0; |
|
143 virtual void insertText(int offset, const QString &text) = 0; |
|
144 virtual void cutText(int startOffset, int endOffset) = 0; |
|
145 virtual void pasteText(int offset) = 0; |
|
146 virtual void replaceText(int startOffset, int endOffset, const QString &text) = 0; |
|
147 virtual void setAttributes(int startOffset, int endOffset, const QString &attributes) = 0; |
|
148 }; |
|
149 |
|
150 class Q_GUI_EXPORT QAccessibleSimpleEditableTextInterface: public QAccessibleEditableTextInterface |
|
151 { |
|
152 public: |
|
153 QAccessibleSimpleEditableTextInterface(QAccessibleInterface *accessibleInterface); |
|
154 |
|
155 void copyText(int startOffset, int endOffset); |
|
156 void deleteText(int startOffset, int endOffset); |
|
157 void insertText(int offset, const QString &text); |
|
158 void cutText(int startOffset, int endOffset); |
|
159 void pasteText(int offset); |
|
160 void replaceText(int startOffset, int endOffset, const QString &text); |
|
161 inline void setAttributes(int, int, const QString &) {} |
|
162 |
|
163 private: |
|
164 QAccessibleInterface *iface; |
|
165 }; |
|
166 |
|
167 class Q_GUI_EXPORT QAccessibleValueInterface: public QAccessible2Interface |
|
168 { |
|
169 public: |
|
170 inline QAccessible2Interface *qAccessibleValueCastHelper() { return this; } |
|
171 |
|
172 virtual ~QAccessibleValueInterface() {} |
|
173 |
|
174 virtual QVariant currentValue() = 0; |
|
175 virtual void setCurrentValue(const QVariant &value) = 0; |
|
176 virtual QVariant maximumValue() = 0; |
|
177 virtual QVariant minimumValue() = 0; |
|
178 }; |
|
179 |
|
180 class Q_GUI_EXPORT QAccessibleTableInterface: public QAccessible2Interface |
|
181 { |
|
182 public: |
|
183 inline QAccessible2Interface *qAccessibleTableCastHelper() { return this; } |
|
184 |
|
185 virtual QAccessibleInterface *accessibleAt(int row, int column) = 0; |
|
186 virtual QAccessibleInterface *caption() = 0; |
|
187 virtual int childIndex(int rowIndex, int columnIndex) = 0; |
|
188 virtual QString columnDescription(int column) = 0; |
|
189 virtual int columnSpan(int row, int column) = 0; |
|
190 virtual QAccessibleInterface *columnHeader() = 0; |
|
191 virtual int columnIndex(int childIndex) = 0; |
|
192 virtual int columnCount() = 0; |
|
193 virtual int rowCount() = 0; |
|
194 virtual int selectedColumnCount() = 0; |
|
195 virtual int selectedRowCount() = 0; |
|
196 virtual QString rowDescription(int row) = 0; |
|
197 virtual int rowSpan(int row, int column) = 0; |
|
198 virtual QAccessibleInterface *rowHeader() = 0; |
|
199 virtual int rowIndex(int childIndex) = 0; |
|
200 virtual int selectedRows(int maxRows, QList<int> *rows) = 0; |
|
201 virtual int selectedColumns(int maxColumns, QList<int> *columns) = 0; |
|
202 virtual QAccessibleInterface *summary() = 0; |
|
203 virtual bool isColumnSelected(int column) = 0; |
|
204 virtual bool isRowSelected(int row) = 0; |
|
205 virtual bool isSelected(int row, int column) = 0; |
|
206 virtual void selectRow(int row) = 0; |
|
207 virtual void selectColumn(int column) = 0; |
|
208 virtual void unselectRow(int row) = 0; |
|
209 virtual void unselectColumn(int column) = 0; |
|
210 virtual void cellAtIndex(int index, int *row, int *column, int *rowSpan, |
|
211 int *columnSpan, bool *isSelected) = 0; |
|
212 }; |
|
213 |
|
214 class Q_GUI_EXPORT QAccessibleActionInterface : public QAccessible2Interface |
|
215 { |
|
216 public: |
|
217 inline QAccessible2Interface *qAccessibleActionCastHelper() { return this; } |
|
218 |
|
219 virtual int actionCount() = 0; |
|
220 virtual void doAction(int actionIndex) = 0; |
|
221 virtual QString description(int actionIndex) = 0; |
|
222 virtual QString name(int actionIndex) = 0; |
|
223 virtual QString localizedName(int actionIndex) = 0; |
|
224 virtual QStringList keyBindings(int actionIndex) = 0; |
|
225 }; |
|
226 |
|
227 #endif // QT_NO_ACCESSIBILITY |
|
228 |
|
229 QT_END_NAMESPACE |
|
230 |
|
231 QT_END_HEADER |
|
232 |
|
233 #endif |