1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the plugins of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #ifndef QACCESSIBLEWIDGETS_H
43 #define QACCESSIBLEWIDGETS_H
45 #include <QtGui/qaccessible2.h>
46 #include <QtWidgets/qaccessiblewidget.h>
48 #ifndef QT_NO_ACCESSIBILITY
50 #include <QtCore/QPointer>
62 class QCalendarWidget;
63 class QAbstractItemView;
65 class QDockWidgetLayout;
68 #ifndef QT_NO_TEXTEDIT
69 class QAccessibleTextEdit : public QAccessibleWidget, public QAccessibleTextInterface,
70 public QAccessibleEditableTextInterface
73 explicit QAccessibleTextEdit(QWidget *o);
75 QString text(QAccessible::Text t) const;
76 void setText(QAccessible::Text t, const QString &text);
78 void *interface_cast(QAccessible::InterfaceType t);
80 // QAccessibleTextInterface
81 void addSelection(int startOffset, int endOffset);
82 QString attributes(int offset, int *startOffset, int *endOffset) const;
83 int cursorPosition() const;
84 QRect characterRect(int offset, QAccessible2::CoordinateType coordType) const;
85 int selectionCount() const;
86 int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType) const;
87 void selection(int selectionIndex, int *startOffset, int *endOffset) const;
88 QString text(int startOffset, int endOffset) const;
89 QString textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType,
90 int *startOffset, int *endOffset) const;
91 QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
92 int *startOffset, int *endOffset) const;
93 QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
94 int *startOffset, int *endOffset) const;
95 void removeSelection(int selectionIndex);
96 void setCursorPosition(int position);
97 void setSelection(int selectionIndex, int startOffset, int endOffset);
98 int characterCount() const;
99 void scrollToSubstring(int startIndex, int endIndex);
101 // QAccessibleEditableTextInterface
102 void copyText(int startOffset, int endOffset) const;
103 void deleteText(int startOffset, int endOffset);
104 void insertText(int offset, const QString &text);
105 void cutText(int startOffset, int endOffset);
106 void pasteText(int offset);
107 void replaceText(int startOffset, int endOffset, const QString &text);
108 void setAttributes(int startOffset, int endOffset, const QString &attributes);
111 QTextEdit *textEdit() const;
116 #endif // QT_NO_TEXTEDIT
118 class QAccessibleStackedWidget : public QAccessibleWidget
121 explicit QAccessibleStackedWidget(QWidget *widget);
123 QAccessibleInterface *childAt(int x, int y) const;
124 int childCount() const;
125 int indexOfChild(const QAccessibleInterface *child) const;
126 QAccessibleInterface *child(int index) const;
129 QStackedWidget *stackedWidget() const;
132 class QAccessibleToolBox : public QAccessibleWidget
135 explicit QAccessibleToolBox(QWidget *widget);
137 // FIXME we currently expose the toolbox but it is not keyboard navigatable
138 // and the accessible hierarchy is not exactly beautiful.
139 // int childCount() const;
140 // QAccessibleInterface *child(int index) const;
141 // int indexOfChild(const QAccessibleInterface *child) const;
144 QToolBox *toolBox() const;
147 #ifndef QT_NO_MDIAREA
148 class QAccessibleMdiArea : public QAccessibleWidget
151 explicit QAccessibleMdiArea(QWidget *widget);
153 int childCount() const;
154 QAccessibleInterface *child(int index) const;
155 int indexOfChild(const QAccessibleInterface *child) const;
158 QMdiArea *mdiArea() const;
161 class QAccessibleMdiSubWindow : public QAccessibleWidget
164 explicit QAccessibleMdiSubWindow(QWidget *widget);
166 QString text(QAccessible::Text textType) const;
167 void setText(QAccessible::Text textType, const QString &text);
168 QAccessible::State state() const;
169 int childCount() const;
170 QAccessibleInterface *child(int index) const;
171 int indexOfChild(const QAccessibleInterface *child) const;
175 QMdiSubWindow *mdiSubWindow() const;
177 #endif // QT_NO_MDIAREA
179 #ifndef QT_NO_WORKSPACE
180 class QAccessibleWorkspace : public QAccessibleWidget
183 explicit QAccessibleWorkspace(QWidget *widget);
185 int childCount() const;
186 QAccessibleInterface *child(int index) const;
187 int indexOfChild(const QAccessibleInterface *child) const;
190 QWorkspace *workspace() const;
194 class QAccessibleDialogButtonBox : public QAccessibleWidget
197 explicit QAccessibleDialogButtonBox(QWidget *widget);
200 #ifndef QT_NO_TEXTBROWSER
201 class QAccessibleTextBrowser : public QAccessibleTextEdit
204 explicit QAccessibleTextBrowser(QWidget *widget);
206 QAccessible::Role role() const;
208 #endif // QT_NO_TEXTBROWSER
210 #ifndef QT_NO_CALENDARWIDGET
211 class QAccessibleCalendarWidget : public QAccessibleWidget
214 explicit QAccessibleCalendarWidget(QWidget *widget);
216 int childCount() const;
217 int indexOfChild(const QAccessibleInterface *child) const;
219 QAccessibleInterface *child(int index) const;
222 QCalendarWidget *calendarWidget() const;
225 QAbstractItemView *calendarView() const;
226 QWidget *navigationBar() const;
228 #endif // QT_NO_CALENDARWIDGET
230 #ifndef QT_NO_DOCKWIDGET
231 class QAccessibleDockWidget: public QAccessibleWidget
234 explicit QAccessibleDockWidget(QWidget *widget);
235 QAccessibleInterface *child(int index) const;
236 int indexOfChild(const QAccessibleInterface *child) const;
237 int childCount() const;
239 QAccessible::Role role() const;
241 QDockWidget *dockWidget() const;
244 class QAccessibleTitleBar : public QAccessibleInterface
247 explicit QAccessibleTitleBar(QDockWidget *widget);
249 QAccessibleInterface *parent() const;
250 QAccessibleInterface *child(int index) const;
251 int indexOfChild(const QAccessibleInterface *child) const;
252 int childCount() const;
253 QAccessibleInterface *childAt(int x, int y) const;
254 void setText(QAccessible::Text t, const QString &text);
255 QString text(QAccessible::Text t) const;
256 QAccessible::Role role() const;
258 QAccessible::State state() const;
259 QObject *object() const;
260 bool isValid() const;
262 QPointer<QDockWidget> m_dockWidget;
264 QDockWidget *dockWidget() const;
265 QDockWidgetLayout *dockWidgetLayout() const;
268 #endif // QT_NO_DOCKWIDGET
270 #ifndef QT_NO_MAINWINDOW
271 class QAccessibleMainWindow : public QAccessibleWidget
274 explicit QAccessibleMainWindow(QWidget *widget);
276 QAccessibleInterface *child(int index) const;
277 int childCount() const;
278 int indexOfChild(const QAccessibleInterface *iface) const;
279 QAccessibleInterface *childAt(int x, int y) const;
280 QMainWindow *mainWindow() const;
283 #endif //QT_NO_MAINWINDOW
285 #endif // QT_NO_ACCESSIBILITY
289 #endif // QACESSIBLEWIDGETS_H