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 RANGECONTROLS_H |
5 | #define RANGECONTROLS_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 <QtWidgets/qaccessiblewidget.h> |
20 | |
21 | QT_BEGIN_NAMESPACE |
22 | |
23 | #if QT_CONFIG(accessibility) |
24 | |
25 | class QAbstractSpinBox; |
26 | class QAbstractSlider; |
27 | class QScrollBar; |
28 | class QSlider; |
29 | class QSpinBox; |
30 | class QDoubleSpinBox; |
31 | class QDial; |
32 | class QAccessibleLineEdit; |
33 | |
34 | #if QT_CONFIG(spinbox) |
35 | class QAccessibleAbstractSpinBox: |
36 | public QAccessibleWidget, |
37 | public QAccessibleValueInterface, |
38 | public QAccessibleTextInterface, |
39 | public QAccessibleEditableTextInterface |
40 | { |
41 | public: |
42 | explicit QAccessibleAbstractSpinBox(QWidget *w); |
43 | virtual ~QAccessibleAbstractSpinBox(); |
44 | |
45 | QString text(QAccessible::Text t) const override; |
46 | void *interface_cast(QAccessible::InterfaceType t) override; |
47 | |
48 | // QAccessibleValueInterface |
49 | QVariant currentValue() const override; |
50 | void setCurrentValue(const QVariant &value) override; |
51 | QVariant maximumValue() const override; |
52 | QVariant minimumValue() const override; |
53 | QVariant minimumStepSize() const override; |
54 | |
55 | // QAccessibleTextInterface |
56 | void addSelection(int startOffset, int endOffset) override; |
57 | QString attributes(int offset, int *startOffset, int *endOffset) const override; |
58 | int cursorPosition() const override; |
59 | QRect characterRect(int offset) const override; |
60 | int selectionCount() const override; |
61 | int offsetAtPoint(const QPoint &point) const override; |
62 | void selection(int selectionIndex, int *startOffset, int *endOffset) const override; |
63 | QString text(int startOffset, int endOffset) const override; |
64 | QString textBeforeOffset (int offset, QAccessible::TextBoundaryType boundaryType, |
65 | int *endOffset, int *startOffset) const override; |
66 | QString textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType, |
67 | int *startOffset, int *endOffset) const override; |
68 | QString textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType, |
69 | int *startOffset, int *endOffset) const override; |
70 | void removeSelection(int selectionIndex) override; |
71 | void setCursorPosition(int position) override; |
72 | void setSelection(int selectionIndex, int startOffset, int endOffset) override; |
73 | int characterCount() const override; |
74 | void scrollToSubstring(int startIndex, int endIndex) override; |
75 | |
76 | // QAccessibleEditableTextInterface |
77 | void deleteText(int startOffset, int endOffset) override; |
78 | void insertText(int offset, const QString &text) override; |
79 | void replaceText(int startOffset, int endOffset, const QString &text) override; |
80 | |
81 | protected: |
82 | QAbstractSpinBox *abstractSpinBox() const; |
83 | QAccessibleInterface *lineEditIface() const; |
84 | private: |
85 | mutable QAccessibleLineEdit *lineEdit; |
86 | }; |
87 | |
88 | class QAccessibleSpinBox : public QAccessibleAbstractSpinBox |
89 | { |
90 | public: |
91 | explicit QAccessibleSpinBox(QWidget *w); |
92 | |
93 | protected: |
94 | QSpinBox *spinBox() const; |
95 | }; |
96 | |
97 | class QAccessibleDoubleSpinBox : public QAccessibleAbstractSpinBox |
98 | { |
99 | public: |
100 | explicit QAccessibleDoubleSpinBox(QWidget *widget); |
101 | |
102 | QString text(QAccessible::Text t) const override; |
103 | |
104 | using QAccessibleAbstractSpinBox::text; |
105 | protected: |
106 | QDoubleSpinBox *doubleSpinBox() const; |
107 | }; |
108 | #endif // QT_CONFIG(spinbox) |
109 | |
110 | #if QT_CONFIG(slider) |
111 | class QAccessibleAbstractSlider: public QAccessibleWidget, public QAccessibleValueInterface |
112 | { |
113 | public: |
114 | explicit QAccessibleAbstractSlider(QWidget *w, QAccessible::Role r = QAccessible::Slider); |
115 | void *interface_cast(QAccessible::InterfaceType t) override; |
116 | |
117 | // QAccessibleValueInterface |
118 | QVariant currentValue() const override; |
119 | void setCurrentValue(const QVariant &value) override; |
120 | QVariant maximumValue() const override; |
121 | QVariant minimumValue() const override; |
122 | QVariant minimumStepSize() const override; |
123 | |
124 | protected: |
125 | QAbstractSlider *abstractSlider() const; |
126 | }; |
127 | #endif // QT_CONFIG(slider) |
128 | |
129 | #if QT_CONFIG(scrollbar) |
130 | class QAccessibleScrollBar : public QAccessibleAbstractSlider |
131 | { |
132 | public: |
133 | explicit QAccessibleScrollBar(QWidget *w); |
134 | QString text(QAccessible::Text t) const override; |
135 | |
136 | protected: |
137 | QScrollBar *scrollBar() const; |
138 | }; |
139 | #endif // QT_CONFIG(scrollbar) |
140 | |
141 | #if QT_CONFIG(slider) |
142 | class QAccessibleSlider : public QAccessibleAbstractSlider |
143 | { |
144 | public: |
145 | explicit QAccessibleSlider(QWidget *w); |
146 | QString text(QAccessible::Text t) const override; |
147 | |
148 | protected: |
149 | QSlider *slider() const; |
150 | }; |
151 | #endif // QT_CONFIG(slider) |
152 | |
153 | #if QT_CONFIG(dial) |
154 | class QAccessibleDial : public QAccessibleAbstractSlider |
155 | { |
156 | public: |
157 | explicit QAccessibleDial(QWidget *w); |
158 | |
159 | QString text(QAccessible::Text textType) const override; |
160 | |
161 | protected: |
162 | QDial *dial() const; |
163 | }; |
164 | #endif // QT_CONFIG(dial) |
165 | |
166 | #endif // QT_CONFIG(accessibility) |
167 | |
168 | QT_END_NAMESPACE |
169 | |
170 | #endif // RANGECONTROLS_H |
171 | |