source: trunk/src/gui/accessible/qaccessible2.h@ 64

Last change on this file since 64 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 8.2 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the QtGui module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
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**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QACCESSIBLE2_H
43#define QACCESSIBLE2_H
44
45#include <QtGui/qaccessible.h>
46
47QT_BEGIN_HEADER
48
49QT_BEGIN_NAMESPACE
50
51QT_MODULE(Gui)
52
53#ifndef QT_NO_ACCESSIBILITY
54
55namespace 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
73class Q_GUI_EXPORT QAccessible2Interface
74{
75public:
76 virtual ~QAccessible2Interface() {}
77};
78
79// catch-all functions. If an accessible class doesn't implement interface T, return 0
80inline QAccessible2Interface *qAccessibleValueCastHelper() { return 0; }
81inline QAccessible2Interface *qAccessibleTextCastHelper() { return 0; }
82inline QAccessible2Interface *qAccessibleEditableTextCastHelper() { return 0; }
83inline QAccessible2Interface *qAccessibleTableCastHelper() { return 0; }
84
85#define Q_ACCESSIBLE_OBJECT \
86 public: \
87 QAccessible2Interface *interface_cast(QAccessible2::InterfaceType t) \
88 { \
89 switch (t) { \
90 case QAccessible2::TextInterface: \
91 return qAccessibleTextCastHelper(); \
92 case QAccessible2::EditableTextInterface: \
93 return qAccessibleEditableTextCastHelper(); \
94 case QAccessible2::ValueInterface: \
95 return qAccessibleValueCastHelper(); \
96 case QAccessible2::TableInterface: \
97 return qAccessibleTableCastHelper(); \
98 } \
99 return 0; \
100 } \
101 private:
102
103class Q_GUI_EXPORT QAccessibleTextInterface: public QAccessible2Interface
104{
105public:
106 inline QAccessible2Interface *qAccessibleTextCastHelper() { return this; }
107
108 virtual ~QAccessibleTextInterface() {}
109
110 virtual void addSelection(int startOffset, int endOffset) = 0;
111 virtual QString attributes(int offset, int *startOffset, int *endOffset) = 0;
112 virtual int cursorPosition() = 0;
113 virtual QRect characterRect(int offset, QAccessible2::CoordinateType coordType) = 0;
114 virtual int selectionCount() = 0;
115 virtual int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType) = 0;
116 virtual void selection(int selectionIndex, int *startOffset, int *endOffset) = 0;
117 virtual QString text(int startOffset, int endOffset) = 0;
118 virtual QString textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType,
119 int *startOffset, int *endOffset) = 0;
120 virtual QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
121 int *startOffset, int *endOffset) = 0;
122 virtual QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
123 int *startOffset, int *endOffset) = 0;
124 virtual void removeSelection(int selectionIndex) = 0;
125 virtual void setCursorPosition(int position) = 0;
126 virtual void setSelection(int selectionIndex, int startOffset, int endOffset) = 0;
127 virtual int characterCount() = 0;
128 virtual void scrollToSubstring(int startIndex, int endIndex) = 0;
129};
130
131class Q_GUI_EXPORT QAccessibleEditableTextInterface: public QAccessible2Interface
132{
133public:
134 inline QAccessible2Interface *qAccessibleEditableTextCastHelper() { return this; }
135
136 virtual ~QAccessibleEditableTextInterface() {}
137
138 virtual void copyText(int startOffset, int endOffset) = 0;
139 virtual void deleteText(int startOffset, int endOffset) = 0;
140 virtual void insertText(int offset, const QString &text) = 0;
141 virtual void cutText(int startOffset, int endOffset) = 0;
142 virtual void pasteText(int offset) = 0;
143 virtual void replaceText(int startOffset, int endOffset, const QString &text) = 0;
144 virtual void setAttributes(int startOffset, int endOffset, const QString &attributes) = 0;
145};
146
147class Q_GUI_EXPORT QAccessibleSimpleEditableTextInterface: public QAccessibleEditableTextInterface
148{
149public:
150 QAccessibleSimpleEditableTextInterface(QAccessibleInterface *accessibleInterface);
151
152 void copyText(int startOffset, int endOffset);
153 void deleteText(int startOffset, int endOffset);
154 void insertText(int offset, const QString &text);
155 void cutText(int startOffset, int endOffset);
156 void pasteText(int offset);
157 void replaceText(int startOffset, int endOffset, const QString &text);
158 inline void setAttributes(int, int, const QString &) {}
159
160private:
161 QAccessibleInterface *iface;
162};
163
164class Q_GUI_EXPORT QAccessibleValueInterface: public QAccessible2Interface
165{
166public:
167 inline QAccessible2Interface *qAccessibleValueCastHelper() { return this; }
168
169 virtual ~QAccessibleValueInterface() {}
170
171 virtual QVariant currentValue() = 0;
172 virtual void setCurrentValue(const QVariant &value) = 0;
173 virtual QVariant maximumValue() = 0;
174 virtual QVariant minimumValue() = 0;
175};
176
177class Q_GUI_EXPORT QAccessibleTableInterface: public QAccessible2Interface
178{
179public:
180 inline QAccessible2Interface *qAccessibleTableCastHelper() { return this; }
181
182 virtual QAccessibleInterface *accessibleAt(int row, int column) = 0;
183 virtual QAccessibleInterface *caption() = 0;
184 virtual int childIndex(int rowIndex, int columnIndex) = 0;
185 virtual QString columnDescription(int column) = 0;
186 virtual int columnSpan(int row, int column) = 0;
187 virtual QAccessibleInterface *columnHeader() = 0;
188 virtual int columnIndex(int childIndex) = 0;
189 virtual int columnCount() = 0;
190 virtual int rowCount() = 0;
191 virtual int selectedColumnCount() = 0;
192 virtual int selectedRowCount() = 0;
193 virtual QString rowDescription(int row) = 0;
194 virtual int rowSpan(int row, int column) = 0;
195 virtual QAccessibleInterface *rowHeader() = 0;
196 virtual int rowIndex(int childIndex) = 0;
197 virtual int selectedRows(int maxRows, QList<int> *rows) = 0;
198 virtual int selectedColumns(int maxColumns, QList<int> *columns) = 0;
199 virtual QAccessibleInterface *summary() = 0;
200 virtual bool isColumnSelected(int column) = 0;
201 virtual bool isRowSelected(int row) = 0;
202 virtual bool isSelected(int row, int column) = 0;
203 virtual void selectRow(int row) = 0;
204 virtual void selectColumn(int column) = 0;
205 virtual void unselectRow(int row) = 0;
206 virtual void unselectColumn(int column) = 0;
207 virtual void cellAtIndex(int index, int *row, int *column, int *rowSpan,
208 int *columnSpan, bool *isSelected) = 0;
209};
210
211#endif // QT_NO_ACCESSIBILITY
212
213QT_END_NAMESPACE
214
215QT_END_HEADER
216
217#endif
Note: See TracBrowser for help on using the repository browser.