2 /* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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
;
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.
27 inline mozAccessible
* GetNativeFromGeckoAccessible(
28 mozilla::a11y::Accessible
* aAcc
) {
32 if (LocalAccessible
* acc
= aAcc
->AsLocal()) {
33 mozAccessible
* native
= nil
;
34 acc
->GetNativeInterface((void**)&native
);
38 RemoteAccessible
* proxy
= aAcc
->AsRemote();
39 return reinterpret_cast<mozAccessible
*>(proxy
->GetWrapper());
45 @interface mozAccessible
: MOXAccessibleBase
{
47 * Reference to the accessible we were created with;
48 * either a proxy accessible or an accessible wrap.
50 mozilla::a11y::Accessible
* mGeckoAccessible
;
53 * The role of our gecko accessible.
55 mozilla::a11y::role mRole
;
58 * A cache of a subset of our states.
60 uint64_t mCachedState
;
62 nsStaticAtom
* mARIARole
;
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
;
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
92 // internal method to retrieve a child at a given index.
93 - (id
)childAt
:(uint32_t)i
;
95 // Get gecko accessible's 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
;
114 - (nsStaticAtom
*)ARIARole
;
116 // Get array of related mozAccessibles
117 - (NSArray
<mozAccessible
*>*)getRelationsByType
:
118 (mozilla::a11y::RelationType
)relationType
;
120 #pragma mark - mozAccessible protocol / widget
123 - (BOOL
)hasRepresentedView
;
126 - (id
)representedView
;
131 #pragma mark - MOXAccessible protocol
134 - (BOOL
)moxBlockSelector
:(SEL
)selector
;
137 - (id
)moxHitTest
:(NSPoint
)point
;
140 - (id
)moxFocusedUIElement
;
142 - (id
<MOXTextMarkerSupport
>)moxTextMarkerDelegate
;
144 - (BOOL
)moxIsLiveRegion
;
149 - (id
<mozAccessible
>)moxParent
;
152 - (NSArray
*)moxChildren
;
158 - (NSValue
*)moxPosition
;
161 - (NSString
*)moxRole
;
164 - (NSString
*)moxSubrole
;
167 - (NSString
*)moxRoleDescription
;
170 - (NSWindow
*)moxWindow
;
176 - (NSString
*)moxTitle
;
179 - (NSString
*)moxLabel
;
182 - (NSString
*)moxHelp
;
185 - (NSNumber
*)moxEnabled
;
188 - (NSNumber
*)moxFocused
;
191 - (NSNumber
*)moxSelected
;
194 - (NSNumber
*)moxExpanded
;
197 - (NSValue
*)moxFrame
;
200 - (NSString
*)moxARIACurrent
;
203 - (NSNumber
*)moxARIAAtomic
;
206 - (NSString
*)moxARIALive
;
209 - (NSString
*)moxARIARelevant
;
212 - (id
)moxTitleUIElement
;
215 - (NSString
*)moxDOMIdentifier
;
218 - (NSNumber
*)moxRequired
;
221 - (NSNumber
*)moxElementBusy
;
224 - (NSArray
*)moxLinkedUIElements
;
227 - (NSArray
*)moxARIAControls
;
230 - (id
)moxEditableAncestor
;
233 - (id
)moxHighestEditableAncestor
;
236 - (id
)moxFocusableAncestor
;
238 #ifndef RELEASE_OR_BETA
240 - (NSString
*)moxMozDebugDescription
;
244 - (NSArray
*)moxUIElementsForSearchPredicate
:(NSDictionary
*)searchPredicate
;
247 - (NSNumber
*)moxUIElementCountForSearchPredicate
:(NSDictionary
*)searchPredicate
;
250 - (void)moxSetFocused
:(NSNumber
*)focused
;
253 - (void)moxPerformScrollToVisible
;
256 - (void)moxPerformShowMenu
;
259 - (void)moxPerformPress
;
262 - (BOOL
)moxIgnoreWithParent
:(mozAccessible
*)parent
;
265 - (BOOL
)moxIgnoreChild
:(mozAccessible
*)child
;
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.