Bug 1899500 - Implement explicit resource management in Baseline compiler. r=arai
[gecko.git] / accessible / mac / mozAccessible.h
blob90a88e4ab91a5407afce700ee6071e1c08314413
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 #ifndef _MozAccessible_H_
9 #define _MozAccessible_H_
11 #include "AccessibleWrap.h"
12 #include "RemoteAccessible.h"
14 #import <Cocoa/Cocoa.h>
16 #import "MOXAccessibleBase.h"
18 @class mozRootAccessible;
20 /**
21 * All mozAccessibles are either abstract objects (that correspond to XUL
22 * widgets, HTML frames, etc) or are attached to a certain view; for example
23 * a document view. When we hand an object off to an AT, we always want
24 * to give it the represented view, in the latter case.
27 namespace mozilla {
28 namespace a11y {
30 inline mozAccessible* GetNativeFromGeckoAccessible(
31 mozilla::a11y::Accessible* aAcc) {
32 if (!aAcc) {
33 return nil;
35 if (LocalAccessible* acc = aAcc->AsLocal()) {
36 mozAccessible* native = nil;
37 acc->GetNativeInterface((void**)&native);
38 return native;
41 RemoteAccessible* proxy = aAcc->AsRemote();
42 return reinterpret_cast<mozAccessible*>(proxy->GetWrapper());
45 // Checked state values some accessibles return as AXValue.
46 enum CheckedState {
47 kUncheckable = -1,
48 kUnchecked = 0,
49 kChecked = 1,
50 kMixed = 2
53 } // namespace a11y
54 } // namespace mozilla
56 @interface mozAccessible : MOXAccessibleBase {
57 /**
58 * Reference to the accessible we were created with;
59 * either a proxy accessible or an accessible wrap.
61 mozilla::a11y::Accessible* mGeckoAccessible;
63 /**
64 * The role of our gecko accessible.
66 mozilla::a11y::role mRole;
68 nsStaticAtom* mARIARole;
70 bool mIsLiveRegion;
73 // inits with the given wrap or proxy accessible
74 - (id)initWithAccessible:(mozilla::a11y::Accessible*)aAcc;
76 // allows for gecko accessible access outside of the class
77 - (mozilla::a11y::Accessible*)geckoAccessible;
79 // override
80 - (void)dealloc;
82 // should a child be disabled
83 - (BOOL)disableChild:(mozAccessible*)child;
85 // Given a gecko accessibility event type, post the relevant
86 // system accessibility notification.
87 // Note: when overriding or adding new events, make sure your events aren't
88 // filtered out in Platform::PlatformEvent or AccessibleWrap::HandleAccEvent!
89 - (void)handleAccessibleEvent:(uint32_t)eventType;
91 - (void)handleAccessibleTextChangeEvent:(NSString*)change
92 inserted:(BOOL)isInserted
93 inContainer:(mozilla::a11y::Accessible*)container
94 at:(int32_t)start;
96 // internal method to retrieve a child at a given index.
97 - (id)childAt:(uint32_t)i;
99 // Get gecko accessible's state.
100 - (uint64_t)state;
102 // Get gecko accessible's state filtered through given mask.
103 - (uint64_t)stateWithMask:(uint64_t)mask;
105 // Notify of a state change, so notifications can be fired.
106 - (void)stateChanged:(uint64_t)state isEnabled:(BOOL)enabled;
108 // Get top level (tab) web area.
109 - (mozAccessible*)topWebArea;
111 // Handle a role change
112 - (void)handleRoleChanged:(mozilla::a11y::role)newRole;
114 // Get ARIA role
115 - (nsStaticAtom*)ARIARole;
117 // Get array of related mozAccessibles
118 - (NSArray<mozAccessible*>*)getRelationsByType:
119 (mozilla::a11y::RelationType)relationType;
121 #pragma mark - mozAccessible protocol / widget
123 // override
124 - (BOOL)hasRepresentedView;
126 // override
127 - (id)representedView;
129 // override
130 - (BOOL)isRoot;
132 #pragma mark - MOXAccessible protocol
134 // override
135 - (BOOL)moxBlockSelector:(SEL)selector;
137 // override
138 - (id)moxHitTest:(NSPoint)point;
140 // override
141 - (id)moxFocusedUIElement;
143 - (id<MOXTextMarkerSupport>)moxTextMarkerDelegate;
145 - (BOOL)moxIsLiveRegion;
147 // Attribute getters
149 // override
150 - (id<mozAccessible>)moxParent;
152 // override
153 - (NSArray*)moxChildren;
155 // override
156 - (NSValue*)moxSize;
158 // override
159 - (NSValue*)moxPosition;
161 // override
162 - (NSString*)moxRole;
164 // override
165 - (NSString*)moxSubrole;
167 // override
168 - (NSString*)moxRoleDescription;
170 // override
171 - (NSWindow*)moxWindow;
173 // override
174 - (id)moxValue;
176 // override
177 - (NSString*)moxTitle;
179 // override
180 - (NSString*)moxLabel;
182 // override
183 - (NSString*)moxHelp;
185 // override
186 - (NSNumber*)moxEnabled;
188 // override
189 - (NSNumber*)moxFocused;
191 // override
192 - (NSNumber*)moxSelected;
194 // override
195 - (NSNumber*)moxExpanded;
197 // override
198 - (NSValue*)moxFrame;
200 // override
201 - (NSString*)moxARIACurrent;
203 // override
204 - (NSNumber*)moxARIAAtomic;
206 // override
207 - (NSString*)moxARIALive;
209 // override
210 - (NSNumber*)moxARIAPosInSet;
212 // override
213 - (NSNumber*)moxARIASetSize;
215 // override
216 - (NSString*)moxARIARelevant;
218 // override
219 - (NSString*)moxPlaceholderValue;
221 // override
222 - (id)moxTitleUIElement;
224 // override
225 - (NSString*)moxDOMIdentifier;
227 // override
228 - (NSNumber*)moxRequired;
230 // override
231 - (NSNumber*)moxElementBusy;
233 // override
234 - (NSArray*)moxLinkedUIElements;
236 // override
237 - (NSArray*)moxARIAControls;
239 // override
240 - (id)moxEditableAncestor;
242 // override
243 - (id)moxHighestEditableAncestor;
245 // override
246 - (id)moxFocusableAncestor;
248 // override
249 - (NSString*)moxLanguage;
251 #ifndef RELEASE_OR_BETA
252 // override
253 - (NSString*)moxMozDebugDescription;
254 #endif
256 // override
257 - (NSArray*)moxUIElementsForSearchPredicate:(NSDictionary*)searchPredicate;
259 // override
260 - (NSNumber*)moxUIElementCountForSearchPredicate:(NSDictionary*)searchPredicate;
262 // override
263 - (void)moxSetFocused:(NSNumber*)focused;
265 // override
266 - (void)moxPerformScrollToVisible;
268 // override
269 - (void)moxPerformShowMenu;
271 // override
272 - (void)moxPerformPress;
274 // override
275 - (BOOL)moxIgnoreWithParent:(mozAccessible*)parent;
277 // override
278 - (BOOL)moxIgnoreChild:(mozAccessible*)child;
280 #pragma mark -
282 // makes ourselves "expired". after this point, we might be around if someone
283 // has retained us (e.g., a third-party), but we really contain no information.
284 // override
285 - (void)expire;
286 // override
287 - (BOOL)isExpired;
289 @end
291 #endif