no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / accessible / atk / nsStateMap.h
blob3587ccd6cfd9bbbab1b5b3b729dbf6ef24c1a3c1
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include <atk/atk.h>
8 #include "AccessibleWrap.h"
10 #include <type_traits>
12 // clang-format off
13 /******************************************************************************
14 The following accessible states aren't translated, just ignored:
15 STATE_READONLY: Supported indirectly via EXT_STATE_EDITABLE
16 STATE_HOTTRACKED: No ATK equivalent. No known use case.
17 The nsIAccessible state is not currently supported.
18 STATE_FLOATING: No ATK equivalent. No known use case.
19 The nsIAccessible state is not currently supported.
20 STATE_MOVEABLE: No ATK equivalent. No known use case.
21 The nsIAccessible state is not currently supported.
22 STATE_SELFVOICING: No ATK equivalent -- the object has self-TTS.
23 The nsIAccessible state is not currently supported.
24 STATE_LINKED: The object is formatted as a hyperlink. Supported via ATK_ROLE_LINK.
25 STATE_EXTSELECTABLE: Indicates that an object extends its selection.
26 This is supported via STATE_MULTISELECTABLE.
27 STATE_PROTECTED: The object is a password-protected edit control.
28 Supported via ATK_ROLE_PASSWORD_TEXT
29 STATE_PINNED: The object is pinned, usually indicating it is fixed in
30 place and has permanence. No ATK equivalent. The
31 accessible state is not currently supported.
33 The following ATK states are not supported:
34 ATK_STATE_ARMED: No clear use case, used briefly when button is activated
35 ATK_STATE_HAS_TOOLTIP: No clear use case, no IA2 equivalent
36 ATK_STATE_ICONIFIED: Mozilla does not have elements which are collapsable into icons
37 ATK_STATE_TRUNCATED: No clear use case. Indicates that an object's onscreen content is truncated,
38 e.g. a text value in a spreadsheet cell. No IA2 state.
39 ******************************************************************************/
40 // clang-format on
42 enum EStateMapEntryType {
43 kMapDirectly,
44 kMapOpposite, // For example, UNAVAILABLE is the opposite of ENABLED
45 kNoStateChange, // Don't fire state change event
48 const AtkStateType kNone = ATK_STATE_INVALID;
50 struct AtkStateMap {
51 AtkStateType atkState;
52 EStateMapEntryType stateMapEntryType;
55 // Map array from cross platform states to ATK states
56 static const AtkStateMap gAtkStateMap[] =
58 // Cross Platform States
59 // clang-format off
60 { kNone, kMapOpposite }, // states::UNAVAILABLE = 1 << 0
61 { ATK_STATE_SELECTED, kMapDirectly }, // states::SELECTED = 1 << 1
62 { ATK_STATE_FOCUSED, kMapDirectly }, // states::FOCUSED = 1 << 2
63 { ATK_STATE_PRESSED, kMapDirectly }, // states::PRESSED = 1 << 3
64 { ATK_STATE_CHECKED, kMapDirectly }, // states::CHECKED = 1 << 4
65 { ATK_STATE_INDETERMINATE, kMapDirectly }, // states::MIXED = 1 << 5
66 { kNone, kMapDirectly }, // states::READONLY = 1 << 6
67 { kNone, kMapDirectly }, // states::HOTTRACKED = 1 << 7
68 { ATK_STATE_DEFAULT, kMapDirectly }, // states::DEFAULT = 1 << 8
69 { ATK_STATE_EXPANDED, kMapDirectly }, // states::EXPANDED = 1 << 9
70 { kNone, kNoStateChange }, // states::COLLAPSED = 1 << 10
71 { ATK_STATE_BUSY, kMapDirectly }, // states::BUSY = 1 << 11
72 { kNone, kMapDirectly }, // states::FLOATING = 1 << 12
73 { ATK_STATE_CHECKABLE, kMapDirectly }, // states::CHECKABLE = 1 << 13
74 { ATK_STATE_ANIMATED, kMapDirectly }, // states::ANIMATED = 1 << 14
75 { ATK_STATE_VISIBLE, kMapOpposite }, // states::INVISIBLE = 1 << 15
76 { ATK_STATE_SHOWING, kMapOpposite }, // states::OFFSCREEN = 1 << 16
77 { ATK_STATE_RESIZABLE, kMapDirectly }, // states::SIZEABLE = 1 << 17
78 { kNone, kMapDirectly }, // states::MOVEABLE = 1 << 18
79 { kNone, kMapDirectly }, // states::SELFVOICING = 1 << 19
80 { ATK_STATE_FOCUSABLE, kMapDirectly }, // states::FOCUSABLE = 1 << 20
81 { ATK_STATE_SELECTABLE, kMapDirectly }, // states::SELECTABLE = 1 << 21
82 { kNone, kMapDirectly }, // states::LINKED = 1 << 22
83 { ATK_STATE_VISITED, kMapDirectly }, // states::TRAVERSED = 1 << 23
84 { ATK_STATE_MULTISELECTABLE, kMapDirectly }, // states::MULTISELECTABLE = 1 << 24
85 { kNone, kMapDirectly }, // states::EXTSELECTABLE = 1 << 25
86 { ATK_STATE_REQUIRED, kMapDirectly }, // states::STATE_REQUIRED = 1 << 26
87 { kNone, kMapDirectly }, // states::ALERT_MEDIUM = 1 << 27
88 { ATK_STATE_INVALID_ENTRY, kMapDirectly }, // states::INVALID = 1 << 28
89 { kNone, kMapDirectly }, // states::PROTECTED = 1 << 29
90 { ATK_STATE_HAS_POPUP, kMapDirectly }, // states::HASPOPUP = 1 << 30
91 { ATK_STATE_SUPPORTS_AUTOCOMPLETION, kMapDirectly }, // states::SUPPORTS_AUTOCOMPLETION = 1 << 31
92 { ATK_STATE_DEFUNCT, kMapDirectly }, // states::DEFUNCT = 1 << 32
93 { ATK_STATE_SELECTABLE_TEXT, kMapDirectly }, // states::SELECTABLE_TEXT = 1 << 33
94 { ATK_STATE_EDITABLE, kMapDirectly }, // states::EDITABLE = 1 << 34
95 { ATK_STATE_ACTIVE, kMapDirectly }, // states::ACTIVE = 1 << 35
96 { ATK_STATE_MODAL, kMapDirectly }, // states::MODAL = 1 << 36
97 { ATK_STATE_MULTI_LINE, kMapDirectly }, // states::MULTI_LINE = 1 << 37
98 { ATK_STATE_HORIZONTAL, kMapDirectly }, // states::HORIZONTAL = 1 << 38
99 { ATK_STATE_OPAQUE, kMapDirectly }, // states::OPAQUE = 1 << 39
100 { ATK_STATE_SINGLE_LINE, kMapDirectly }, // states::SINGLE_LINE = 1 << 40
101 { ATK_STATE_TRANSIENT, kMapDirectly }, // states::TRANSIENT = 1 << 41
102 { ATK_STATE_VERTICAL, kMapDirectly }, // states::VERTICAL = 1 << 42
103 { ATK_STATE_STALE, kMapDirectly }, // states::STALE = 1 << 43
104 { ATK_STATE_ENABLED, kMapDirectly }, // states::ENABLED = 1 << 44
105 { ATK_STATE_SENSITIVE, kMapDirectly }, // states::SENSITIVE = 1 << 45
106 { ATK_STATE_EXPANDABLE, kMapDirectly }, // states::EXPANDABLE = 1 << 46
107 { kNone, kMapDirectly }, // states::PINNED = 1 << 47
108 { ATK_STATE_ACTIVE, kMapDirectly } // states::CURRENT = 1 << 48
109 // clang-format on
112 static const auto gAtkStateMapLen = std::extent<decltype(gAtkStateMap)>::value;
114 static_assert(((uint64_t)0x1) << (gAtkStateMapLen - 1) ==
115 mozilla::a11y::states::LAST_ENTRY,
116 "ATK states map is out of sync with internal states");