4#ifndef QACCESSIBLE_BASE_H
5#define QACCESSIBLE_BASE_H
7#include <QtGui/qtguiglobal.h>
8#if QT_CONFIG(accessibility)
12#pragma qt_sync_stop_processing
15#include <QtCore/qobjectdefs.h>
21class QAccessibleInterface;
22class QAccessibleEvent;
25class Q_GUI_EXPORT QAccessible
33 ForegroundChanged = 0x0003,
36 PopupMenuStart = 0x0006,
37 PopupMenuEnd = 0x0007,
38 ContextHelpStart = 0x000C,
39 ContextHelpEnd = 0x000D,
40 DragDropStart = 0x000E,
44 ScrollingStart = 0x0012,
45 ScrollingEnd = 0x0013,
46 ScrollingPositionChanged = 0x0014,
51 ActionChanged = 0x0101,
52 ActiveDescendantChanged = 0x0102,
53 AttributeChanged = 0x0103,
54 DocumentContentChanged = 0x0104,
55 DocumentLoadComplete = 0x0105,
56 DocumentLoadStopped = 0x0106,
57 DocumentReload = 0x0107,
58 HyperlinkEndIndexChanged = 0x0108,
59 HyperlinkNumberOfAnchorsChanged = 0x0109,
60 HyperlinkSelectedLinkChanged = 0x010A,
61 HypertextLinkActivated = 0x010B,
62 HypertextLinkSelected = 0x010C,
63 HyperlinkStartIndexChanged = 0x010D,
64 HypertextChanged = 0x010E,
65 HypertextNLinksChanged = 0x010F,
66 ObjectAttributeChanged = 0x0110,
68 SectionChanged = 0x0112,
69 TableCaptionChanged = 0x0113,
70 TableColumnDescriptionChanged = 0x0114,
71 TableColumnHeaderChanged = 0x0115,
72 TableModelChanged = 0x0116,
73 TableRowDescriptionChanged = 0x0117,
74 TableRowHeaderChanged = 0x0118,
75 TableSummaryChanged = 0x0119,
76 TextAttributeChanged = 0x011A,
77 TextCaretMoved = 0x011B,
79 TextColumnChanged = 0x011D,
80 TextInserted = 0x011E,
83 TextSelectionChanged = 0x0121,
84 VisibleDataChanged = 0x0122,
86 ObjectCreated = 0x8000,
87 ObjectDestroyed = 0x8001,
90 ObjectReorder = 0x8004,
93 SelectionAdd = 0x8007,
94 SelectionRemove = 0x8008,
95 SelectionWithin = 0x8009,
96 StateChanged = 0x800A,
97 LocationChanged = 0x800B,
99 DescriptionChanged = 0x800D,
100 ValueChanged = 0x800E,
101 ParentChanged = 0x800F,
102 HelpChanged = 0x80A0,
103 DefaultActionChanged = 0x80B0,
104 AcceleratorChanged = 0x80C0,
105 Announcement = 0x80D0,
106 IdentifierChanged = 0x80E0,
107 RoleChanged = 0x80E1,
110 InvalidEvent = AcceleratorChanged + 1,
118 quint64 disabled : 1;
119 quint64 selected : 1;
120 quint64 focusable : 1;
123 quint64 checkable : 1;
125 quint64 checkStateMixed : 1;
126 quint64 readOnly : 1;
127 quint64 hotTracked : 1;
128 quint64 defaultButton : 1;
129 quint64 expanded : 1;
130 quint64 collapsed : 1;
132 quint64 expandable : 1;
133 quint64 marqueed : 1;
134 quint64 animated : 1;
135 quint64 invisible : 1;
136 quint64 offscreen : 1;
137 quint64 sizeable : 1;
139 quint64 selfVoicing : 1;
140 quint64 selectable : 1;
142 quint64 traversed : 1;
143 quint64 multiSelectable : 1;
144 quint64 extSelectable : 1;
145 quint64 passwordEdit : 1;
146 quint64 hasPopup : 1;
153 quint64 editable : 1;
154 quint64 multiLine : 1;
155 quint64 selectableText : 1;
156 quint64 supportsAutoCompletion : 1;
158 quint64 searchEdit : 1;
179 Q_DECL_UNUSED_MEMBER quint64 qt_reserved : 27;
182 std::memset(
this, 0,
sizeof(State));
184 friend inline bool operator==(
const QAccessible::State &first,
const QAccessible::State &second)
186 static_assert(std::has_unique_object_representations_v<State>,
187 "memcmp() cannot be used on types with padding");
188 return std::memcmp(&first, &second,
sizeof(QAccessible::State)) == 0;
198 TitleBar = 0x00000001,
199 MenuBar = 0x00000002,
200 ScrollBar = 0x00000003,
205 AlertMessage = 0x00000008,
208 PopupMenu = 0x0000000B,
209 MenuItem = 0x0000000C,
210 ToolTip = 0x0000000D,
211 Application = 0x0000000E,
212 Document = 0x0000000F,
217 Grouping = 0x00000014,
218 Separator = 0x00000015,
219 ToolBar = 0x00000016,
220 StatusBar = 0x00000017,
222 ColumnHeader = 0x00000019,
223 RowHeader = 0x0000001A,
228 HelpBalloon = 0x0000001F,
229 Assistant = 0x00000020,
231 ListItem = 0x00000022,
233 TreeItem = 0x00000024,
234 PageTab = 0x00000025,
235 PropertyPage = 0x00000026,
236 Indicator = 0x00000027,
237 Graphic = 0x00000028,
238 StaticText = 0x00000029,
239 EditableText = 0x0000002A,
244 CheckBox = 0x0000002C,
245 RadioButton = 0x0000002D,
246 ComboBox = 0x0000002E,
248 ProgressBar = 0x00000030,
250 HotkeyField = 0x00000032,
252 SpinBox = 0x00000034,
254 Animation = 0x00000036,
255 Equation = 0x00000037,
256 ButtonDropDown = 0x00000038,
257 ButtonMenu = 0x00000039,
258 ButtonDropGrid = 0x0000003A,
259 Whitespace = 0x0000003B,
260 PageTabList = 0x0000003C,
262 Splitter = 0x0000003E,
266 LayeredPane = 0x00000080,
267 Terminal = 0x00000081,
268 Desktop = 0x00000082,
269 Paragraph = 0x00000083,
270 WebDocument = 0x00000084,
271 Section = 0x00000085,
272 Notification = 0x00000086,
279 ColorChooser = 0x404,
321 ComplementaryContent = 0x42C,
331 UserRole = 0x0000ffff
343 UserText = 0x0000ffff
348 Labelled = 0x00000002,
349 Controller = 0x00000004,
350 Controlled = 0x00000008,
351 DescriptionFor = 0x00000010,
352 Described = 0x00000020,
353 FlowsFrom = 0x00000040,
354 FlowsTo = 0x00000080,
355 AllRelations = 0xffffffff
357 Q_DECLARE_FLAGS(Relation, RelationFlag)
362 EditableTextInterface,
374 enum TextBoundaryType {
383 enum class Attribute {
391 enum class AnnouncementPoliteness {
395 Q_ENUM(AnnouncementPoliteness)
397 typedef QAccessibleInterface*(*InterfaceFactory)(
const QString &key, QObject*);
398 typedef void(*UpdateHandler)(QAccessibleEvent *event);
399 typedef void(*RootObjectHandler)(QObject*);
403 static void installFactory(InterfaceFactory);
404 static void removeFactory(InterfaceFactory);
405 static UpdateHandler installUpdateHandler(UpdateHandler);
406 static RootObjectHandler installRootObjectHandler(RootObjectHandler);
408 class Q_GUI_EXPORT ActivationObserver
411 virtual ~ActivationObserver();
412 virtual void accessibilityActiveChanged(
bool active) = 0;
414 static void installActivationObserver(ActivationObserver *);
415 static void removeActivationObserver(ActivationObserver *);
417 static QAccessibleInterface *queryAccessibleInterface(QObject *);
418 static Id uniqueId(QAccessibleInterface *iface);
419 static QAccessibleInterface *accessibleInterface(Id uniqueId);
420 static Id registerAccessibleInterface(QAccessibleInterface *iface);
421 static void deleteAccessibleInterface(Id uniqueId);
423 static void updateAccessibility(QAccessibleEvent *event);
425 static bool isActive();
426 static void setActive(
bool active);
427 static void setRootObject(QObject *object);
429 static void cleanup();
431 static std::pair<
int,
int > qAccessibleTextBoundaryHelper(
const QTextCursor &cursor, TextBoundaryType boundaryType);
434 static UpdateHandler updateHandler;
435 static RootObjectHandler rootObjectHandler;
439 friend class QAccessibleCache;
442Q_DECLARE_OPERATORS_FOR_FLAGS(QAccessible::Relation)