| 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 | |
| 25 | QT_BEGIN_NAMESPACE |
| 26 | |
| 27 | #if QT_CONFIG(accessibility) |
| 28 | |
| 29 | class QAbstractButton; |
| 30 | class ; |
| 31 | class QTabBar; |
| 32 | class QComboBox; |
| 33 | class QTitleBar; |
| 34 | class QAbstractScrollArea; |
| 35 | class QScrollArea; |
| 36 | |
| 37 | #if QT_CONFIG(scrollarea) |
| 38 | class QAccessibleAbstractScrollArea : public QAccessibleWidget |
| 39 | { |
| 40 | public: |
| 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 | |
| 59 | private: |
| 60 | QWidgetList accessibleChildren() const; |
| 61 | AbstractScrollAreaElement elementType(QWidget *widget) const; |
| 62 | bool isLeftToRight() const; |
| 63 | }; |
| 64 | |
| 65 | class QAccessibleScrollArea : public QAccessibleAbstractScrollArea |
| 66 | { |
| 67 | public: |
| 68 | explicit QAccessibleScrollArea(QWidget *widget); |
| 69 | }; |
| 70 | #endif // QT_CONFIG(scrollarea) |
| 71 | |
| 72 | #if QT_CONFIG(tabbar) |
| 73 | class QAccessibleTabBar : public QAccessibleWidget, public QAccessibleSelectionInterface |
| 74 | { |
| 75 | public: |
| 76 | explicit QAccessibleTabBar(QWidget *w); |
| 77 | ~QAccessibleTabBar(); |
| 78 | |
| 79 | void *interface_cast(QAccessible::InterfaceType t) override; |
| 80 | |
| 81 | QAccessibleInterface *focusChild() const override; |
| 82 | int childCount() const override; |
| 83 | QString text(QAccessible::Text t) const override; |
| 84 | |
| 85 | QAccessibleInterface* child(int index) const override; |
| 86 | int indexOfChild(const QAccessibleInterface *child) const override; |
| 87 | |
| 88 | // QAccessibleSelectionInterface |
| 89 | int selectedItemCount() const override; |
| 90 | QList<QAccessibleInterface*> selectedItems() const override; |
| 91 | QAccessibleInterface* selectedItem(int selectionIndex) const override; |
| 92 | bool isSelected(QAccessibleInterface *childItem) const override; |
| 93 | bool select(QAccessibleInterface *childItem) override; |
| 94 | bool unselect(QAccessibleInterface *childItem) override; |
| 95 | bool selectAll() override; |
| 96 | bool clear() override; |
| 97 | |
| 98 | protected: |
| 99 | QTabBar *tabBar() const; |
| 100 | mutable QHash<int, QAccessible::Id> m_childInterfaces; |
| 101 | }; |
| 102 | #endif // QT_CONFIG(tabbar) |
| 103 | |
| 104 | #if QT_CONFIG(combobox) |
| 105 | class QAccessibleComboBox : public QAccessibleWidget |
| 106 | { |
| 107 | public: |
| 108 | explicit QAccessibleComboBox(QWidget *w); |
| 109 | |
| 110 | int childCount() const override; |
| 111 | QAccessibleInterface *childAt(int x, int y) const override; |
| 112 | int indexOfChild(const QAccessibleInterface *child) const override; |
| 113 | QAccessibleInterface* child(int index) const override; |
| 114 | QAccessibleInterface* focusChild() const override; |
| 115 | |
| 116 | QString text(QAccessible::Text t) const override; |
| 117 | |
| 118 | QAccessible::State state() const override; |
| 119 | |
| 120 | // QAccessibleActionInterface |
| 121 | QStringList actionNames() const override; |
| 122 | QString localizedActionDescription(const QString &actionName) const override; |
| 123 | void doAction(const QString &actionName) override; |
| 124 | QStringList keyBindingsForAction(const QString &actionName) const override; |
| 125 | |
| 126 | protected: |
| 127 | QComboBox *comboBox() const; |
| 128 | }; |
| 129 | #endif // QT_CONFIG(combobox) |
| 130 | |
| 131 | #endif // QT_CONFIG(accessibility) |
| 132 | |
| 133 | QT_END_NAMESPACE |
| 134 | |
| 135 | #endif // COMPLEXWIDGETS_H |
| 136 | |