1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the plugins of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef SIMPLEWIDGETS_H
41#define SIMPLEWIDGETS_H
42
43//
44// W A R N I N G
45// -------------
46//
47// This file is not part of the Qt API. It exists purely as an
48// implementation detail. This header file may change from version to
49// version without notice, or even be removed.
50//
51// We mean it.
52//
53
54#include <QtWidgets/private/qtwidgetsglobal_p.h>
55#include <QtCore/qcoreapplication.h>
56#include <QtWidgets/qaccessiblewidget.h>
57
58QT_BEGIN_NAMESPACE
59
60#ifndef QT_NO_ACCESSIBILITY
61
62class QAbstractButton;
63class QLineEdit;
64class QToolButton;
65class QGroupBox;
66class QProgressBar;
67
68#if QT_CONFIG(abstractbutton)
69class QAccessibleButton : public QAccessibleWidget
70{
71 Q_DECLARE_TR_FUNCTIONS(QAccessibleButton)
72public:
73 QAccessibleButton(QWidget *w);
74
75 QString text(QAccessible::Text t) const override;
76 QAccessible::State state() const override;
77 QRect rect() const override;
78 QAccessible::Role role() const override;
79
80 QStringList actionNames() const override;
81 void doAction(const QString &actionName) override;
82 QStringList keyBindingsForAction(const QString &actionName) const override;
83
84protected:
85 QAbstractButton *button() const;
86};
87#endif
88
89#if QT_CONFIG(toolbutton)
90class QAccessibleToolButton : public QAccessibleButton
91{
92public:
93 QAccessibleToolButton(QWidget *w);
94
95 QAccessible::State state() const override;
96 QAccessible::Role role() const override;
97
98 int childCount() const override;
99 QAccessibleInterface *child(int index) const override;
100
101 // QAccessibleActionInterface
102 QStringList actionNames() const override;
103 void doAction(const QString &actionName) override;
104
105protected:
106 QToolButton *toolButton() const;
107
108 bool isSplitButton() const;
109};
110#endif // QT_CONFIG(toolbutton)
111
112class QAccessibleDisplay : public QAccessibleWidget, public QAccessibleImageInterface
113{
114public:
115 explicit QAccessibleDisplay(QWidget *w, QAccessible::Role role = QAccessible::StaticText);
116
117 QString text(QAccessible::Text t) const override;
118 QAccessible::Role role() const override;
119 QAccessible::State state() const override;
120
121 QVector<QPair<QAccessibleInterface*, QAccessible::Relation> >relations(QAccessible::Relation match = QAccessible::AllRelations) const override;
122 void *interface_cast(QAccessible::InterfaceType t) override;
123
124 // QAccessibleImageInterface
125 QString imageDescription() const override;
126 QSize imageSize() const override;
127 QPoint imagePosition() const override;
128};
129
130#if QT_CONFIG(groupbox)
131class QAccessibleGroupBox : public QAccessibleWidget
132{
133public:
134 explicit QAccessibleGroupBox(QWidget *w);
135
136 QAccessible::State state() const override;
137 QAccessible::Role role() const override;
138 QString text(QAccessible::Text t) const override;
139
140 QVector<QPair<QAccessibleInterface*, QAccessible::Relation> >relations(QAccessible::Relation match = QAccessible::AllRelations) const override;
141
142 //QAccessibleActionInterface
143 QStringList actionNames() const override;
144 void doAction(const QString &actionName) override;
145 QStringList keyBindingsForAction(const QString &) const override;
146
147private:
148 QGroupBox *groupBox() const;
149};
150#endif
151
152#if QT_CONFIG(lineedit)
153class QAccessibleLineEdit : public QAccessibleWidget, public QAccessibleTextInterface, public QAccessibleEditableTextInterface
154{
155public:
156 explicit QAccessibleLineEdit(QWidget *o, const QString &name = QString());
157
158 QString text(QAccessible::Text t) const override;
159 void setText(QAccessible::Text t, const QString &text) override;
160 QAccessible::State state() const override;
161 void *interface_cast(QAccessible::InterfaceType t) override;
162
163 // QAccessibleTextInterface
164 void addSelection(int startOffset, int endOffset) override;
165 QString attributes(int offset, int *startOffset, int *endOffset) const override;
166 int cursorPosition() const override;
167 QRect characterRect(int offset) const override;
168 int selectionCount() const override;
169 int offsetAtPoint(const QPoint &point) const override;
170 void selection(int selectionIndex, int *startOffset, int *endOffset) const override;
171 QString text(int startOffset, int endOffset) const override;
172 QString textBeforeOffset (int offset, QAccessible::TextBoundaryType boundaryType,
173 int *startOffset, int *endOffset) const override;
174 QString textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType,
175 int *startOffset, int *endOffset) const override;
176 QString textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType,
177 int *startOffset, int *endOffset) const override;
178 void removeSelection(int selectionIndex) override;
179 void setCursorPosition(int position) override;
180 void setSelection(int selectionIndex, int startOffset, int endOffset) override;
181 int characterCount() const override;
182 void scrollToSubstring(int startIndex, int endIndex) override;
183
184 // QAccessibleEditableTextInterface
185 void deleteText(int startOffset, int endOffset) override;
186 void insertText(int offset, const QString &text) override;
187 void replaceText(int startOffset, int endOffset, const QString &text) override;
188protected:
189 QLineEdit *lineEdit() const;
190 friend class QAccessibleAbstractSpinBox;
191};
192#endif // QT_CONFIG(lineedit)
193
194#if QT_CONFIG(progressbar)
195class QAccessibleProgressBar : public QAccessibleDisplay, public QAccessibleValueInterface
196{
197public:
198 explicit QAccessibleProgressBar(QWidget *o);
199 void *interface_cast(QAccessible::InterfaceType t) override;
200
201 // QAccessibleValueInterface
202 QVariant currentValue() const override;
203 QVariant maximumValue() const override;
204 QVariant minimumValue() const override;
205 QVariant minimumStepSize() const override;
206 void setCurrentValue(const QVariant &) override {}
207
208protected:
209 QProgressBar *progressBar() const;
210};
211#endif
212
213class QWindowContainer;
214class QAccessibleWindowContainer : public QAccessibleWidget
215{
216public:
217 QAccessibleWindowContainer(QWidget *w);
218 int childCount() const override;
219 int indexOfChild(const QAccessibleInterface *child) const override;
220 QAccessibleInterface *child(int i) const override;
221
222private:
223 QWindowContainer *container() const;
224};
225
226#endif // QT_NO_ACCESSIBILITY
227
228QT_END_NAMESPACE
229
230#endif // SIMPLEWIDGETS_H
231

source code of qtbase/src/widgets/accessible/simplewidgets_p.h