| 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 | |
| 29 | QT_REQUIRE_CONFIG(accessibility); |
| 30 | |
| 31 | // missing from at-spi2-core: |
| 32 | #define ATSPI_DBUS_INTERFACE_EVENT_WINDOW "org.a11y.atspi.Event.Window" |
| 33 | #define ATSPI_DBUS_INTERFACE_EVENT_FOCUS "org.a11y.atspi.Event.Focus" |
| 34 | |
| 35 | #define QSPI_OBJECT_PATH_ACCESSIBLE "/org/a11y/atspi/accessible" |
| 36 | #define QSPI_OBJECT_PATH_PREFIX "/org/a11y/atspi/accessible/" |
| 37 | |
| 38 | QT_BEGIN_NAMESPACE |
| 39 | |
| 40 | struct RoleNames { |
| 41 | RoleNames() {} |
| 42 | RoleNames(AtspiRole r, const QString& n, const QString& ln) |
| 43 | :m_spiRole(r), m_name(n), m_localizedName(ln) |
| 44 | {} |
| 45 | |
| 46 | AtspiRole spiRole() const {return m_spiRole;} |
| 47 | QString name() const {return m_name;} |
| 48 | QString localizedName() const {return m_localizedName;} |
| 49 | |
| 50 | private: |
| 51 | AtspiRole m_spiRole = ATSPI_ROLE_INVALID; |
| 52 | QString m_name; |
| 53 | QString m_localizedName; |
| 54 | }; |
| 55 | |
| 56 | inline void setSpiStateBit(quint64* state, AtspiStateType spiState) |
| 57 | { |
| 58 | *state |= quint64(1) << spiState; |
| 59 | } |
| 60 | |
| 61 | inline void unsetSpiStateBit(quint64* state, AtspiStateType spiState) |
| 62 | { |
| 63 | *state &= ~(quint64(1) << spiState); |
| 64 | } |
| 65 | |
| 66 | quint64 spiStatesFromQState(QAccessible::State state); |
| 67 | QSpiUIntList spiStateSetFromSpiStates(quint64 states); |
| 68 | |
| 69 | AtspiRelationType qAccessibleRelationToAtSpiRelation(QAccessible::Relation relation); |
| 70 | |
| 71 | QT_END_NAMESPACE |
| 72 | |
| 73 | #endif /* Q_SPI_CONSTANT_MAPPINGS_H */ |
| 74 | |