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 RANGECONTROLS_H 41 #define RANGECONTROLS_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 <QtWidgets/qaccessiblewidget.h> 56 57 QT_BEGIN_NAMESPACE 58 59 #ifndef QT_NO_ACCESSIBILITY 60 61 class QAbstractSpinBox; 62 class QAbstractSlider; 63 class QScrollBar; 64 class QSlider; 65 class QSpinBox; 66 class QDoubleSpinBox; 67 class QDial; 68 class QAccessibleLineEdit; 69 70 #if QT_CONFIG(spinbox) 71 class QAccessibleAbstractSpinBox: 72 public QAccessibleWidget, 73 public QAccessibleValueInterface, 74 public QAccessibleTextInterface, 75 public QAccessibleEditableTextInterface 76 { 77 public: 78 explicit QAccessibleAbstractSpinBox(QWidget *w); 79 virtual ~QAccessibleAbstractSpinBox(); 80 81 QString text(QAccessible::Text t) const override; 82 void *interface_cast(QAccessible::InterfaceType t) override; 83 84 // QAccessibleValueInterface 85 QVariant currentValue() const override; 86 void setCurrentValue(const QVariant &value) override; 87 QVariant maximumValue() const override; 88 QVariant minimumValue() const override; 89 QVariant minimumStepSize() const override; 90 91 // QAccessibleTextInterface 92 void addSelection(int startOffset, int endOffset) override; 93 QString attributes(int offset, int *startOffset, int *endOffset) const override; 94 int cursorPosition() const override; 95 QRect characterRect(int offset) const override; 96 int selectionCount() const override; 97 int offsetAtPoint(const QPoint &point) const override; 98 void selection(int selectionIndex, int *startOffset, int *endOffset) const override; 99 QString text(int startOffset, int endOffset) const override; 100 QString textBeforeOffset (int offset, QAccessible::TextBoundaryType boundaryType, 101 int *endOffset, int *startOffset) const override; 102 QString textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType, 103 int *startOffset, int *endOffset) const override; 104 QString textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType, 105 int *startOffset, int *endOffset) const override; 106 void removeSelection(int selectionIndex) override; 107 void setCursorPosition(int position) override; 108 void setSelection(int selectionIndex, int startOffset, int endOffset) override; 109 int characterCount() const override; 110 void scrollToSubstring(int startIndex, int endIndex) override; 111 112 // QAccessibleEditableTextInterface 113 void deleteText(int startOffset, int endOffset) override; 114 void insertText(int offset, const QString &text) override; 115 void replaceText(int startOffset, int endOffset, const QString &text) override; 116 117 protected: 118 QAbstractSpinBox *abstractSpinBox() const; 119 QAccessibleInterface *lineEditIface() const; 120 private: 121 mutable QAccessibleLineEdit *lineEdit; 122 }; 123 124 class QAccessibleSpinBox : public QAccessibleAbstractSpinBox 125 { 126 public: 127 explicit QAccessibleSpinBox(QWidget *w); 128 129 protected: 130 QSpinBox *spinBox() const; 131 }; 132 133 class QAccessibleDoubleSpinBox : public QAccessibleAbstractSpinBox 134 { 135 public: 136 explicit QAccessibleDoubleSpinBox(QWidget *widget); 137 138 QString text(QAccessible::Text t) const override; 139 140 using QAccessibleAbstractSpinBox::text; 141 protected: 142 QDoubleSpinBox *doubleSpinBox() const; 143 }; 144 #endif // QT_CONFIG(spinbox) 145 146 #if QT_CONFIG(slider) 147 class QAccessibleAbstractSlider: public QAccessibleWidget, public QAccessibleValueInterface 148 { 149 public: 150 explicit QAccessibleAbstractSlider(QWidget *w, QAccessible::Role r = QAccessible::Slider); 151 void *interface_cast(QAccessible::InterfaceType t) override; 152 153 // QAccessibleValueInterface 154 QVariant currentValue() const override; 155 void setCurrentValue(const QVariant &value) override; 156 QVariant maximumValue() const override; 157 QVariant minimumValue() const override; 158 QVariant minimumStepSize() const override; 159 160 protected: 161 QAbstractSlider *abstractSlider() const; 162 }; 163 #endif // QT_CONFIG(slider) 164 165 #if QT_CONFIG(scrollbar) 166 class QAccessibleScrollBar : public QAccessibleAbstractSlider 167 { 168 public: 169 explicit QAccessibleScrollBar(QWidget *w); 170 QString text(QAccessible::Text t) const override; 171 172 protected: 173 QScrollBar *scrollBar() const; 174 }; 175 #endif // QT_CONFIG(scrollbar) 176 177 #if QT_CONFIG(slider) 178 class QAccessibleSlider : public QAccessibleAbstractSlider 179 { 180 public: 181 explicit QAccessibleSlider(QWidget *w); 182 QString text(QAccessible::Text t) const override; 183 184 protected: 185 QSlider *slider() const; 186 }; 187 #endif // QT_CONFIG(slider) 188 189 #if QT_CONFIG(dial) 190 class QAccessibleDial : public QAccessibleAbstractSlider 191 { 192 public: 193 explicit QAccessibleDial(QWidget *w); 194 195 QString text(QAccessible::Text textType) const override; 196 197 protected: 198 QDial *dial() const; 199 }; 200 #endif // QT_CONFIG(dial) 201 202 #endif // QT_NO_ACCESSIBILITY 203 204 QT_END_NAMESPACE 205 206 #endif // RANGECONTROLS_H 207