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

Last change on this file since 64 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 5.3 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the plugins of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** 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 are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef SIMPLEWIDGETS_H
43#define SIMPLEWIDGETS_H
44
45#include <QtGui/qaccessible2.h>
46#include <QtGui/qaccessiblewidget.h>
47
48QT_BEGIN_NAMESPACE
49
50#ifndef QT_NO_ACCESSIBILITY
51
52class QAbstractButton;
53class QLineEdit;
54class QToolButton;
55
56class QAccessibleButton : public QAccessibleWidgetEx
57{
58public:
59 QAccessibleButton(QWidget *w, Role r);
60
61 QString text(Text t, int child) const;
62 State state(int child) const;
63
64 QString actionText(int action, Text text, int child) const;
65 bool doAction(int action, int child, const QVariantList &params);
66
67protected:
68 QAbstractButton *button() const;
69};
70
71#ifndef QT_NO_TOOLBUTTON
72class QAccessibleToolButton : public QAccessibleButton
73{
74public:
75 QAccessibleToolButton(QWidget *w, Role role);
76
77 enum ToolButtonElements {
78 ToolButtonSelf = 0,
79 ButtonExecute,
80 ButtonDropMenu
81 };
82
83 Role role(int child) const;
84 State state(int child) const;
85
86 int childCount() const;
87 QRect rect(int child) const;
88
89 QString text(Text t, int child) const;
90
91 int actionCount(int child) const;
92 QString actionText(int action, Text text, int child) const;
93 bool doAction(int action, int child, const QVariantList &params);
94
95protected:
96 QToolButton *toolButton() const;
97
98 bool isSplitButton() const;
99};
100#endif // QT_NO_TOOLBUTTON
101
102class QAccessibleDisplay : public QAccessibleWidgetEx
103{
104public:
105 explicit QAccessibleDisplay(QWidget *w, Role role = StaticText);
106
107 QString text(Text t, int child) const;
108 Role role(int child) const;
109
110 Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
111 int navigate(RelationFlag, int entry, QAccessibleInterface **target) const;
112};
113
114#ifndef QT_NO_LINEEDIT
115class QAccessibleLineEdit : public QAccessibleWidgetEx, public QAccessibleTextInterface,
116 public QAccessibleSimpleEditableTextInterface
117{
118public:
119 explicit QAccessibleLineEdit(QWidget *o, const QString &name = QString());
120
121 QString text(Text t, int child) const;
122 void setText(Text t, int control, const QString &text);
123 State state(int child) const;
124 QVariant invokeMethodEx(QAccessible::Method method, int child, const QVariantList &params);
125
126 // QAccessibleTextInterface
127 void addSelection(int startOffset, int endOffset);
128 QString attributes(int offset, int *startOffset, int *endOffset);
129 int cursorPosition();
130 QRect characterRect(int offset, QAccessible2::CoordinateType coordType);
131 int selectionCount();
132 int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType);
133 void selection(int selectionIndex, int *startOffset, int *endOffset);
134 QString text(int startOffset, int endOffset);
135 QString textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType,
136 int *startOffset, int *endOffset);
137 QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
138 int *startOffset, int *endOffset);
139 QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
140 int *startOffset, int *endOffset);
141 void removeSelection(int selectionIndex);
142 void setCursorPosition(int position);
143 void setSelection(int selectionIndex, int startOffset, int endOffset);
144 int characterCount();
145 void scrollToSubstring(int startIndex, int endIndex);
146
147protected:
148 QLineEdit *lineEdit() const;
149};
150#endif // QT_NO_LINEEDIT
151
152#endif // QT_NO_ACCESSIBILITY
153
154QT_END_NAMESPACE
155
156#endif // SIMPLEWIDGETS_H
Note: See TracBrowser for help on using the repository browser.