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//
5// W A R N I N G
6// -------------
7//
8// This file is not part of the Qt API. It exists purely as an
9// implementation detail. This header file may change from version to
10// version without notice, or even be removed.
11//
12// We mean it.
13//
14
15/*
16 * This file contains AT-SPI constants and mappings between QAccessible
17 * and AT-SPI constants such as 'role' and 'state' enumerations.
18 */
19
20#ifndef Q_SPI_CONSTANT_MAPPINGS_H
21#define Q_SPI_CONSTANT_MAPPINGS_H
22
23#include "qspi_struct_marshallers_p.h"
24
25#include <QtGui/private/qtguiglobal_p.h>
26#include <QtGui/QAccessible>
27#include <atspi/atspi-constants.h>
28
29QT_REQUIRE_CONFIG(accessibility);
30
31// interface names from at-spi2-core/atspi/atspi-misc-private.h
32#define ATSPI_DBUS_NAME_REGISTRY "org.a11y.atspi.Registry"
33#define ATSPI_DBUS_PATH_REGISTRY "/org/a11y/atspi/registry"
34#define ATSPI_DBUS_INTERFACE_REGISTRY "org.a11y.atspi.Registry"
35
36#define ATSPI_DBUS_PATH_ROOT "/org/a11y/atspi/accessible/root"
37
38#define ATSPI_DBUS_PATH_DEC "/org/a11y/atspi/registry/deviceeventcontroller"
39#define ATSPI_DBUS_INTERFACE_DEC "org.a11y.atspi.DeviceEventController"
40#define ATSPI_DBUS_INTERFACE_DEVICE_EVENT_LISTENER "org.a11y.atspi.DeviceEventListener"
41
42#define ATSPI_DBUS_INTERFACE_CACHE "org.a11y.atspi.Cache"
43#define ATSPI_DBUS_INTERFACE_ACCESSIBLE "org.a11y.atspi.Accessible"
44#define ATSPI_DBUS_INTERFACE_ACTION "org.a11y.atspi.Action"
45#define ATSPI_DBUS_INTERFACE_APPLICATION "org.a11y.atspi.Application"
46#define ATSPI_DBUS_INTERFACE_COLLECTION "org.a11y.atspi.Collection"
47#define ATSPI_DBUS_INTERFACE_COMPONENT "org.a11y.atspi.Component"
48#define ATSPI_DBUS_INTERFACE_DOCUMENT "org.a11y.atspi.Document"
49#define ATSPI_DBUS_INTERFACE_EDITABLE_TEXT "org.a11y.atspi.EditableText"
50#define ATSPI_DBUS_INTERFACE_EVENT_KEYBOARD "org.a11y.atspi.Event.Keyboard"
51#define ATSPI_DBUS_INTERFACE_EVENT_MOUSE "org.a11y.atspi.Event.Mouse"
52#define ATSPI_DBUS_INTERFACE_EVENT_OBJECT "org.a11y.atspi.Event.Object"
53#define ATSPI_DBUS_INTERFACE_HYPERLINK "org.a11y.atspi.Hyperlink"
54#define ATSPI_DBUS_INTERFACE_HYPERTEXT "org.a11y.atspi.Hypertext"
55#define ATSPI_DBUS_INTERFACE_IMAGE "org.a11y.atspi.Image"
56#define ATSPI_DBUS_INTERFACE_SELECTION "org.a11y.atspi.Selection"
57#define ATSPI_DBUS_INTERFACE_TABLE "org.a11y.atspi.Table"
58#define ATSPI_DBUS_INTERFACE_TEXT "org.a11y.atspi.Text"
59#define ATSPI_DBUS_INTERFACE_VALUE "org.a11y.atspi.Value"
60#define ATSPI_DBUS_INTERFACE_SOCKET "org.a11y.atspi.Socket"
61
62// missing from at-spi2-core:
63#define ATSPI_DBUS_INTERFACE_EVENT_WINDOW "org.a11y.atspi.Event.Window"
64#define ATSPI_DBUS_INTERFACE_EVENT_FOCUS "org.a11y.atspi.Event.Focus"
65
66#define QSPI_OBJECT_PATH_ACCESSIBLE "/org/a11y/atspi/accessible"
67#define QSPI_OBJECT_PATH_PREFIX "/org/a11y/atspi/accessible/"
68#define QSPI_OBJECT_PATH_ROOT QSPI_OBJECT_PATH_PREFIX "root"
69
70#define QSPI_REGISTRY_NAME "org.a11y.atspi.Registry"
71
72QT_BEGIN_NAMESPACE
73
74struct RoleNames {
75 RoleNames() {}
76 RoleNames(AtspiRole r, const QString& n, const QString& ln)
77 :m_spiRole(r), m_name(n), m_localizedName(ln)
78 {}
79
80 AtspiRole spiRole() const {return m_spiRole;}
81 QString name() const {return m_name;}
82 QString localizedName() const {return m_localizedName;}
83
84private:
85 AtspiRole m_spiRole = ATSPI_ROLE_INVALID;
86 QString m_name;
87 QString m_localizedName;
88};
89
90inline void setSpiStateBit(quint64* state, AtspiStateType spiState)
91{
92 *state |= quint64(1) << spiState;
93}
94
95inline void unsetSpiStateBit(quint64* state, AtspiStateType spiState)
96{
97 *state &= ~(quint64(1) << spiState);
98}
99
100quint64 spiStatesFromQState(QAccessible::State state);
101QSpiUIntList spiStateSetFromSpiStates(quint64 states);
102
103AtspiRelationType qAccessibleRelationToAtSpiRelation(QAccessible::Relation relation);
104
105QT_END_NAMESPACE
106
107#endif /* Q_SPI_CONSTANT_MAPPINGS_H */
108

source code of qtbase/src/gui/accessible/linux/qspi_constant_mappings_p.h