Bug 1804798 - Explicitly set auto page name (and corresponding debug flag) when inser...
[gecko.git] / accessible / mac / mozAccessible.h
blob3288b0cd9727390eb0f3796708153eecd1e4848c
1 /* clang-format off */
2 /* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3 /* clang-format on */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #include "AccessibleWrap.h"
9 #include "RemoteAccessible.h"
11 #import <Cocoa/Cocoa.h>
13 #import "MOXAccessibleBase.h"
15 @class mozRootAccessible;
17 /**
18 * All mozAccessibles are either abstract objects (that correspond to XUL
19 * widgets, HTML frames, etc) or are attached to a certain view; for example
20 * a document view. When we hand an object off to an AT, we always want
21 * to give it the represented view, in the latter case.
24 namespace mozilla {
25 namespace a11y {
27 inline mozAccessible* GetNativeFromGeckoAccessible(
28 mozilla::a11y::Accessible* aAcc) {
29 if (!aAcc) {
30 return nil;
32 if (LocalAccessible* acc = aAcc->AsLocal()) {
33 mozAccessible* native = nil;
34 acc->GetNativeInterface((void**)&native);
35 return native;
38 RemoteAccessible* proxy = aAcc->AsRemote();
39 return reinterpret_cast<mozAccessible*>(proxy->GetWrapper());
42 } // a11y
43 } // mozilla
45 @interface mozAccessible : MOXAccessibleBase {
46 /**
47 * Reference to the accessible we were created with;
48 * either a proxy accessible or an accessible wrap.
50 mozilla::a11y::Accessible* mGeckoAccessible;
52 /**
53 * The role of our gecko accessible.
55 mozilla::a11y::role mRole;
57 /**
58 * A cache of a subset of our states.
60 uint64_t mCachedState;
62 nsStaticAtom* mARIARole;
64 bool mIsLiveRegion;
67 // inits with the given wrap or proxy accessible
68 - (id)initWithAccessible:(mozilla::a11y::Accessible*)aAcc;
70 // allows for gecko accessible access outside of the class
71 - (mozilla::a11y::Accessible*)geckoAccessible;
73 - (mozilla::a11y::Accessible*)geckoDocument;
75 // override
76 - (void)dealloc;
78 // should a child be disabled
79 - (BOOL)disableChild:(mozAccessible*)child;
81 // Given a gecko accessibility event type, post the relevant
82 // system accessibility notification.
83 // Note: when overriding or adding new events, make sure your events aren't
84 // filtered out in Platform::ProxyEvent or AccessibleWrap::HandleAccEvent!
85 - (void)handleAccessibleEvent:(uint32_t)eventType;
87 - (void)handleAccessibleTextChangeEvent:(NSString*)change
88 inserted:(BOOL)isInserted
89 inContainer:(mozilla::a11y::Accessible*)container
90 at:(int32_t)start;
92 // internal method to retrieve a child at a given index.
93 - (id)childAt:(uint32_t)i;
95 // Get gecko accessible's state.
96 - (uint64_t)state;
98 // Get gecko accessible's state filtered through given mask.
99 - (uint64_t)stateWithMask:(uint64_t)mask;
101 // Notify of a state change, so the cache can be altered.
102 - (void)stateChanged:(uint64_t)state isEnabled:(BOOL)enabled;
104 // Invalidate cached state.
105 - (void)invalidateState;
107 // Get top level (tab) web area.
108 - (mozAccessible*)topWebArea;
110 // Handle a role change
111 - (void)handleRoleChanged:(mozilla::a11y::role)newRole;
113 // Get ARIA role
114 - (nsStaticAtom*)ARIARole;
116 // Get array of related mozAccessibles
117 - (NSArray<mozAccessible*>*)getRelationsByType:
118 (mozilla::a11y::RelationType)relationType;
120 #pragma mark - mozAccessible protocol / widget
122 // override
123 - (BOOL)hasRepresentedView;
125 // override
126 - (id)representedView;
128 // override
129 - (BOOL)isRoot;
131 #pragma mark - MOXAccessible protocol
133 // override
134 - (BOOL)moxBlockSelector:(SEL)selector;
136 // override
137 - (id)moxHitTest:(NSPoint)point;
139 // override
140 - (id)moxFocusedUIElement;
142 - (id<MOXTextMarkerSupport>)moxTextMarkerDelegate;
144 - (BOOL)moxIsLiveRegion;
146 // Attribute getters
148 // override
149 - (id<mozAccessible>)moxParent;
151 // override
152 - (NSArray*)moxChildren;
154 // override
155 - (NSValue*)moxSize;
157 // override
158 - (NSValue*)moxPosition;
160 // override
161 - (NSString*)moxRole;
163 // override
164 - (NSString*)moxSubrole;
166 // override
167 - (NSString*)moxRoleDescription;
169 // override
170 - (NSWindow*)moxWindow;
172 // override
173 - (id)moxValue;
175 // override
176 - (NSString*)moxTitle;
178 // override
179 - (NSString*)moxLabel;
181 // override
182 - (NSString*)moxHelp;
184 // override
185 - (NSNumber*)moxEnabled;
187 // override
188 - (NSNumber*)moxFocused;
190 // override
191 - (NSNumber*)moxSelected;
193 // override
194 - (NSNumber*)moxExpanded;
196 // override
197 - (NSValue*)moxFrame;
199 // override
200 - (NSString*)moxARIACurrent;
202 // override
203 - (NSNumber*)moxARIAAtomic;
205 // override
206 - (NSString*)moxARIALive;
208 // override
209 - (NSString*)moxARIARelevant;
211 // override
212 - (id)moxTitleUIElement;
214 // override
215 - (NSString*)moxDOMIdentifier;
217 // override
218 - (NSNumber*)moxRequired;
220 // override
221 - (NSNumber*)moxElementBusy;
223 // override
224 - (NSArray*)moxLinkedUIElements;
226 // override
227 - (NSArray*)moxARIAControls;
229 // override
230 - (id)moxEditableAncestor;
232 // override
233 - (id)moxHighestEditableAncestor;
235 // override
236 - (id)moxFocusableAncestor;
238 #ifndef RELEASE_OR_BETA
239 // override
240 - (NSString*)moxMozDebugDescription;
241 #endif
243 // override
244 - (NSArray*)moxUIElementsForSearchPredicate:(NSDictionary*)searchPredicate;
246 // override
247 - (NSNumber*)moxUIElementCountForSearchPredicate:(NSDictionary*)searchPredicate;
249 // override
250 - (void)moxSetFocused:(NSNumber*)focused;
252 // override
253 - (void)moxPerformScrollToVisible;
255 // override
256 - (void)moxPerformShowMenu;
258 // override
259 - (void)moxPerformPress;
261 // override
262 - (BOOL)moxIgnoreWithParent:(mozAccessible*)parent;
264 // override
265 - (BOOL)moxIgnoreChild:(mozAccessible*)child;
267 #pragma mark -
269 // makes ourselves "expired". after this point, we might be around if someone
270 // has retained us (e.g., a third-party), but we really contain no information.
271 // override
272 - (void)expire;
273 // override
274 - (BOOL)isExpired;
276 @end