1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2011 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 plugins 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 | **
|
---|
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 | ** 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 have questions regarding the use of this file, please contact
|
---|
37 | ** Nokia at qt-info@nokia.com.
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | #ifndef COMPLEXWIDGETS_H
|
---|
43 | #define COMPLEXWIDGETS_H
|
---|
44 |
|
---|
45 | #include <QtCore/qpointer.h>
|
---|
46 | #include <QtGui/qaccessiblewidget.h>
|
---|
47 | #include <QtGui/qabstractitemview.h>
|
---|
48 | #include <QtGui/qaccessible2.h>
|
---|
49 |
|
---|
50 | QT_BEGIN_NAMESPACE
|
---|
51 |
|
---|
52 | #ifndef QT_NO_ACCESSIBILITY
|
---|
53 |
|
---|
54 | class QAbstractButton;
|
---|
55 | class QHeaderView;
|
---|
56 | class QTabBar;
|
---|
57 | class QComboBox;
|
---|
58 | class QTitleBar;
|
---|
59 | class QAbstractScrollArea;
|
---|
60 | class QScrollArea;
|
---|
61 |
|
---|
62 | #ifndef QT_NO_SCROLLAREA
|
---|
63 | class QAccessibleAbstractScrollArea : public QAccessibleWidgetEx
|
---|
64 | {
|
---|
65 | public:
|
---|
66 | explicit QAccessibleAbstractScrollArea(QWidget *widget);
|
---|
67 |
|
---|
68 | enum AbstractScrollAreaElement {
|
---|
69 | Self = 0,
|
---|
70 | Viewport,
|
---|
71 | HorizontalContainer,
|
---|
72 | VerticalContainer,
|
---|
73 | CornerWidget,
|
---|
74 | Undefined
|
---|
75 | };
|
---|
76 |
|
---|
77 | QString text(Text textType, int child) const;
|
---|
78 | void setText(Text textType, int child, const QString &text);
|
---|
79 | State state(int child) const;
|
---|
80 | QVariant invokeMethodEx(QAccessible::Method method, int child, const QVariantList ¶ms);
|
---|
81 | int childCount() const;
|
---|
82 | int indexOfChild(const QAccessibleInterface *child) const;
|
---|
83 | bool isValid() const;
|
---|
84 | int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const;
|
---|
85 | QRect rect(int child) const;
|
---|
86 | int childAt(int x, int y) const;
|
---|
87 |
|
---|
88 | //protected:
|
---|
89 | QAbstractScrollArea *abstractScrollArea() const;
|
---|
90 |
|
---|
91 | private:
|
---|
92 | QWidgetList accessibleChildren() const;
|
---|
93 | AbstractScrollAreaElement elementType(QWidget *widget) const;
|
---|
94 | bool isLeftToRight() const;
|
---|
95 | };
|
---|
96 |
|
---|
97 | class QAccessibleScrollArea : public QAccessibleAbstractScrollArea
|
---|
98 | {
|
---|
99 | public:
|
---|
100 | explicit QAccessibleScrollArea(QWidget *widget);
|
---|
101 | };
|
---|
102 |
|
---|
103 | #endif // QT_NO_SCROLLAREA
|
---|
104 |
|
---|
105 | #ifndef QT_NO_ITEMVIEWS
|
---|
106 | class QAccessibleHeader : public QAccessibleWidgetEx
|
---|
107 | {
|
---|
108 | Q_ACCESSIBLE_OBJECT
|
---|
109 | public:
|
---|
110 | explicit QAccessibleHeader(QWidget *w);
|
---|
111 |
|
---|
112 | int childCount() const;
|
---|
113 |
|
---|
114 | QRect rect(int child) const;
|
---|
115 | QString text(Text t, int child) const;
|
---|
116 | Role role(int child) const;
|
---|
117 | State state(int child) const;
|
---|
118 |
|
---|
119 | protected:
|
---|
120 | QHeaderView *header() const;
|
---|
121 | };
|
---|
122 |
|
---|
123 | class QAccessibleItemRow: public QAccessibleInterface
|
---|
124 | {
|
---|
125 | friend class QAccessibleItemView;
|
---|
126 | public:
|
---|
127 | QAccessibleItemRow(QAbstractItemView *view, const QModelIndex &index = QModelIndex(), bool isHeader = false);
|
---|
128 | QRect rect(int child) const;
|
---|
129 | QString text(Text t, int child) const;
|
---|
130 | void setText(Text t, int child, const QString &text);
|
---|
131 | bool isValid() const;
|
---|
132 | QObject *object() const;
|
---|
133 | Role role(int child) const;
|
---|
134 | State state(int child) const;
|
---|
135 |
|
---|
136 | int childCount() const;
|
---|
137 | int indexOfChild(const QAccessibleInterface *) const;
|
---|
138 | QList<QModelIndex> children() const;
|
---|
139 |
|
---|
140 | Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
|
---|
141 | int childAt(int x, int y) const;
|
---|
142 | int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const;
|
---|
143 |
|
---|
144 | int userActionCount(int child) const;
|
---|
145 | QString actionText(int action, Text t, int child) const;
|
---|
146 | bool doAction(int action, int child, const QVariantList ¶ms = QVariantList());
|
---|
147 |
|
---|
148 | QModelIndex childIndex(int child) const;
|
---|
149 |
|
---|
150 | QHeaderView *horizontalHeader() const; //used by QAccessibleItemView
|
---|
151 | private:
|
---|
152 | static QAbstractItemView::CursorAction toCursorAction(Relation rel);
|
---|
153 | int logicalFromChild(QHeaderView *header, int child) const;
|
---|
154 | int treeLevel() const;
|
---|
155 | QHeaderView *verticalHeader() const;
|
---|
156 | QString text_helper(int child) const;
|
---|
157 |
|
---|
158 | QPersistentModelIndex row;
|
---|
159 | QPointer<QAbstractItemView> view;
|
---|
160 | bool m_header;
|
---|
161 | };
|
---|
162 |
|
---|
163 | class QAccessibleItemView: public QAccessibleAbstractScrollArea, public QAccessibleTableInterface
|
---|
164 | {
|
---|
165 | Q_ACCESSIBLE_OBJECT
|
---|
166 | public:
|
---|
167 | explicit QAccessibleItemView(QWidget *w);
|
---|
168 |
|
---|
169 | QObject *object() const;
|
---|
170 | Role role(int child) const;
|
---|
171 | State state(int child) const;
|
---|
172 | QRect rect(int child) const;
|
---|
173 | int childAt(int x, int y) const;
|
---|
174 | int childCount() const;
|
---|
175 | QString text(Text t, int child) const;
|
---|
176 | void setText(Text t, int child, const QString &text);
|
---|
177 | int indexOfChild(const QAccessibleInterface *iface) const;
|
---|
178 |
|
---|
179 | QModelIndex childIndex(int child) const;
|
---|
180 | int entryFromIndex(const QModelIndex &index) const;
|
---|
181 | bool isValid() const;
|
---|
182 | int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const;
|
---|
183 |
|
---|
184 | QAccessibleInterface *accessibleAt(int row, int column);
|
---|
185 | QAccessibleInterface *caption();
|
---|
186 | int childIndex(int rowIndex, int columnIndex);
|
---|
187 | QString columnDescription(int column);
|
---|
188 | int columnSpan(int row, int column);
|
---|
189 | QAccessibleInterface *columnHeader();
|
---|
190 | int columnIndex(int childIndex);
|
---|
191 | int columnCount();
|
---|
192 | int rowCount();
|
---|
193 | int selectedColumnCount();
|
---|
194 | int selectedRowCount();
|
---|
195 | QString rowDescription(int row);
|
---|
196 | int rowSpan(int row, int column);
|
---|
197 | QAccessibleInterface *rowHeader();
|
---|
198 | int rowIndex(int childIndex);
|
---|
199 | int selectedRows(int maxRows, QList<int> *rows);
|
---|
200 | int selectedColumns(int maxColumns, QList<int> *columns);
|
---|
201 | QAccessibleInterface *summary();
|
---|
202 | bool isColumnSelected(int column);
|
---|
203 | bool isRowSelected(int row);
|
---|
204 | bool isSelected(int row, int column);
|
---|
205 | void selectRow(int row);
|
---|
206 | void selectColumn(int column);
|
---|
207 | void unselectRow(int row);
|
---|
208 | void unselectColumn(int column);
|
---|
209 | void cellAtIndex(int index, int *row, int *column, int *rowSpan,
|
---|
210 | int *columnSpan, bool *isSelected);
|
---|
211 |
|
---|
212 | QHeaderView *horizontalHeader() const;
|
---|
213 | QHeaderView *verticalHeader() const;
|
---|
214 | bool isValidChildRole(QAccessible::Role role) const;
|
---|
215 |
|
---|
216 | protected:
|
---|
217 | QAbstractItemView *itemView() const;
|
---|
218 | QModelIndex index(int row, int column) const;
|
---|
219 |
|
---|
220 | private:
|
---|
221 | inline bool atViewport() const {
|
---|
222 | return atVP;
|
---|
223 | };
|
---|
224 | QAccessible::Role expectedRoleOfChildren() const;
|
---|
225 |
|
---|
226 | bool atVP;
|
---|
227 | };
|
---|
228 |
|
---|
229 | #endif
|
---|
230 |
|
---|
231 | #ifndef QT_NO_TABBAR
|
---|
232 | class QAccessibleTabBar : public QAccessibleWidgetEx
|
---|
233 | {
|
---|
234 | Q_ACCESSIBLE_OBJECT
|
---|
235 | public:
|
---|
236 | explicit QAccessibleTabBar(QWidget *w);
|
---|
237 |
|
---|
238 | int childCount() const;
|
---|
239 |
|
---|
240 | QRect rect(int child) const;
|
---|
241 | QString text(Text t, int child) const;
|
---|
242 | Role role(int child) const;
|
---|
243 | State state(int child) const;
|
---|
244 |
|
---|
245 | bool doAction(int action, int child, const QVariantList ¶ms);
|
---|
246 | bool setSelected(int child, bool on, bool extend);
|
---|
247 | QVector<int> selection() const;
|
---|
248 |
|
---|
249 | protected:
|
---|
250 | QTabBar *tabBar() const;
|
---|
251 |
|
---|
252 | private:
|
---|
253 | QAbstractButton *button(int child) const;
|
---|
254 | };
|
---|
255 | #endif // QT_NO_TABBAR
|
---|
256 |
|
---|
257 | #ifndef QT_NO_COMBOBOX
|
---|
258 | class QAccessibleComboBox : public QAccessibleWidgetEx
|
---|
259 | {
|
---|
260 | Q_ACCESSIBLE_OBJECT
|
---|
261 | public:
|
---|
262 | explicit QAccessibleComboBox(QWidget *w);
|
---|
263 |
|
---|
264 | enum ComboBoxElements {
|
---|
265 | ComboBoxSelf = 0,
|
---|
266 | CurrentText,
|
---|
267 | OpenList,
|
---|
268 | PopupList
|
---|
269 | };
|
---|
270 |
|
---|
271 | int childCount() const;
|
---|
272 | int childAt(int x, int y) const;
|
---|
273 | int indexOfChild(const QAccessibleInterface *child) const;
|
---|
274 | int navigate(RelationFlag rel, int entry, QAccessibleInterface **target) const;
|
---|
275 |
|
---|
276 | QString text(Text t, int child) const;
|
---|
277 | QRect rect(int child) const;
|
---|
278 | Role role(int child) const;
|
---|
279 | State state(int child) const;
|
---|
280 |
|
---|
281 | bool doAction(int action, int child, const QVariantList ¶ms);
|
---|
282 | QString actionText(int action, Text t, int child) const;
|
---|
283 |
|
---|
284 | protected:
|
---|
285 | QComboBox *comboBox() const;
|
---|
286 | };
|
---|
287 | #endif // QT_NO_COMBOBOX
|
---|
288 |
|
---|
289 | #endif // QT_NO_ACCESSIBILITY
|
---|
290 |
|
---|
291 | QT_END_NAMESPACE
|
---|
292 |
|
---|
293 | #endif // COMPLEXWIDGETS_H
|
---|