source: trunk/src/plugins/accessible/widgets/simplewidgets.h@ 651

Last change on this file since 651 was 651, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.2 sources.

File size: 6.4 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the plugins of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef SIMPLEWIDGETS_H
43#define SIMPLEWIDGETS_H
44
45#include <QtCore/qcoreapplication.h>
46#include <QtGui/qaccessible2.h>
47#include <QtGui/qaccessiblewidget.h>
48
49QT_BEGIN_NAMESPACE
50
51#ifndef QT_NO_ACCESSIBILITY
52
53class QAbstractButton;
54class QLineEdit;
55class QToolButton;
56class QProgressBar;
57
58class QAccessibleButton : public QAccessibleWidgetEx, public QAccessibleActionInterface
59{
60 Q_ACCESSIBLE_OBJECT
61 Q_DECLARE_TR_FUNCTIONS(QAccessibleButton)
62public:
63 QAccessibleButton(QWidget *w, Role r);
64
65 QString text(Text t, int child) const;
66 State state(int child) const;
67
68 QString actionText(int action, Text text, int child) const;
69 bool doAction(int action, int child, const QVariantList &params);
70
71 // QAccessibleActionInterface
72 int actionCount();
73 void doAction(int actionIndex);
74 QString description(int actionIndex);
75 QString name(int actionIndex);
76 QString localizedName(int actionIndex);
77 QStringList keyBindings(int actionIndex);
78
79protected:
80 QAbstractButton *button() const;
81};
82
83#ifndef QT_NO_TOOLBUTTON
84class QAccessibleToolButton : public QAccessibleButton
85{
86public:
87 QAccessibleToolButton(QWidget *w, Role role);
88
89 enum ToolButtonElements {
90 ToolButtonSelf = 0,
91 ButtonExecute,
92 ButtonDropMenu
93 };
94
95 Role role(int child) const;
96 State state(int child) const;
97
98 int childCount() const;
99 QRect rect(int child) const;
100
101 QString text(Text t, int child) const;
102
103 int actionCount(int child) const;
104 QString actionText(int action, Text text, int child) const;
105 bool doAction(int action, int child, const QVariantList &params);
106
107protected:
108 QToolButton *toolButton() const;
109
110 bool isSplitButton() const;
111};
112#endif // QT_NO_TOOLBUTTON
113
114class QAccessibleDisplay : public QAccessibleWidgetEx, public QAccessibleImageInterface
115{
116 Q_ACCESSIBLE_OBJECT
117public:
118 explicit QAccessibleDisplay(QWidget *w, Role role = StaticText);
119
120 QString text(Text t, int child) const;
121 Role role(int child) const;
122
123 Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
124 int navigate(RelationFlag, int entry, QAccessibleInterface **target) const;
125
126 // QAccessibleImageInterface
127 QString imageDescription();
128 QSize imageSize();
129 QRect imagePosition(QAccessible2::CoordinateType coordType);
130};
131
132#ifndef QT_NO_LINEEDIT
133class QAccessibleLineEdit : public QAccessibleWidgetEx, public QAccessibleTextInterface,
134 public QAccessibleSimpleEditableTextInterface
135{
136 Q_ACCESSIBLE_OBJECT
137public:
138 explicit QAccessibleLineEdit(QWidget *o, const QString &name = QString());
139
140 QString text(Text t, int child) const;
141 void setText(Text t, int control, const QString &text);
142 State state(int child) const;
143 QVariant invokeMethodEx(QAccessible::Method method, int child, const QVariantList &params);
144
145 // QAccessibleTextInterface
146 void addSelection(int startOffset, int endOffset);
147 QString attributes(int offset, int *startOffset, int *endOffset);
148 int cursorPosition();
149 QRect characterRect(int offset, QAccessible2::CoordinateType coordType);
150 int selectionCount();
151 int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType);
152 void selection(int selectionIndex, int *startOffset, int *endOffset);
153 QString text(int startOffset, int endOffset);
154 QString textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType,
155 int *startOffset, int *endOffset);
156 QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
157 int *startOffset, int *endOffset);
158 QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
159 int *startOffset, int *endOffset);
160 void removeSelection(int selectionIndex);
161 void setCursorPosition(int position);
162 void setSelection(int selectionIndex, int startOffset, int endOffset);
163 int characterCount();
164 void scrollToSubstring(int startIndex, int endIndex);
165
166protected:
167 QLineEdit *lineEdit() const;
168};
169#endif // QT_NO_LINEEDIT
170
171#ifndef QT_NO_PROGRESSBAR
172class QAccessibleProgressBar : public QAccessibleDisplay, public QAccessibleValueInterface
173{
174 Q_ACCESSIBLE_OBJECT
175public:
176 explicit QAccessibleProgressBar(QWidget *o);
177
178 // QAccessibleValueInterface
179 QVariant currentValue();
180 QVariant maximumValue();
181 QVariant minimumValue();
182 inline void setCurrentValue(const QVariant &) {}
183
184protected:
185 QProgressBar *progressBar() const;
186};
187#endif
188
189#endif // QT_NO_ACCESSIBILITY
190
191QT_END_NAMESPACE
192
193#endif // SIMPLEWIDGETS_H
Note: See TracBrowser for help on using the repository browser.