1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef COMPLEXWIDGETS_H
5#define COMPLEXWIDGETS_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtWidgets/private/qtwidgetsglobal_p.h>
19#include <QtCore/qpointer.h>
20#include <QtWidgets/qaccessiblewidget.h>
21#if QT_CONFIG(itemviews)
22#include <QtWidgets/qabstractitemview.h>
23#endif
24
25QT_BEGIN_NAMESPACE
26
27#if QT_CONFIG(accessibility)
28
29class QAbstractButton;
30class QHeaderView;
31class QTabBar;
32class QComboBox;
33class QTitleBar;
34class QAbstractScrollArea;
35class QScrollArea;
36
37#if QT_CONFIG(scrollarea)
38class QAccessibleAbstractScrollArea : public QAccessibleWidget
39{
40public:
41 explicit QAccessibleAbstractScrollArea(QWidget *widget);
42
43 enum AbstractScrollAreaElement {
44 Self = 0,
45 Viewport,
46 HorizontalContainer,
47 VerticalContainer,
48 CornerWidget,
49 Undefined
50 };
51
52 QAccessibleInterface *child(int index) const override;
53 int childCount() const override;
54 int indexOfChild(const QAccessibleInterface *child) const override;
55 bool isValid() const override;
56 QAccessibleInterface *childAt(int x, int y) const override;
57 QAbstractScrollArea *abstractScrollArea() const;
58
59private:
60 QWidgetList accessibleChildren() const;
61 AbstractScrollAreaElement elementType(QWidget *widget) const;
62 bool isLeftToRight() const;
63};
64
65class QAccessibleScrollArea : public QAccessibleAbstractScrollArea
66{
67public:
68 explicit QAccessibleScrollArea(QWidget *widget);
69};
70#endif // QT_CONFIG(scrollarea)
71
72#if QT_CONFIG(tabbar)
73class QAccessibleTabBar : public QAccessibleWidget
74{
75public:
76 explicit QAccessibleTabBar(QWidget *w);
77 ~QAccessibleTabBar();
78
79 QAccessibleInterface *focusChild() const override;
80 int childCount() const override;
81 QString text(QAccessible::Text t) const override;
82
83 QAccessibleInterface* child(int index) const override;
84 int indexOfChild(const QAccessibleInterface *child) const override;
85
86protected:
87 QTabBar *tabBar() const;
88 mutable QHash<int, QAccessible::Id> m_childInterfaces;
89};
90#endif // QT_CONFIG(tabbar)
91
92#if QT_CONFIG(combobox)
93class QAccessibleComboBox : public QAccessibleWidget
94{
95public:
96 explicit QAccessibleComboBox(QWidget *w);
97
98 int childCount() const override;
99 QAccessibleInterface *childAt(int x, int y) const override;
100 int indexOfChild(const QAccessibleInterface *child) const override;
101 QAccessibleInterface* child(int index) const override;
102 QAccessibleInterface* focusChild() const override;
103
104 QString text(QAccessible::Text t) const override;
105
106 QAccessible::State state() const override;
107
108 // QAccessibleActionInterface
109 QStringList actionNames() const override;
110 QString localizedActionDescription(const QString &actionName) const override;
111 void doAction(const QString &actionName) override;
112 QStringList keyBindingsForAction(const QString &actionName) const override;
113
114protected:
115 QComboBox *comboBox() const;
116};
117#endif // QT_CONFIG(combobox)
118
119#endif // QT_CONFIG(accessibility)
120
121QT_END_NAMESPACE
122
123#endif // COMPLEXWIDGETS_H
124

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